Add an option --gn to run-tests.py that just runs the latest gn build

R=machenbach@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2295703002
Cr-Commit-Position: refs/heads/master@{#39011}
This commit is contained in:
jochen 2016-08-30 05:21:01 -07:00 committed by Commit bot
parent df80116116
commit c3e1b5f87c

View File

@ -34,7 +34,7 @@ import json
import multiprocessing
import optparse
import os
from os.path import join
from os.path import getmtime, isdir, join
import platform
import random
import shlex
@ -55,6 +55,8 @@ from testrunner.objects import context
# Base dir of the v8 checkout to be used as cwd.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEFAULT_OUT_GN = "out.gn"
ARCH_GUESS = utils.DefaultArch()
# Map of test name synonyms to lists of test suites. Should be ordered by
@ -294,6 +296,8 @@ def BuildOptions():
" \"%s\"" % ",".join(EXHAUSTIVE_VARIANTS))
result.add_option("--outdir", help="Base directory with compile output",
default="out")
result.add_option("--gn", help="Scan out.gn for the last built configuration",
default=False, action="store_true")
result.add_option("--predictable",
help="Compare output of several reruns of each test",
default=False, action="store_true")
@ -427,6 +431,20 @@ def ProcessOptions(options):
# 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
if options.gn:
gn_out_dir = os.path.join(BASE_DIR, DEFAULT_OUT_GN)
latest_timestamp = -1
latest_config = None
for gn_config in os.listdir(gn_out_dir):
gn_config_dir = os.path.join(gn_out_dir, gn_config)
if not isdir(gn_config_dir):
continue
if os.path.getmtime(gn_config_dir) > latest_timestamp:
latest_timestamp = os.path.getmtime(gn_config_dir)
latest_config = gn_config
if latest_config:
options.outdir = os.path.join(DEFAULT_OUT_GN, latest_config)
build_config_path = os.path.join(
BASE_DIR, options.outdir, "v8_build_config.json")
if os.path.exists(build_config_path):