Skip to content

Fix some swift tests due to the substitute drive paths on Windows. #68023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2672,6 +2672,13 @@ if hasattr(config, 'target_link_sdk_future_version'):
config.substitutions.append(('%target-link-sdk-future-version',
config.target_link_sdk_future_version))

def realpath(path):
if not kIsWindows:
return os.path.realpath(path)
else:
# For Windows, we don't expand substitute drives due to MAX_PATH limitations, matching what the llvm lit does.
return os.path.abspath(path)

run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s' % (
shell_quote(sys.executable),
shell_quote(config.PathSanitizingFileCheck),
Expand All @@ -2681,8 +2688,8 @@ run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitiz
# we provide we use realpath here. Because PathSanitizingFileCheck only
# understands sanitize patterns with forward slashes, and realpath normalizes
# the slashes, we have to replace them back to forward slashes.
shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")),
shell_quote(os.path.realpath(config.swift_src_root).replace("\\", "/")),
shell_quote(realpath(swift_obj_root).replace("\\", "/")),
shell_quote(realpath(config.swift_src_root).replace("\\", "/")),
shell_quote(config.filecheck),
'--enable-windows-compatibility' if kIsWindows else '')

Expand Down