Revert "[lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows"

This reverts commit c1cf459cbd79cc7d6ca834390649fb9185a4b237.

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
This commit is contained in:
Saleem Abdulrasool 2023-06-16 07:06:09 -07:00
parent 1e9ac71787
commit e944f4c950
7 changed files with 15 additions and 14 deletions

View File

@ -74,7 +74,7 @@ class ShellEnvironment(object):
if os.path.isabs(newdir):
self.cwd = newdir
else:
self.cwd = os.path.abspath(os.path.join(self.cwd, newdir))
self.cwd = os.path.realpath(os.path.join(self.cwd, newdir))
class TimeoutHelper(object):
@ -427,7 +427,7 @@ def executeBuiltinMkdir(cmd, cmd_shenv):
dir = to_unicode(dir) if kIsWindows else to_bytes(dir)
cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
if not os.path.isabs(dir):
dir = os.path.abspath(os.path.join(cwd, dir))
dir = os.path.realpath(os.path.join(cwd, dir))
if parent:
lit.util.mkdir_p(dir)
else:
@ -473,7 +473,7 @@ def executeBuiltinRm(cmd, cmd_shenv):
path = to_unicode(path) if kIsWindows else to_bytes(path)
cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
if not os.path.isabs(path):
path = os.path.abspath(os.path.join(cwd, path))
path = os.path.realpath(os.path.join(cwd, path))
if force and not os.path.exists(path):
continue
try:

View File

@ -281,7 +281,7 @@ def main(argv):
try:
for file in args:
if file != "-" and not os.path.isabs(file):
file = os.path.abspath(os.path.join(os.getcwd(), file))
file = os.path.realpath(os.path.join(os.getcwd(), file))
if flags.recursive_diff:
if file == "-":

View File

@ -56,7 +56,8 @@ def getTestSuite(item, litConfig, cache):
# configuration to load instead.
config_map = litConfig.params.get("config_map")
if config_map:
target = config_map.get(os.path.normcase(os.path.abspath(cfgpath)))
cfgpath = os.path.realpath(cfgpath)
target = config_map.get(os.path.normcase(cfgpath))
if target:
cfgpath = target
@ -66,16 +67,16 @@ def getTestSuite(item, litConfig, cache):
cfg = TestingConfig.fromdefaults(litConfig)
cfg.load_from_path(cfgpath, litConfig)
source_root = os.path.abspath(cfg.test_source_root or path)
exec_root = os.path.abspath(cfg.test_exec_root or path)
source_root = os.path.realpath(cfg.test_source_root or path)
exec_root = os.path.realpath(cfg.test_exec_root or path)
return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
def search(path):
# Check for an already instantiated test suite.
full_path = os.path.normcase(os.path.abspath(path))
res = cache.get(full_path)
real_path = os.path.realpath(path)
res = cache.get(real_path)
if res is None:
cache[full_path] = res = search1(path)
cache[real_path] = res = search1(path)
return res
# Canonicalize the path.

View File

@ -3,7 +3,7 @@ import os
import sys
main_config = sys.argv[1]
main_config = os.path.abspath(main_config)
main_config = os.path.realpath(main_config)
main_config = os.path.normcase(main_config)
config_map = {main_config: sys.argv[2]}

View File

@ -5,5 +5,5 @@ config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()
import os
config.test_exec_root = os.path.abspath(os.path.dirname(__file__))
config.test_exec_root = os.path.realpath(os.path.dirname(__file__))
config.test_source_root = os.path.join(config.test_exec_root, "tests")

View File

@ -7,7 +7,7 @@ config.test_source_root = None
config.test_exec_root = None
import os.path
config.llvm_tools_dir = os.path.abspath(os.path.dirname(__file__))
config.llvm_tools_dir = os.path.realpath(os.path.dirname(__file__))
import lit.llvm
lit.llvm.initialize(lit_config, config)

View File

@ -7,7 +7,7 @@ config.test_source_root = None
config.test_exec_root = None
import os.path
this_dir = os.path.abspath(os.path.dirname(__file__))
this_dir = os.path.realpath(os.path.dirname(__file__))
config.llvm_tools_dir = os.path.join(this_dir, "build")
import lit.llvm