[Lldb-commits] [lldb] adb5c23 - [test] Exit with an error if no tests are run.
Jordan Rupprecht via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 3 16:32:40 PDT 2020
Author: Jordan Rupprecht
Date: 2020-08-03T16:32:12-07:00
New Revision: adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d
URL: https://github.com/llvm/llvm-project/commit/adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d
DIFF: https://github.com/llvm/llvm-project/commit/adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d.diff
LOG: [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
Added:
Modified:
lldb/packages/Python/lldbsuite/test/dotest.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 3fb802f1c1aa..6607f52c49db 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@ def run_suite():
(configuration.suite.countTestCases(),
configuration.suite.countTestCases() != 1 and "s" or ""))
+ if configuration.suite.countTestCases() == 0:
+ logging.error("did not discover any matching tests")
+ exitTestSuite(1)
+
# Invoke the test runner.
if configuration.count == 1:
result = unittest2.TextTestRunner(
More information about the lldb-commits
mailing list