[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 3 15:46:46 PDT 2020


rupprecht created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
rupprecht requested review of this revision.
Herald added a subscriber: JDevlieghere.

If the test suite is misconfigured when it's run (a bad regexp, wrong test directory, etc.), the test suite may not discover any tests. When this happens, the test runner exits happily because no tests failed:

  Ran 0 tests in 0.000s
  RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)

Change this to return an error so the misconfiguration can be more easily detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
             (configuration.suite.countTestCases(),
              configuration.suite.countTestCases() != 1 and "s" or ""))
 
+    if configuration.suite.countTestCases() == 0:
+        print("error: did not discover any tests.")
+        exitTestSuite(1)
+
     # Invoke the test runner.
     if configuration.count == 1:
         result = unittest2.TextTestRunner(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85169.282751.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200803/fe388c1e/attachment-0001.bin>


More information about the lldb-commits mailing list