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(


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(
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to