[llvm] r313918 - [lit] Actually do normalize the case of files in the config map.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 14:27:11 PDT 2017


Author: zturner
Date: Thu Sep 21 14:27:11 2017
New Revision: 313918

URL: http://llvm.org/viewvc/llvm-project?rev=313918&view=rev
Log:
[lit] Actually do normalize the case of files in the config map.

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.

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

Modified: llvm/trunk/utils/lit/lit/discovery.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/discovery.py?rev=313918&r1=313917&r2=313918&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/discovery.py (original)
+++ llvm/trunk/utils/lit/lit/discovery.py Thu Sep 21 14:27:11 2017
@@ -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

Modified: llvm/trunk/utils/lit/tests/Inputs/config-map-discovery/driver.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/config-map-discovery/driver.py?rev=313918&r1=313917&r2=313918&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/config-map-discovery/driver.py (original)
+++ llvm/trunk/utils/lit/tests/Inputs/config-map-discovery/driver.py Thu Sep 21 14:27:11 2017
@@ -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__':

Modified: llvm/trunk/utils/lit/tests/discovery.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/discovery.py?rev=313918&r1=313917&r2=313918&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/discovery.py (original)
+++ llvm/trunk/utils/lit/tests/discovery.py Thu Sep 21 14:27:11 2017
@@ -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.

Modified: llvm/trunk/utils/llvm-lit/llvm-lit.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm-lit/llvm-lit.in?rev=313918&r1=313917&r2=313918&view=diff
==============================================================================
--- llvm/trunk/utils/llvm-lit/llvm-lit.in (original)
+++ llvm/trunk/utils/llvm-lit/llvm-lit.in Thu Sep 21 14:27:11 2017
@@ -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
 




More information about the llvm-commits mailing list