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