Commit 80cb266c authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

Deprecate buildbot option and discover build directory automatically.

Bug: v8:6917
Change-Id: I0dc20f84257b501d217e00cb29b34dd2a985ecf9
Reviewed-on: https://chromium-review.googlesource.com/737834
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49189}
parent ac0661b3
......@@ -149,6 +149,32 @@ class BuildConfig(object):
self.tsan = build_config['is_tsan']
self.ubsan_vptr = build_config['is_ubsan_vptr']
def __str__(self):
detected_options = []
if self.asan:
detected_options.append('asan')
if self.cfi_vptr:
detected_options.append('cfi_vptr')
if self.dcheck_always_on:
detected_options.append('dcheck_always_on')
if self.gcov_coverage:
detected_options.append('gcov_coverage')
if self.msan:
detected_options.append('msan')
if self.no_i18n:
detected_options.append('no_i18n')
if self.no_snap:
detected_options.append('no_snap')
if self.predictable:
detected_options.append('predictable')
if self.tsan:
detected_options.append('tsan')
if self.ubsan_vptr:
detected_options.append('ubsan_vptr')
return '\n'.join(detected_options)
class BaseTestRunner(object):
def __init__(self):
......@@ -190,8 +216,7 @@ class BaseTestRunner(object):
default=False, action="store_true")
parser.add_option("--outdir", help="Base directory with compile output",
default="out")
parser.add_option("--buildbot",
help="Adapt to path structure used on buildbots",
parser.add_option("--buildbot", help="DEPRECATED!",
default=False, action="store_true")
parser.add_option("--arch",
help="The architecture to run tests for")
......@@ -200,6 +225,8 @@ class BaseTestRunner(object):
" and buildbot builds): %s" % MODES.keys())
parser.add_option("--shell-dir", help="DEPRECATED! Executables from build "
"directory will be used")
parser.add_option("-v", "--verbose", help="Verbose output",
default=False, action="store_true")
def _add_parser_options(self, parser):
pass
......@@ -217,8 +244,7 @@ class BaseTestRunner(object):
def _load_build_config(self, options):
for outdir in self._possible_outdirs(options):
try:
self.build_config = self._do_load_build_config(
outdir, options.mode, options.buildbot)
self.build_config = self._do_load_build_config(outdir, options.verbose)
except TestRunnerError:
pass
......@@ -227,18 +253,32 @@ class BaseTestRunner(object):
raise TestRunnerError
print 'Build found: %s' % self.outdir
# Returns possible build paths in order: gn, outdir, outdir/arch.mode
if str(self.build_config):
print '>>> Autodetected:'
print self.build_config
# Returns possible build paths in order:
# gn
# outdir
# outdir/arch.mode
# Each path is provided in two versions: <path> and <path>/mode for buildbot.
def _possible_outdirs(self, options):
if options.gn:
yield self._get_gn_outdir()
return
def outdirs():
if options.gn:
yield self._get_gn_outdir()
return
yield options.outdir
if options.arch and options.mode:
yield os.path.join(options.outdir,
'%s.%s' % (options.arch, options.mode))
yield options.outdir
if options.arch and options.mode:
yield os.path.join(options.outdir,
'%s.%s' % (options.arch, options.mode))
return
for outdir in outdirs():
yield os.path.join(BASE_DIR, outdir)
# buildbot option
if options.mode:
yield os.path.join(BASE_DIR, outdir, options.mode)
def _get_gn_outdir(self):
gn_out_dir = os.path.join(BASE_DIR, DEFAULT_OUT_GN)
......@@ -255,14 +295,11 @@ class BaseTestRunner(object):
print(">>> Latest GN build found: %s" % latest_config)
return os.path.join(DEFAULT_OUT_GN, latest_config)
def _do_load_build_config(self, outdir, mode, is_buildbot):
if is_buildbot:
build_config_path = os.path.join(
BASE_DIR, outdir, mode, "v8_build_config.json")
else:
build_config_path = os.path.join(
BASE_DIR, outdir, "v8_build_config.json")
def _do_load_build_config(self, outdir, verbose=False):
build_config_path = os.path.join(outdir, "v8_build_config.json")
if not os.path.exists(build_config_path):
if verbose:
print("Didn't find build config: %s" % build_config_path)
raise TestRunnerError()
with open(build_config_path) as f:
......@@ -273,8 +310,7 @@ class BaseTestRunner(object):
% build_config_path)
raise TestRunnerError()
# In auto-detect mode the outdir is always where we found the build
# config.
# In auto-detect mode the outdir is always where we found the build config.
# This ensures that we'll also take the build products from there.
self.outdir = os.path.dirname(build_config_path)
......@@ -283,7 +319,7 @@ class BaseTestRunner(object):
def _process_default_options(self, options):
# We don't use the mode for more path-magic.
# Therefore transform the buildbot mode here to fix build_config value.
if options.buildbot and options.mode:
if options.mode:
options.mode = self._buildbot_to_v8_mode(options.mode)
build_config_mode = 'debug' if self.build_config.is_debug else 'release'
......
......@@ -146,8 +146,6 @@ class DeoptFuzzer(base_runner.BaseTestRunner):
type="int")
parser.add_option("-t", "--timeout", help="Timeout in seconds",
default= -1, type="int")
parser.add_option("-v", "--verbose", help="Verbose output",
default=False, action="store_true")
parser.add_option("--random-seed", default=0, dest="random_seed",
help="Default seed for initializing random generator")
return parser
......
......@@ -224,8 +224,6 @@ class StandardTestRunner(base_runner.BaseTestRunner):
default=False, action="store_true")
parser.add_option("-t", "--timeout", help="Timeout in seconds",
default=TIMEOUT_DEFAULT, type="int")
parser.add_option("-v", "--verbose", help="Verbose output",
default=False, action="store_true")
parser.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true")
parser.add_option("--warn-unused", help="Report unused rules",
......@@ -250,8 +248,6 @@ class StandardTestRunner(base_runner.BaseTestRunner):
print("sancov-dir %s doesn't exist" % self.sancov_dir)
raise base_runner.TestRunnerError()
if options.buildbot:
options.network = False
if options.command_prefix and options.network:
print("Specifying --command-prefix disables network distribution, "
"running tests locally.")
......
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