Skip to content

Commit e944f4c

Browse files
committed
Revert "[lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows"
This reverts commit c1cf459. Reverting to permit time to explore the underlying issue. This change regressed the clang-PPC64-AIX and m68k-linux-cross builders. Differential Revision: https://reviews.llvm.org/D153138 Reviewed By: compnerd
1 parent 1e9ac71 commit e944f4c

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def change_dir(self, newdir):
7474
if os.path.isabs(newdir):
7575
self.cwd = newdir
7676
else:
77-
self.cwd = os.path.abspath(os.path.join(self.cwd, newdir))
77+
self.cwd = os.path.realpath(os.path.join(self.cwd, newdir))
7878

7979

8080
class TimeoutHelper(object):
@@ -427,7 +427,7 @@ def executeBuiltinMkdir(cmd, cmd_shenv):
427427
dir = to_unicode(dir) if kIsWindows else to_bytes(dir)
428428
cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
429429
if not os.path.isabs(dir):
430-
dir = os.path.abspath(os.path.join(cwd, dir))
430+
dir = os.path.realpath(os.path.join(cwd, dir))
431431
if parent:
432432
lit.util.mkdir_p(dir)
433433
else:
@@ -473,7 +473,7 @@ def on_rm_error(func, path, exc_info):
473473
path = to_unicode(path) if kIsWindows else to_bytes(path)
474474
cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
475475
if not os.path.isabs(path):
476-
path = os.path.abspath(os.path.join(cwd, path))
476+
path = os.path.realpath(os.path.join(cwd, path))
477477
if force and not os.path.exists(path):
478478
continue
479479
try:

llvm/utils/lit/lit/builtin_commands/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def main(argv):
281281
try:
282282
for file in args:
283283
if file != "-" and not os.path.isabs(file):
284-
file = os.path.abspath(os.path.join(os.getcwd(), file))
284+
file = os.path.realpath(os.path.join(os.getcwd(), file))
285285

286286
if flags.recursive_diff:
287287
if file == "-":

llvm/utils/lit/lit/discovery.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def search1(path):
5656
# configuration to load instead.
5757
config_map = litConfig.params.get("config_map")
5858
if config_map:
59-
target = config_map.get(os.path.normcase(os.path.abspath(cfgpath)))
59+
cfgpath = os.path.realpath(cfgpath)
60+
target = config_map.get(os.path.normcase(cfgpath))
6061
if target:
6162
cfgpath = target
6263

@@ -66,16 +67,16 @@ def search1(path):
6667

6768
cfg = TestingConfig.fromdefaults(litConfig)
6869
cfg.load_from_path(cfgpath, litConfig)
69-
source_root = os.path.abspath(cfg.test_source_root or path)
70-
exec_root = os.path.abspath(cfg.test_exec_root or path)
70+
source_root = os.path.realpath(cfg.test_source_root or path)
71+
exec_root = os.path.realpath(cfg.test_exec_root or path)
7172
return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
7273

7374
def search(path):
7475
# Check for an already instantiated test suite.
75-
full_path = os.path.normcase(os.path.abspath(path))
76-
res = cache.get(full_path)
76+
real_path = os.path.realpath(path)
77+
res = cache.get(real_path)
7778
if res is None:
78-
cache[full_path] = res = search1(path)
79+
cache[real_path] = res = search1(path)
7980
return res
8081

8182
# Canonicalize the path.

llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55
main_config = sys.argv[1]
6-
main_config = os.path.abspath(main_config)
6+
main_config = os.path.realpath(main_config)
77
main_config = os.path.normcase(main_config)
88

99
config_map = {main_config: sys.argv[2]}

llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ config.suffixes = ['.txt']
55
config.test_format = lit.formats.ShTest()
66

77
import os
8-
config.test_exec_root = os.path.abspath(os.path.dirname(__file__))
8+
config.test_exec_root = os.path.realpath(os.path.dirname(__file__))
99
config.test_source_root = os.path.join(config.test_exec_root, "tests")

llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.test_source_root = None
77
config.test_exec_root = None
88
import os.path
99

10-
config.llvm_tools_dir = os.path.abspath(os.path.dirname(__file__))
10+
config.llvm_tools_dir = os.path.realpath(os.path.dirname(__file__))
1111
import lit.llvm
1212

1313
lit.llvm.initialize(lit_config, config)

llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.test_source_root = None
77
config.test_exec_root = None
88
import os.path
99

10-
this_dir = os.path.abspath(os.path.dirname(__file__))
10+
this_dir = os.path.realpath(os.path.dirname(__file__))
1111
config.llvm_tools_dir = os.path.join(this_dir, "build")
1212
import lit.llvm
1313

0 commit comments

Comments
 (0)