[PATCH] D40520: Make check-lit tests respect LLVM_LIT_TOOLS_DIR

Greg Bedwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 14:09:39 PST 2017


gbedwell created this revision.

We ran into some strange test failures on a Windows machine that didn't have *nix style commands on the path, but was setting a path to the gnuwin32 tools via LLVM_LIT_TOOLS_DIR.  Both the check-compiler-rt and check-lit tests weren't taking notice of this option.

This patch takes care of the check-lit part.


https://reviews.llvm.org/D40520

Files:
  utils/lit/tests/lit.cfg
  utils/lit/tests/lit.site.cfg.in
  utils/lit/tests/shtest-format.py


Index: utils/lit/tests/shtest-format.py
===================================================================
--- utils/lit/tests/shtest-format.py
+++ utils/lit/tests/shtest-format.py
@@ -16,7 +16,7 @@
 # CHECK-NEXT: line 2: failed test output on stdout
 # CHECK: Command Output (stderr):
 # CHECK-NEXT: --
-# CHECK-NEXT: cat: does-not-exist: No such file or directory
+# CHECK-NEXT: cat{{(\.exe)?}}: does-not-exist: No such file or directory
 # CHECK: --
 
 # CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt
Index: utils/lit/tests/lit.site.cfg.in
===================================================================
--- utils/lit/tests/lit.site.cfg.in
+++ utils/lit/tests/lit.site.cfg.in
@@ -2,6 +2,7 @@
 
 import sys
 
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: utils/lit/tests/lit.cfg
===================================================================
--- utils/lit/tests/lit.cfg
+++ utils/lit/tests/lit.cfg
@@ -64,7 +64,10 @@
 if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
     config.available_features.add('windows')
 
-# Add llvm tools directory if this config is being loaded indirectly
-if getattr(config, 'llvm_tools_dir', None) is not None:
-    path = os.path.pathsep.join((config.llvm_tools_dir, config.environment['PATH']))
-    config.environment['PATH'] = path
+# Add llvm and lit tools directories if this config is being loaded indirectly.
+path = config.environment['PATH']
+for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
+    directory = getattr(config, attribute, None)
+    if directory:
+        path = os.path.pathsep.join((directory, path))
+config.environment['PATH'] = path


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40520.124464.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/b8a2c04c/attachment.bin>


More information about the llvm-commits mailing list