forked from OSchip/llvm-project
[lit] Keep original cfg file case around.
There's been some back and forth if the cfg paths in the config_map should be normcase()d. The argument for is that it allows using all-lower spelling in cmd on Windows, the argument against that doing so is lossy. Before the relative-paths-in-generated-lit.site.cfg.py work, there was no downside to calling normcase(), but with it we need a hack to recover the original case. This time, normcase() the hashtable key, but store the original cased key in addition to the value. This fixes both cons, at the cost of a few bytes more memory. Differential Revision: https://reviews.llvm.org/D78169
This commit is contained in:
parent
591be7ec50
commit
bc3f54de18
|
@ -1423,16 +1423,10 @@ endfunction()
|
|||
# path. Since this uses __file__, it has to be emitted into python files that
|
||||
# use it and can't be in a lit module. Use with make_paths_relative().
|
||||
string(CONCAT LLVM_LIT_PATH_FUNCTION
|
||||
# Lit converts config paths to lower case in discovery.py, before
|
||||
# loading the config. This causes __file__ to be all lower-case (including
|
||||
# the drive letter), but several clang tests pass -include %s and a
|
||||
# clang warning checks that passed case matches on-disk cache. So it's
|
||||
# important that this restores the on-disk case of the prefix.
|
||||
"# Allow generated file to be relocatable.\n"
|
||||
"def path(p):\n"
|
||||
" if not p: return ''\n"
|
||||
" p = os.path.join(os.path.dirname(os.path.abspath(__file__)), p)\n"
|
||||
" if os.name == 'nt' and os.path.isabs(p): return p[0].upper() + p[1:]\n"
|
||||
" return p\n"
|
||||
)
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ def getTestSuite(item, litConfig, cache):
|
|||
config_map = litConfig.params.get('config_map')
|
||||
if config_map:
|
||||
cfgpath = os.path.realpath(cfgpath)
|
||||
cfgpath = os.path.normcase(cfgpath)
|
||||
target = config_map.get(cfgpath)
|
||||
t, target = config_map.get(os.path.normcase(cfgpath), (None, None))
|
||||
assert t is None or t == cfgpath
|
||||
if target:
|
||||
cfgpath = target
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ class LLVMConfig(object):
|
|||
|
||||
def with_environment(self, variable, value, append_path=False):
|
||||
if append_path:
|
||||
# For paths, we should be able to take a list of them and process all
|
||||
# of them.
|
||||
# For paths, we should be able to take a list of them and process
|
||||
# all of them.
|
||||
paths_to_add = value
|
||||
if lit.util.is_string(paths_to_add):
|
||||
paths_to_add = [paths_to_add]
|
||||
|
@ -135,8 +135,8 @@ class LLVMConfig(object):
|
|||
# and adding each to the beginning would result in b c a. So we
|
||||
# need to iterate in reverse to end up with the original ordering.
|
||||
for p in reversed(paths_to_add):
|
||||
# Move it to the front if it already exists, otherwise insert it at the
|
||||
# beginning.
|
||||
# Move it to the front if it already exists, otherwise insert
|
||||
# it at the beginning.
|
||||
p = norm(p)
|
||||
try:
|
||||
paths.remove(p)
|
||||
|
|
|
@ -6,7 +6,7 @@ main_config = sys.argv[1]
|
|||
main_config = os.path.realpath(main_config)
|
||||
main_config = os.path.normcase(main_config)
|
||||
|
||||
config_map = {main_config : sys.argv[2]}
|
||||
config_map = {os.path.normcase(main_config) : (main_config, sys.argv[2])}
|
||||
builtin_parameters = {'config_map' : config_map}
|
||||
|
||||
if __name__=='__main__':
|
||||
|
|
|
@ -9,9 +9,8 @@ config_map = {}
|
|||
def map_config(source_dir, site_config):
|
||||
global config_map
|
||||
source_dir = os.path.realpath(source_dir)
|
||||
source_dir = os.path.normcase(source_dir)
|
||||
site_config = os.path.normpath(site_config)
|
||||
config_map[source_dir] = site_config
|
||||
config_map[os.path.normcase(source_dir)] = source_dir, site_config
|
||||
|
||||
# Set up some builtin parameters, so that by default the LLVM test suite
|
||||
# configuration file knows how to find the object tree.
|
||||
|
|
Loading…
Reference in New Issue