[PATCH] D84000: [lit] Print non-existent paths when no tests are discovered.

Varun Gandhi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 20:25:38 PDT 2020


varungandhi-apple created this revision.
varungandhi-apple added a reviewer: yln.
Herald added subscribers: llvm-commits, delcypher.
Herald added a project: LLVM.

A likely failure mode is that the developer made a typo. Showing that the path
does not exist clarifies the issue; otherwise the developer might be confused as
to why the tests are not visible to lit.py even though they can see the test
directory locally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84000

Files:
  llvm/utils/lit/lit/main.py
  llvm/utils/lit/tests/selecting.py


Index: llvm/utils/lit/tests/selecting.py
===================================================================
--- llvm/utils/lit/tests/selecting.py
+++ llvm/utils/lit/tests/selecting.py
@@ -7,6 +7,7 @@
 # RUN: not %{lit} %{inputs}/nonexistent                    2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
 # RUN: not %{lit} %{inputs}/nonexistent --allow-empty-runs 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s
 # CHECK-BAD-PATH: error: did not discover any tests for provided path(s)
+# CHECK-BAD_PATH: error: path %{inputs}/nonexistent does not exist
 
 # Check that we exit with an error if we filter out all tests, but allow it with --allow-empty-runs.
 #
Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -42,6 +42,9 @@
     discovered_tests = lit.discovery.find_tests_for_inputs(lit_config, opts.test_paths)
     if not discovered_tests:
         sys.stderr.write('error: did not discover any tests for provided path(s)\n')
+        for p in opts.test_paths:
+            if not os.path.exists(p):
+                sys.stderr.write('error: path {} does not exist\n'.format(p))
         sys.exit(2)
 
     if opts.show_suites or opts.show_tests:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84000.278654.patch
Type: text/x-patch
Size: 1278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200717/b95b50f2/attachment.bin>


More information about the llvm-commits mailing list