[test] Fail when no tests are run

TBR=sergiyb@chromium.org

Bug: v8:7337
Change-Id: I1732f6e587305ce4ab41a65f73e943c7eb9e1d15
Reviewed-on: https://chromium-review.googlesource.com/877760
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50747}
This commit is contained in:
Michael Achenbach 2018-01-20 15:45:57 +01:00 committed by Commit Bot
parent e5ecb24859
commit 9d7c40ea76
2 changed files with 5 additions and 3 deletions

View File

@ -503,6 +503,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
verbose.PrintTestDurations(suites, runner.outputs, overall_duration)
if num_tests == 0:
exit_code = 3
print("Warning: no tests were run!")
if exit_code == 1 and options.json_test_results:
@ -588,7 +589,8 @@ class StandardTestRunner(base_runner.BaseTestRunner):
exit_code = 1
if results.remaining:
exit_code = 2
if not results.total:
exit_code = 3
if exit_code == 1 and options.json_test_results:
print("Force exit code 0 after failures. Json test results file "

View File

@ -390,7 +390,7 @@ class SystemTest(unittest.TestCase):
else:
self.assertIn('Running 1 base tests', result.stdout, result)
self.assertIn('0 tests ran', result.stdout, result)
self.assertEqual(0, result.returncode, result)
self.assertEqual(3, result.returncode, result)
def testDefaultProc(self):
self.testDefault(infra_staging=True)
@ -410,7 +410,7 @@ class SystemTest(unittest.TestCase):
else:
self.assertIn('Running 0 base tests', result.stdout, result)
self.assertIn('0 tests ran', result.stdout, result)
self.assertEqual(0, result.returncode, result)
self.assertEqual(3, result.returncode, result)
def testNoBuildConfig(self):
"""Test failing run when build config is not found."""