[PATCH] lit: warn when passed invalid pathname

Hans Wennborg hans at chromium.org
Tue Jun 10 14:31:04 PDT 2014

Hi ddunbar,

It would previously say things like

  warning: input 'test/Frontend/foo.c' contained no tests

and have the user pull their hair trying to figure out what's wrong with that
file. This patch changes the message to the much clearer:

  warning: no such file or directory: 'test/Frontend/foo.c'



Index: utils/lit/lit/discovery.py
--- utils/lit/lit/discovery.py
+++ utils/lit/lit/discovery.py
@@ -200,17 +200,19 @@
     # Expand '@...' form in inputs.
     actual_inputs = []
     for input in inputs:
-        if os.path.exists(input) or not input.startswith('@'):
-            actual_inputs.append(input)
-        else:
+        if input.startswith('@'):
             f = open(input[1:])
                 for ln in f:
                     ln = ln.strip()
                     if ln:
+        elif os.path.exists(input):
+            actual_inputs.append(input)
+        else:
+            lit_config.warning('no such file or directory: %r' % input)
     # Load the tests from the inputs.
     tests = []
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4097.10303.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140610/466958d0/attachment.bin>

More information about the llvm-commits mailing list