From 9d7c40ea764bd5fef55f52b5030d9f592375c831 Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Sat, 20 Jan 2018 15:45:57 +0100 Subject: [PATCH] [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 Commit-Queue: Michael Achenbach Cr-Commit-Position: refs/heads/master@{#50747} --- tools/testrunner/standard_runner.py | 4 +++- tools/unittests/run_tests_test.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testrunner/standard_runner.py b/tools/testrunner/standard_runner.py index 28192b9083..dfef44338c 100755 --- a/tools/testrunner/standard_runner.py +++ b/tools/testrunner/standard_runner.py @@ -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 " diff --git a/tools/unittests/run_tests_test.py b/tools/unittests/run_tests_test.py index f4ff3fe1f7..d175a208ae 100755 --- a/tools/unittests/run_tests_test.py +++ b/tools/unittests/run_tests_test.py @@ -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."""