Skip to content

Commit 9f66d03

Browse files
authored
Merge pull request #68023 from hjyamauchi/abspath
Fix some swift tests due to the substitute drive paths on Windows.
2 parents 36d333c + d975ab3 commit 9f66d03

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/lit.cfg

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,13 @@ if hasattr(config, 'target_link_sdk_future_version'):
26722672
config.substitutions.append(('%target-link-sdk-future-version',
26732673
config.target_link_sdk_future_version))
26742674

2675+
def realpath(path):
2676+
if not kIsWindows:
2677+
return os.path.realpath(path)
2678+
else:
2679+
# For Windows, we don't expand substitute drives due to MAX_PATH limitations, matching what the llvm lit does.
2680+
return os.path.abspath(path)
2681+
26752682
run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s' % (
26762683
shell_quote(sys.executable),
26772684
shell_quote(config.PathSanitizingFileCheck),
@@ -2681,8 +2688,8 @@ run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitiz
26812688
# we provide we use realpath here. Because PathSanitizingFileCheck only
26822689
# understands sanitize patterns with forward slashes, and realpath normalizes
26832690
# the slashes, we have to replace them back to forward slashes.
2684-
shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")),
2685-
shell_quote(os.path.realpath(config.swift_src_root).replace("\\", "/")),
2691+
shell_quote(realpath(swift_obj_root).replace("\\", "/")),
2692+
shell_quote(realpath(config.swift_src_root).replace("\\", "/")),
26862693
shell_quote(config.filecheck),
26872694
'--enable-windows-compatibility' if kIsWindows else '')
26882695

0 commit comments

Comments
 (0)