Skip to content

Commit adb5c23

Browse files
committed
[test] Exit with an error if no tests are run.
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. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D85169
1 parent 3b44b6c commit adb5c23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,10 @@ def run_suite():
10391039
(configuration.suite.countTestCases(),
10401040
configuration.suite.countTestCases() != 1 and "s" or ""))
10411041

1042+
if configuration.suite.countTestCases() == 0:
1043+
logging.error("did not discover any matching tests")
1044+
exitTestSuite(1)
1045+
10421046
# Invoke the test runner.
10431047
if configuration.count == 1:
10441048
result = unittest2.TextTestRunner(

0 commit comments

Comments
 (0)