[test] Add feature to keep running skipped tests.

This commit adds a --run-skipped flag to the test runner that will
bypass the 'SKIP' status.

Bug: v8:8485
Change-Id: Iac012bdaf2de6b0f8e44ed3a65bc9330709527bb
Reviewed-on: https://chromium-review.googlesource.com/c/1346490
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57710}
This commit is contained in:
Michael Achenbach 2018-11-22 08:33:45 +01:00 committed by Commit Bot
parent 0e2b1aaae0
commit ab18455532
4 changed files with 23 additions and 1 deletions

View File

@ -345,6 +345,8 @@ class BaseTestRunner(object):
help="Run without test harness of a given suite")
parser.add_option("--random-seed", default=0, type=int,
help="Default seed for initializing random generator")
parser.add_option("--run-skipped", help="Also run skipped tests.",
default=False, action="store_true")
parser.add_option("-t", "--timeout", default=60, type=int,
help="Timeout for single test in seconds")
parser.add_option("-v", "--verbose", default=False, action="store_true",
@ -677,6 +679,7 @@ class BaseTestRunner(object):
no_harness=options.no_harness,
noi18n=self.build_config.no_i18n,
random_seed=options.random_seed,
run_skipped=options.run_skipped,
shell_dir=self.outdir,
timeout=timeout,
verbose=options.verbose,

View File

@ -135,7 +135,8 @@ class TestCase(object):
@property
def do_skip(self):
return statusfile.SKIP in self._statusfile_outcomes
return (statusfile.SKIP in self._statusfile_outcomes and
not self.suite.test_config.run_skipped)
@property
def is_slow(self):

View File

@ -16,6 +16,7 @@ class TestConfig(object):
no_harness,
noi18n,
random_seed,
run_skipped,
shell_dir,
timeout,
verbose):
@ -27,6 +28,7 @@ class TestConfig(object):
self.noi18n = noi18n
# random_seed is always not None.
self.random_seed = random_seed or random_utils.random_seed()
self.run_skipped = run_skipped
self.shell_dir = shell_dir
self.timeout = timeout
self.verbose = verbose

View File

@ -404,6 +404,22 @@ class SystemTest(unittest.TestCase):
self.assertIn('0 tests ran', result.stdout, result)
self.assertEqual(2, result.returncode, result)
def testRunSkips(self):
"""Inverse the above. Test parameter to keep running skipped tests."""
with temp_base() as basedir:
result = run_tests(
basedir,
'--mode=Release',
'--progress=verbose',
'--variants=nooptimization',
'--run-skipped',
'sweet/strawberries',
)
self.assertIn('Running 1 base tests', result.stdout, result)
self.assertIn('1 tests failed', result.stdout, result)
self.assertIn('1 tests ran', result.stdout, result)
self.assertEqual(1, result.returncode, result)
def testDefaultProc(self):
self.testDefault(infra_staging=True)