[test] Add master/buildermap to prepare rollout of test processors

Bug: v8:7343
Change-Id: I673a490e04f7bae56199591db69b7f1c84022fc0
Reviewed-on: https://chromium-review.googlesource.com/878541
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50764}
This commit is contained in:
Michael Achenbach 2018-01-22 15:40:51 +01:00 committed by Commit Bot
parent d3a4d15f5e
commit 174485e9c8
2 changed files with 29 additions and 4 deletions

View File

@ -258,10 +258,12 @@ class BaseTestRunner(object):
# TODO(machenbach): Temporary options for rolling out new test runner
# features.
parser.add_option("--mastername",
help="Mastername property from infrastructure")
parser.add_option("--buildername",
help="Buildername property from infrastructure")
parser.add_option("--mastername", default='',
help="Mastername property from infrastructure. Not "
"setting this option indicates manual usage.")
parser.add_option("--buildername", default='',
help="Buildername property from infrastructure. Not "
"setting this option indicates manual usage.")
def _add_parser_options(self, parser):
pass

View File

@ -10,6 +10,7 @@ from os.path import join
import multiprocessing
import os
import random
import re
import shlex
import subprocess
import sys
@ -81,6 +82,13 @@ SLOW_ARCHS = ["arm",
PREDICTABLE_WRAPPER = os.path.join(
base_runner.BASE_DIR, 'tools', 'predictable_wrapper.py')
# Specifies which builders should use the staging test-runner.
# Mapping from mastername to list of buildernames. Buildernames can be strings
# or compiled regexps which will be matched.
BUILDER_WHITELIST_STAGING = {
}
_RE_TYPE = type(re.compile(''))
class StandardTestRunner(base_runner.BaseTestRunner):
def __init__(self, *args, **kwargs):
@ -213,6 +221,18 @@ class StandardTestRunner(base_runner.BaseTestRunner):
dest="random_seed_stress_count",
help="Number of runs with different random seeds")
def _use_staging(self, options):
if options.infra_staging:
return True
builder_configs = BUILDER_WHITELIST_STAGING.get(options.mastername, [])
for builder_config in builder_configs:
if (isinstance(builder_config, _RE_TYPE) and
builder_config.match(options.buildername)):
return True
if builder_config == options.buildername:
return True
return False
def _process_options(self, options):
global VARIANTS
@ -287,6 +307,9 @@ class StandardTestRunner(base_runner.BaseTestRunner):
options.variants = "exhaustive"
options.infra_staging = True
# Use staging on whitelisted masters/builders.
options.infra_staging = self._use_staging(options)
# Resolve variant aliases and dedupe.
# TODO(machenbach): Don't mutate global variable. Rather pass mutated
# version as local variable.