]> granicus.if.org Git - llvm/commitdiff
[lit] Actually do normalize the case of files in the config map.
authorZachary Turner <zturner@google.com>
Thu, 21 Sep 2017 21:27:11 +0000 (21:27 +0000)
committerZachary Turner <zturner@google.com>
Thu, 21 Sep 2017 21:27:11 +0000 (21:27 +0000)
This has gone back and forth, but it seems this is necessary
after all.  realpath is not sufficient because if you have a
file named 'C:\foo.txt', then both realpath('c:\foo.txt') and
realpath(C:\foo.txt') return the string that was passed to them
exactly as is, meaning the case of the drive-letter won't match.

The problem before was not that we were normalizing the case of
items going into the config map, but rather that we were
normalizing the case of something we needed to print.  The value
that is used to key on the config map should never be printed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313918 91177308-0d34-0410-b5e6-96231b3b80d8

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

index aba7453e9d4dbeab559ef7bf099fb83f5d4daeb1..398b6cecd5a56a46633ba88208754df60d689154 100644 (file)
@@ -54,6 +54,7 @@ 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)
             if target:
                 cfgpath = target
index b5344e8fb8359f17a58aa7472305682077b403c8..db9141b9b1bf9ed0333a8a49ad0148259764becf 100644 (file)
@@ -3,8 +3,10 @@ import os
 import sys
 
 main_config = sys.argv[1]
+main_config = os.path.realpath(main_config)
+main_config = os.path.normcase(main_config)
 
-config_map = {os.path.realpath(main_config) : sys.argv[2]}
+config_map = {main_config : sys.argv[2]}
 builtin_parameters = {'config_map' : config_map}
 
 if __name__=='__main__':
index c6b705c6293bf2503a4e6fc5597263047c0a8903..dbabeb39f19f379ac963b7429630be5004a7ffed 100644 (file)
@@ -45,7 +45,7 @@
 
 # CHECK-CONFIG-MAP-ERR: loading suite config '{{.*}}lit.alt.cfg'
 # CHECK-CONFIG-MAP-ERR: loaded config '{{.*}}lit.alt.cfg'
-# CHECK-CONFIG-MAP-ERR: resolved input '{{.*config-map-discovery[/\\]main-config}}' to 'config-map'::()
+# CHECK-CONFIG-MAP-ERR: resolved input '{{.*(/|\\\\)config-map-discovery(/|\\\\)main-config}}' to 'config-map'::()
 
 
 # Check discovery when exact test names are given.
index fd306cced366f8ef50f04c7c2a669eb52081d23d..de67b18e52c1d0d98440fabc17a9a8c9670c2fde 100755 (executable)
@@ -8,6 +8,7 @@ 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