Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tools/run-tests.py

Issue 2106423002: [gn] Automatically derive build configs in test runner. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Presubmit + more robust json loading Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | tools/testrunner/utils/dump_build_config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run-tests.py
diff --git a/tools/run-tests.py b/tools/run-tests.py
index b1c71dd0a76d7e12222dbf85a2465ab4e5dd1075..09f301854a46a1006d949d26c103e5f8b2572720 100755
--- a/tools/run-tests.py
+++ b/tools/run-tests.py
@@ -30,6 +30,7 @@
from collections import OrderedDict
import itertools
+import json
import multiprocessing
import optparse
import os
@@ -434,6 +435,34 @@ def ProcessOptions(options):
global EXHAUSTIVE_VARIANTS
global VARIANTS
+ # First try to auto-detect configurations based on the build if GN was
+ # used. This can't be overridden by cmd-line arguments.
+ options.auto_detect = False
+ build_config_path = os.path.join(
+ BASE_DIR, options.outdir, "v8_build_config.json")
+ if os.path.exists(build_config_path):
+ try:
+ with open(build_config_path) as f:
+ build_config = json.load(f)
+ except Exception:
+ print ("%s exists but contains invalid json. Is your build up-to-date?" %
+ build_config_path)
+ return False
+ options.auto_detect = True
+
+ options.arch_and_mode = None
+ options.arch = build_config["v8_target_cpu"]
+ if options.arch == 'x86':
+ # TODO(machenbach): Transform all to x86 eventually.
+ options.arch = 'ia32'
+ options.asan = build_config["is_asan"]
+ options.dcheck_always_on = build_config["dcheck_always_on"]
+ options.mode = 'debug' if build_config["is_debug"] else 'release'
+ options.msan = build_config["is_msan"]
+ options.no_i18n = not build_config["v8_enable_i18n_support"]
+ options.no_snap = not build_config["v8_use_snapshot"]
+ options.tsan = build_config["is_tsan"]
+
# Architecture and mode related stuff.
if options.arch_and_mode:
options.arch_and_mode = [arch_and_mode.split(".")
@@ -667,6 +696,10 @@ def Execute(arch, mode, args, options, suites):
# buildbot. Currently this is capitalized Release and Debug.
shell_dir = os.path.join(BASE_DIR, options.outdir, mode)
mode = BuildbotToV8Mode(mode)
+ elif options.auto_detect:
+ # If an output dir with a build was passed, test directly in that
+ # directory.
+ shell_dir = os.path.join(BASE_DIR, options.outdir)
else:
shell_dir = os.path.join(
BASE_DIR,
@@ -712,6 +745,8 @@ def Execute(arch, mode, args, options, suites):
sancov_dir=options.sancov_dir)
# TODO(all): Combine "simulator" and "simulator_run".
+ # TODO(machenbach): In GN we can derive simulator run from
+ # target_arch != v8_target_arch in the dumped build config.
simulator_run = not options.dont_skip_simulator_slow_tests and \
arch in ['arm64', 'arm', 'mipsel', 'mips', 'mips64', 'mips64el', \
'ppc', 'ppc64'] and \
« no previous file with comments | « BUILD.gn ('k') | tools/testrunner/utils/dump_build_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698