Commit 9d7c40ea authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[test] Fail when no tests are run

TBR=sergiyb@chromium.org

Bug: v8:7337
Change-Id: I1732f6e587305ce4ab41a65f73e943c7eb9e1d15
Reviewed-on: https://chromium-review.googlesource.com/877760Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50747}
parent e5ecb248
...@@ -503,6 +503,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -503,6 +503,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
verbose.PrintTestDurations(suites, runner.outputs, overall_duration) verbose.PrintTestDurations(suites, runner.outputs, overall_duration)
if num_tests == 0: if num_tests == 0:
exit_code = 3
print("Warning: no tests were run!") print("Warning: no tests were run!")
if exit_code == 1 and options.json_test_results: if exit_code == 1 and options.json_test_results:
...@@ -588,7 +589,8 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -588,7 +589,8 @@ class StandardTestRunner(base_runner.BaseTestRunner):
exit_code = 1 exit_code = 1
if results.remaining: if results.remaining:
exit_code = 2 exit_code = 2
if not results.total:
exit_code = 3
if exit_code == 1 and options.json_test_results: if exit_code == 1 and options.json_test_results:
print("Force exit code 0 after failures. Json test results file " print("Force exit code 0 after failures. Json test results file "
......
...@@ -390,7 +390,7 @@ class SystemTest(unittest.TestCase): ...@@ -390,7 +390,7 @@ class SystemTest(unittest.TestCase):
else: else:
self.assertIn('Running 1 base tests', result.stdout, result) self.assertIn('Running 1 base tests', result.stdout, result)
self.assertIn('0 tests ran', 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): def testDefaultProc(self):
self.testDefault(infra_staging=True) self.testDefault(infra_staging=True)
...@@ -410,7 +410,7 @@ class SystemTest(unittest.TestCase): ...@@ -410,7 +410,7 @@ class SystemTest(unittest.TestCase):
else: else:
self.assertIn('Running 0 base tests', result.stdout, result) self.assertIn('Running 0 base tests', result.stdout, result)
self.assertIn('0 tests ran', 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): def testNoBuildConfig(self):
"""Test failing run when build config is not found.""" """Test failing run when build config is not found."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment