[test] Prepare roll-out of new test runner to local runs

This adds a tri-state flag --infra-staging and --no-infra-staging, which
can be used to explicitly opt in or out of the staging test runner.

If not specified, a new architecture whitelist will enable roll-out per
arch for manual (none CI) runs.

We'll start whitelisting archs in follow ups.

Bug: v8:7343
Change-Id: I1228e48969fd379f5c231a2b8fad4afc01da94c0
Reviewed-on: https://chromium-review.googlesource.com/881169
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50812}
This commit is contained in:
Michael Achenbach 2018-01-23 17:03:53 +01:00 committed by Commit Bot
parent 3fa26f4d1b
commit ed93f01462

View File

@ -103,6 +103,11 @@ BUILDER_WHITELIST_STAGING = {
}
_RE_TYPE = type(re.compile(''))
# Specifies which architectures are whitelisted to use the staging test-runner.
# List of arch strings, e.g. "x64".
ARCH_WHITELIST_STAGING = [
]
class StandardTestRunner(base_runner.BaseTestRunner):
def __init__(self, *args, **kwargs):
@ -152,7 +157,12 @@ class StandardTestRunner(base_runner.BaseTestRunner):
help="Additional flags to pass to each test command",
action="append", default=[])
parser.add_option("--infra-staging", help="Use new test runner features",
default=False, action="store_true")
dest='infra_staging', default=None,
action="store_true")
parser.add_option("--no-infra-staging",
help="Opt out of new test runner features",
dest='infra_staging', default=None,
action="store_false")
parser.add_option("--isolates", help="Whether to test isolates",
default=False, action="store_true")
parser.add_option("-j", help="The number of parallel tasks to run",
@ -225,8 +235,9 @@ class StandardTestRunner(base_runner.BaseTestRunner):
help="Number of runs with different random seeds")
def _use_staging(self, options):
if options.infra_staging:
return True
if options.infra_staging is not None:
# True or False are used to explicitly opt in or out.
return options.infra_staging
builder_configs = BUILDER_WHITELIST_STAGING.get(options.mastername, [])
for builder_config in builder_configs:
if (isinstance(builder_config, _RE_TYPE) and
@ -234,6 +245,9 @@ class StandardTestRunner(base_runner.BaseTestRunner):
return True
if builder_config == options.buildername:
return True
for arch in ARCH_WHITELIST_STAGING:
if self.build_config.arch == arch:
return True
return False
def _process_options(self, options):