Skip to content

Commit b10cce1

Browse files
committed
deps: V8: cherry-pick d724820c1d5d
Original commit message: Merged: Squashed multiple commits. Merged: [test] Make finding build directory more flexible Revision: 4f015e85faf1d64466eafd897d1d59b1d77071f3 Merged: [test] Use the correct precedence for choosing the build directory Revision: 7b24b13981e411602fc77db1305d0ae034a92fd8 Merged: [test] Add fallback to legacy output directory Revision: bf3adea58aab3d21e36e23c60e1e0bbc994cd5b8 Merged: [gcmole] Fix gcmole after property change Revision: c87bdbcf0d1d8f8bcc927f6b364d27e72c22736d Merged: [test] Overhaul mode processing in test runner Revision: 608b732d141689e8e10ee918afc8ed1fae1ab80c Merged: [test] Switch to flattened json output Revision: 373a9a8cfc8db3ef65fcdca0ec0c4ded9e4acc89 BUG=chromium:1132088,v8:10893 NOTRY=true NOTREECHECKS=true [email protected] Change-Id: I3c1de04ca4fe62e36da29e706a20daec0b3d4d98 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2461745 Reviewed-by: Liviu Rau <[email protected]> Commit-Queue: Michael Achenbach <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{#20} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@d724820 PR-URL: #38275 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent aaeeb75 commit b10cce1

File tree

12 files changed

+153
-204
lines changed

12 files changed

+153
-204
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.33',
39+
'v8_embedder_string': '-node.34',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/tools/gcmole/gcmole.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ local function MakeClangCommandLine(
116116
.. " -DV8_INTL_SUPPORT"
117117
.. " -I./"
118118
.. " -Iinclude/"
119-
.. " -Iout/Release/gen"
119+
.. " -Iout/build/gen"
120120
.. " -Ithird_party/icu/source/common"
121121
.. " -Ithird_party/icu/source/i18n"
122122
.. " " .. arch_options

deps/v8/tools/gcmole/run-gcmole.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
assert len(sys.argv) == 2
2323

24-
if not os.path.isfile("out/Release/gen/torque-generated/builtin-definitions-tq.h"):
25-
print("Expected generated headers in out/Release/gen.")
26-
print("Either build v8 in out/Release or change gcmole.lua:115")
24+
if not os.path.isfile("out/build/gen/torque-generated/builtin-definitions-tq.h"):
25+
print("Expected generated headers in out/build/gen.")
26+
print("Either build v8 in out/build or change gcmole.lua:115")
2727
sys.exit(-1)
2828

2929
proc = subprocess.Popen(

deps/v8/tools/run_perf.py

+31-10
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,32 @@ def FlattenRunnables(node, node_cb):
575575
raise Exception('Invalid suite configuration.')
576576

577577

578+
def find_build_directory(base_path, arch):
579+
"""Returns the location of d8 or node in the build output directory.
580+
581+
This supports a seamless transition between legacy build location
582+
(out/Release) and new build location (out/build).
583+
"""
584+
def is_build(path):
585+
# We support d8 or node as executables. We don't support testing on
586+
# Windows.
587+
return (os.path.isfile(os.path.join(path, 'd8')) or
588+
os.path.isfile(os.path.join(path, 'node')))
589+
possible_paths = [
590+
# Location developer wrapper scripts is using.
591+
'%s.release' % arch,
592+
# Current build location on bots.
593+
'build',
594+
# Legacy build location on bots.
595+
'Release',
596+
]
597+
possible_paths = [os.path.join(base_path, p) for p in possible_paths]
598+
actual_paths = filter(is_build, possible_paths)
599+
assert actual_paths, 'No build directory found.'
600+
assert len(actual_paths) == 1, 'Found ambiguous build directories.'
601+
return actual_paths[0]
602+
603+
578604
class Platform(object):
579605
def __init__(self, args):
580606
self.shell_dir = args.shell_dir
@@ -881,8 +907,7 @@ def Main(argv):
881907
'to auto-detect.', default='x64',
882908
choices=SUPPORTED_ARCHS + ['auto'])
883909
parser.add_argument('--buildbot',
884-
help='Adapt to path structure used on buildbots and adds '
885-
'timestamps/level to all logged status messages',
910+
help='Deprecated',
886911
default=False, action='store_true')
887912
parser.add_argument('-d', '--device',
888913
help='The device ID to run Android tests on. If not '
@@ -978,13 +1003,9 @@ def Main(argv):
9781003

9791004
workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
9801005

981-
if args.buildbot:
982-
build_config = 'Release'
983-
else:
984-
build_config = '%s.release' % args.arch
985-
9861006
if args.binary_override_path == None:
987-
args.shell_dir = os.path.join(workspace, args.outdir, build_config)
1007+
args.shell_dir = find_build_directory(
1008+
os.path.join(workspace, args.outdir), args.arch)
9881009
default_binary_name = 'd8'
9891010
else:
9901011
if not os.path.isfile(args.binary_override_path):
@@ -998,8 +1019,8 @@ def Main(argv):
9981019
default_binary_name = os.path.basename(args.binary_override_path)
9991020

10001021
if args.outdir_secondary:
1001-
args.shell_dir_secondary = os.path.join(
1002-
workspace, args.outdir_secondary, build_config)
1022+
args.shell_dir_secondary = find_build_directory(
1023+
os.path.join(workspace, args.outdir_secondary), args.arch)
10031024
else:
10041025
args.shell_dir_secondary = None
10051026

deps/v8/tools/testrunner/base_runner.py

+57-113
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import print_function
77
from functools import reduce
88

9-
from collections import OrderedDict
9+
from collections import OrderedDict, namedtuple
1010
import json
1111
import multiprocessing
1212
import optparse
@@ -115,52 +115,35 @@
115115
]
116116

117117

118-
class ModeConfig(object):
119-
def __init__(self, flags, timeout_scalefactor, status_mode, execution_mode):
120-
self.flags = flags
121-
self.timeout_scalefactor = timeout_scalefactor
122-
self.status_mode = status_mode
123-
self.execution_mode = execution_mode
124-
118+
ModeConfig = namedtuple(
119+
'ModeConfig', 'label flags timeout_scalefactor status_mode')
125120

126121
DEBUG_FLAGS = ["--nohard-abort", "--enable-slow-asserts", "--verify-heap"]
127122
RELEASE_FLAGS = ["--nohard-abort"]
128-
MODES = {
129-
"debug": ModeConfig(
130-
flags=DEBUG_FLAGS,
131-
timeout_scalefactor=4,
132-
status_mode="debug",
133-
execution_mode="debug",
134-
),
135-
"optdebug": ModeConfig(
123+
124+
DEBUG_MODE = ModeConfig(
125+
label='debug',
136126
flags=DEBUG_FLAGS,
137127
timeout_scalefactor=4,
138128
status_mode="debug",
139-
execution_mode="debug",
140-
),
141-
"release": ModeConfig(
129+
)
130+
131+
RELEASE_MODE = ModeConfig(
132+
label='release',
142133
flags=RELEASE_FLAGS,
143134
timeout_scalefactor=1,
144135
status_mode="release",
145-
execution_mode="release",
146-
),
147-
# Normal trybot release configuration. There, dchecks are always on which
148-
# implies debug is set. Hence, the status file needs to assume debug-like
149-
# behavior/timeouts.
150-
"tryrelease": ModeConfig(
136+
)
137+
138+
# Normal trybot release configuration. There, dchecks are always on which
139+
# implies debug is set. Hence, the status file needs to assume debug-like
140+
# behavior/timeouts.
141+
TRY_RELEASE_MODE = ModeConfig(
142+
label='release+dchecks',
151143
flags=RELEASE_FLAGS,
152-
timeout_scalefactor=1,
153-
status_mode="debug",
154-
execution_mode="release",
155-
),
156-
# This mode requires v8 to be compiled with dchecks and slow dchecks.
157-
"slowrelease": ModeConfig(
158-
flags=RELEASE_FLAGS + ["--enable-slow-asserts"],
159-
timeout_scalefactor=2,
144+
timeout_scalefactor=4,
160145
status_mode="debug",
161-
execution_mode="release",
162-
),
163-
}
146+
)
164147

165148
PROGRESS_INDICATORS = {
166149
'verbose': progress.VerboseProgressIndicator,
@@ -240,12 +223,29 @@ def __str__(self):
240223
return '\n'.join(detected_options)
241224

242225

226+
def _do_load_build_config(outdir, verbose=False):
227+
build_config_path = os.path.join(outdir, "v8_build_config.json")
228+
if not os.path.exists(build_config_path):
229+
if verbose:
230+
print("Didn't find build config: %s" % build_config_path)
231+
raise TestRunnerError()
232+
233+
with open(build_config_path) as f:
234+
try:
235+
build_config_json = json.load(f)
236+
except Exception: # pragma: no cover
237+
print("%s exists but contains invalid json. Is your build up-to-date?"
238+
% build_config_path)
239+
raise TestRunnerError()
240+
241+
return BuildConfig(build_config_json)
242+
243+
243244
class BaseTestRunner(object):
244245
def __init__(self, basedir=None):
245246
self.basedir = basedir or BASE_DIR
246247
self.outdir = None
247248
self.build_config = None
248-
self.mode_name = None
249249
self.mode_options = None
250250
self.target_os = None
251251

@@ -279,7 +279,7 @@ def execute(self, sys_args=None):
279279
tests = self._load_testsuite_generators(args, options)
280280
self._setup_env()
281281
print(">>> Running tests for %s.%s" % (self.build_config.arch,
282-
self.mode_name))
282+
self.mode_options.label))
283283
exit_code = self._do_execute(tests, args, options)
284284
if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
285285
print("Force exit code 0 after failures. Json test results file "
@@ -313,9 +313,6 @@ def _add_parser_default_options(self, parser):
313313
default="out")
314314
parser.add_option("--arch",
315315
help="The architecture to run tests for")
316-
parser.add_option("-m", "--mode",
317-
help="The test mode in which to run (uppercase for builds"
318-
" in CI): %s" % MODES.keys())
319316
parser.add_option("--shell-dir", help="DEPRECATED! Executables from build "
320317
"directory will be used")
321318
parser.add_option("--test-root", help="Root directory of the test suites",
@@ -400,17 +397,21 @@ def _add_parser_options(self, parser):
400397
def _parse_args(self, parser, sys_args):
401398
options, args = parser.parse_args(sys_args)
402399

403-
if any(map(lambda v: v and ',' in v,
404-
[options.arch, options.mode])): # pragma: no cover
405-
print('Multiple arch/mode are deprecated')
400+
if options.arch and ',' in options.arch: # pragma: no cover
401+
print('Multiple architectures are deprecated')
406402
raise TestRunnerError()
407403

408404
return options, args
409405

410406
def _load_build_config(self, options):
411407
for outdir in self._possible_outdirs(options):
412408
try:
413-
self.build_config = self._do_load_build_config(outdir, options.verbose)
409+
self.build_config = _do_load_build_config(outdir, options.verbose)
410+
411+
# In auto-detect mode the outdir is always where we found the build config.
412+
# This ensures that we'll also take the build products from there.
413+
self.outdir = outdir
414+
break
414415
except TestRunnerError:
415416
pass
416417

@@ -433,26 +434,21 @@ def _load_build_config(self, options):
433434
# Returns possible build paths in order:
434435
# gn
435436
# outdir
436-
# outdir/arch.mode
437-
# Each path is provided in two versions: <path> and <path>/mode for bots.
437+
# outdir on bots
438438
def _possible_outdirs(self, options):
439439
def outdirs():
440440
if options.gn:
441441
yield self._get_gn_outdir()
442442
return
443443

444444
yield options.outdir
445-
if options.arch and options.mode:
446-
yield os.path.join(options.outdir,
447-
'%s.%s' % (options.arch, options.mode))
445+
446+
if os.path.basename(options.outdir) != 'build':
447+
yield os.path.join(options.outdir, 'build')
448448

449449
for outdir in outdirs():
450450
yield os.path.join(self.basedir, outdir)
451451

452-
# bot option
453-
if options.mode:
454-
yield os.path.join(self.basedir, outdir, options.mode)
455-
456452
def _get_gn_outdir(self):
457453
gn_out_dir = os.path.join(self.basedir, DEFAULT_OUT_GN)
458454
latest_timestamp = -1
@@ -468,51 +464,13 @@ def _get_gn_outdir(self):
468464
print(">>> Latest GN build found: %s" % latest_config)
469465
return os.path.join(DEFAULT_OUT_GN, latest_config)
470466

471-
def _do_load_build_config(self, outdir, verbose=False):
472-
build_config_path = os.path.join(outdir, "v8_build_config.json")
473-
if not os.path.exists(build_config_path):
474-
if verbose:
475-
print("Didn't find build config: %s" % build_config_path)
476-
raise TestRunnerError()
477-
478-
with open(build_config_path) as f:
479-
try:
480-
build_config_json = json.load(f)
481-
except Exception: # pragma: no cover
482-
print("%s exists but contains invalid json. Is your build up-to-date?"
483-
% build_config_path)
484-
raise TestRunnerError()
485-
486-
# In auto-detect mode the outdir is always where we found the build config.
487-
# This ensures that we'll also take the build products from there.
488-
self.outdir = os.path.dirname(build_config_path)
489-
490-
return BuildConfig(build_config_json)
491-
492467
def _process_default_options(self, options):
493-
# We don't use the mode for more path-magic.
494-
# Therefore transform the bot mode here to fix build_config value.
495-
if options.mode:
496-
options.mode = self._bot_to_v8_mode(options.mode)
497-
498-
build_config_mode = 'debug' if self.build_config.is_debug else 'release'
499-
if options.mode:
500-
if options.mode not in MODES: # pragma: no cover
501-
print('%s mode is invalid' % options.mode)
502-
raise TestRunnerError()
503-
if MODES[options.mode].execution_mode != build_config_mode:
504-
print ('execution mode (%s) for %s is inconsistent with build config '
505-
'(%s)' % (
506-
MODES[options.mode].execution_mode,
507-
options.mode,
508-
build_config_mode))
509-
raise TestRunnerError()
510-
511-
self.mode_name = options.mode
468+
if self.build_config.is_debug:
469+
self.mode_options = DEBUG_MODE
470+
elif self.build_config.dcheck_always_on:
471+
self.mode_options = TRY_RELEASE_MODE
512472
else:
513-
self.mode_name = build_config_mode
514-
515-
self.mode_options = MODES[self.mode_name]
473+
self.mode_options = RELEASE_MODE
516474

517475
if options.arch and options.arch != self.build_config.arch:
518476
print('--arch value (%s) inconsistent with build config (%s).' % (
@@ -533,15 +491,6 @@ def _process_default_options(self, options):
533491
options.command_prefix = shlex.split(options.command_prefix)
534492
options.extra_flags = sum(map(shlex.split, options.extra_flags), [])
535493

536-
def _bot_to_v8_mode(self, config):
537-
"""Convert build configs from bots to configs understood by the v8 runner.
538-
539-
V8 configs are always lower case and without the additional _x64 suffix
540-
for 64 bit builds on windows with ninja.
541-
"""
542-
mode = config[:-4] if config.endswith('_x64') else config
543-
return mode.lower()
544-
545494
def _process_options(self, options):
546495
pass
547496

@@ -689,9 +638,7 @@ def _get_statusfile_variables(self, options):
689638
"is_clang": self.build_config.is_clang,
690639
"is_full_debug": self.build_config.is_full_debug,
691640
"mips_arch_variant": mips_arch_variant,
692-
"mode": self.mode_options.status_mode
693-
if not self.build_config.dcheck_always_on
694-
else "debug",
641+
"mode": self.mode_options.status_mode,
695642
"msan": self.build_config.msan,
696643
"no_harness": options.no_harness,
697644
"no_i18n": self.build_config.no_i18n,
@@ -804,10 +751,7 @@ def _create_progress_indicators(self, test_count, options):
804751
procs.append(progress.JUnitTestProgressIndicator(options.junitout,
805752
options.junittestsuite))
806753
if options.json_test_results:
807-
procs.append(progress.JsonTestProgressIndicator(
808-
self.framework_name,
809-
self.build_config.arch,
810-
self.mode_options.execution_mode))
754+
procs.append(progress.JsonTestProgressIndicator(self.framework_name))
811755

812756
for proc in procs:
813757
proc.configure(options)

deps/v8/tools/testrunner/standard_runner.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,8 @@ def _duration_results_text(test):
379379
]
380380

381381
assert os.path.exists(options.json_test_results)
382-
complete_results = []
383382
with open(options.json_test_results, "r") as f:
384-
complete_results = json.loads(f.read())
385-
output = complete_results[0]
383+
output = json.load(f)
386384
lines = []
387385
for test in output['slowest_tests']:
388386
suffix = ''

0 commit comments

Comments
 (0)