Skip to content

Commit b10cce1

Browse files
committedApr 30, 2021
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 R=liviurau@chromium.org Change-Id: I3c1de04ca4fe62e36da29e706a20daec0b3d4d98 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2461745 Reviewed-by: Liviu Rau <liviurau@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> 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 <matteo.collina@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
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 = ''

‎deps/v8/tools/testrunner/testproc/progress.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def finished(self):
358358

359359

360360
class JsonTestProgressIndicator(ProgressIndicator):
361-
def __init__(self, framework_name, arch, mode):
361+
def __init__(self, framework_name):
362362
super(JsonTestProgressIndicator, self).__init__()
363363
# We want to drop stdout/err for all passed tests on the first try, but we
364364
# need to get outputs for all runs after the first one. To accommodate that,
@@ -367,8 +367,6 @@ def __init__(self, framework_name, arch, mode):
367367
self._requirement = base.DROP_PASS_STDOUT
368368

369369
self.framework_name = framework_name
370-
self.arch = arch
371-
self.mode = mode
372370
self.results = []
373371
self.duration_sum = 0
374372
self.test_count = 0
@@ -438,24 +436,16 @@ def _test_record(self, test, result, output, run):
438436
}
439437

440438
def finished(self):
441-
complete_results = []
442-
if os.path.exists(self.options.json_test_results):
443-
with open(self.options.json_test_results, "r") as f:
444-
# On bots we might start out with an empty file.
445-
complete_results = json.loads(f.read() or "[]")
446-
447439
duration_mean = None
448440
if self.test_count:
449441
duration_mean = self.duration_sum / self.test_count
450442

451-
complete_results.append({
452-
"arch": self.arch,
453-
"mode": self.mode,
443+
result = {
454444
"results": self.results,
455445
"slowest_tests": self.tests.as_list(),
456446
"duration_mean": duration_mean,
457447
"test_total": self.test_count,
458-
})
448+
}
459449

460450
with open(self.options.json_test_results, "w") as f:
461-
f.write(json.dumps(complete_results))
451+
json.dump(result, f)

‎deps/v8/tools/unittests/run_perf_test.py

+36-6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,21 @@
9090
'units': 'ms',
9191
}
9292

93+
94+
class UnitTest(unittest.TestCase):
95+
@classmethod
96+
def setUpClass(cls):
97+
sys.path.insert(0, BASE_DIR)
98+
import run_perf
99+
global run_perf
100+
101+
def testBuildDirectory(self):
102+
base_path = os.path.join(TEST_DATA, 'builddirs', 'dir1', 'out')
103+
expected_path = os.path.join(base_path, 'build')
104+
self.assertEquals(
105+
expected_path, run_perf.find_build_directory(base_path, 'x64'))
106+
107+
93108
class PerfTest(unittest.TestCase):
94109
@classmethod
95110
def setUpClass(cls):
@@ -125,6 +140,7 @@ def _WriteTestInput(self, json_content):
125140
f.write(json.dumps(json_content))
126141

127142
def _MockCommand(self, *args, **kwargs):
143+
on_bots = kwargs.pop('on_bots', False)
128144
# Fake output for each test run.
129145
test_outputs = [Output(stdout=arg,
130146
timed_out=kwargs.get('timed_out', False),
@@ -142,6 +158,16 @@ def execute(*args, **kwargs):
142158
run_perf.command, 'PosixCommand',
143159
mock.MagicMock(side_effect=create_cmd)).start()
144160

161+
build_dir = 'Release' if on_bots else 'x64.release'
162+
out_dirs = ['out', 'out-secondary']
163+
return_values = [
164+
os.path.join(os.path.dirname(BASE_DIR), out, build_dir)
165+
for out in out_dirs
166+
]
167+
mock.patch.object(
168+
run_perf, 'find_build_directory',
169+
mock.MagicMock(side_effect=return_values)).start()
170+
145171
# Check that d8 is called from the correct cwd for each test run.
146172
dirs = [os.path.join(TEST_WORKSPACE, arg) for arg in args[0]]
147173
def chdir(*args, **kwargs):
@@ -394,11 +420,12 @@ def testTwoRunsStdDevRegExp(self):
394420

395421
def testBuildbot(self):
396422
self._WriteTestInput(V8_JSON)
397-
self._MockCommand(['.'], ['Richards: 1.234\nDeltaBlue: 10657567\n'])
423+
self._MockCommand(['.'], ['Richards: 1.234\nDeltaBlue: 10657567\n'],
424+
on_bots=True)
398425
mock.patch.object(
399426
run_perf.Platform, 'ReadBuildConfig',
400427
mock.MagicMock(return_value={'is_android': False})).start()
401-
self.assertEqual(0, self._CallMain('--buildbot'))
428+
self.assertEqual(0, self._CallMain())
402429
self._VerifyResults('test', 'score', [
403430
{'name': 'Richards', 'results': [1.234], 'stddev': ''},
404431
{'name': 'DeltaBlue', 'results': [10657567.0], 'stddev': ''},
@@ -410,11 +437,12 @@ def testBuildbotWithTotal(self):
410437
test_input = dict(V8_JSON)
411438
test_input['total'] = True
412439
self._WriteTestInput(test_input)
413-
self._MockCommand(['.'], ['Richards: 1.234\nDeltaBlue: 10657567\n'])
440+
self._MockCommand(['.'], ['Richards: 1.234\nDeltaBlue: 10657567\n'],
441+
on_bots=True)
414442
mock.patch.object(
415443
run_perf.Platform, 'ReadBuildConfig',
416444
mock.MagicMock(return_value={'is_android': False})).start()
417-
self.assertEqual(0, self._CallMain('--buildbot'))
445+
self.assertEqual(0, self._CallMain())
418446
self._VerifyResults('test', 'score', [
419447
{'name': 'Richards', 'results': [1.234], 'stddev': ''},
420448
{'name': 'DeltaBlue', 'results': [10657567.0], 'stddev': ''},
@@ -427,11 +455,12 @@ def testBuildbotWithTotalAndErrors(self):
427455
test_input = dict(V8_JSON)
428456
test_input['total'] = True
429457
self._WriteTestInput(test_input)
430-
self._MockCommand(['.'], ['x\nRichards: bla\nDeltaBlue: 10657567\ny\n'])
458+
self._MockCommand(['.'], ['x\nRichards: bla\nDeltaBlue: 10657567\ny\n'],
459+
on_bots=True)
431460
mock.patch.object(
432461
run_perf.Platform, 'ReadBuildConfig',
433462
mock.MagicMock(return_value={'is_android': False})).start()
434-
self.assertEqual(1, self._CallMain('--buildbot'))
463+
self.assertEqual(1, self._CallMain())
435464
self._VerifyResults('test', 'score', [
436465
{'name': 'DeltaBlue', 'results': [10657567.0], 'stddev': ''},
437466
])
@@ -484,6 +513,7 @@ def testAndroid(self):
484513
mock.patch('run_perf.AndroidPlatform.PreExecution').start()
485514
mock.patch('run_perf.AndroidPlatform.PostExecution').start()
486515
mock.patch('run_perf.AndroidPlatform.PreTests').start()
516+
mock.patch('run_perf.find_build_directory').start()
487517
mock.patch(
488518
'run_perf.AndroidPlatform.Run',
489519
return_value=(Output(stdout='Richards: 1.234\nDeltaBlue: 10657567\n'),

‎deps/v8/tools/unittests/run_tests_test.py

+8-39
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def temp_base(baseroot='testroot1'):
6767
"""
6868
basedir = os.path.join(TEST_DATA_ROOT, baseroot)
6969
with temp_dir() as tempbase:
70-
builddir = os.path.join(tempbase, 'out', 'Release')
70+
builddir = os.path.join(tempbase, 'out', 'build')
7171
testroot = os.path.join(tempbase, 'test')
7272
os.makedirs(builddir)
7373
shutil.copy(os.path.join(basedir, 'v8_build_config.json'), builddir)
@@ -112,7 +112,7 @@ def run_tests(basedir, *args, **kwargs):
112112

113113
def override_build_config(basedir, **kwargs):
114114
"""Override the build config with new values provided as kwargs."""
115-
path = os.path.join(basedir, 'out', 'Release', 'v8_build_config.json')
115+
path = os.path.join(basedir, 'out', 'build', 'v8_build_config.json')
116116
with open(path) as f:
117117
config = json.load(f)
118118
config.update(kwargs)
@@ -171,7 +171,6 @@ def testPass(self):
171171
with temp_base() as basedir:
172172
result = run_tests(
173173
basedir,
174-
'--mode=Release',
175174
'--progress=verbose',
176175
'--variants=default,stress',
177176
'--time',
@@ -189,7 +188,6 @@ def testShardedProc(self):
189188
for shard in [1, 2]:
190189
result = run_tests(
191190
basedir,
192-
'--mode=Release',
193191
'--progress=verbose',
194192
'--variants=default,stress',
195193
'--shard-count=2',
@@ -220,7 +218,6 @@ def testSharded(self):
220218
for shard in [1, 2]:
221219
result = run_tests(
222220
basedir,
223-
'--mode=Release',
224221
'--progress=verbose',
225222
'--variants=default,stress',
226223
'--shard-count=2',
@@ -239,7 +236,6 @@ def testFail(self):
239236
with temp_base() as basedir:
240237
result = run_tests(
241238
basedir,
242-
'--mode=Release',
243239
'--progress=verbose',
244240
'--variants=default,stress',
245241
'sweet/strawberries',
@@ -252,7 +248,7 @@ def check_cleaned_json_output(
252248
self, expected_results_name, actual_json, basedir):
253249
# Check relevant properties of the json output.
254250
with open(actual_json) as f:
255-
json_output = json.load(f)[0]
251+
json_output = json.load(f)
256252

257253
# Replace duration in actual output as it's non-deterministic. Also
258254
# replace the python executable prefix as it has a different absolute
@@ -285,7 +281,6 @@ def testFailWithRerunAndJSON(self):
285281
json_path = os.path.join(basedir, 'out.json')
286282
result = run_tests(
287283
basedir,
288-
'--mode=Release',
289284
'--progress=verbose',
290285
'--variants=default',
291286
'--rerun-failures-count=2',
@@ -314,7 +309,6 @@ def testFlakeWithRerunAndJSON(self):
314309
json_path = os.path.join(basedir, 'out.json')
315310
result = run_tests(
316311
basedir,
317-
'--mode=Release',
318312
'--progress=verbose',
319313
'--variants=default',
320314
'--rerun-failures-count=2',
@@ -346,7 +340,6 @@ def testAutoDetect(self):
346340
v8_enable_pointer_compression=False)
347341
result = run_tests(
348342
basedir,
349-
'--mode=Release',
350343
'--progress=verbose',
351344
'--variants=default',
352345
'sweet/bananas',
@@ -371,7 +364,6 @@ def testSkips(self):
371364
with temp_base() as basedir:
372365
result = run_tests(
373366
basedir,
374-
'--mode=Release',
375367
'--progress=verbose',
376368
'--variants=nooptimization',
377369
'sweet/strawberries',
@@ -385,7 +377,6 @@ def testRunSkips(self):
385377
with temp_base() as basedir:
386378
result = run_tests(
387379
basedir,
388-
'--mode=Release',
389380
'--progress=verbose',
390381
'--variants=nooptimization',
391382
'--run-skipped',
@@ -402,32 +393,22 @@ def testDefault(self):
402393
with temp_base() as basedir:
403394
result = run_tests(
404395
basedir,
405-
'--mode=Release',
406396
infra_staging=False,
407397
)
408398
self.assertIn('0 tests ran', result.stdout, result)
409399
self.assertEqual(2, result.returncode, result)
410400

411401
def testNoBuildConfig(self):
412402
"""Test failing run when build config is not found."""
413-
with temp_base() as basedir:
403+
with temp_dir() as basedir:
414404
result = run_tests(basedir)
415405
self.assertIn('Failed to load build config', result.stdout, result)
416406
self.assertEqual(5, result.returncode, result)
417407

418-
def testInconsistentMode(self):
419-
"""Test failing run when attempting to wrongly override the mode."""
420-
with temp_base() as basedir:
421-
override_build_config(basedir, is_debug=True)
422-
result = run_tests(basedir, '--mode=Release')
423-
self.assertIn('execution mode (release) for release is inconsistent '
424-
'with build config (debug)', result.stdout, result)
425-
self.assertEqual(5, result.returncode, result)
426-
427408
def testInconsistentArch(self):
428409
"""Test failing run when attempting to wrongly override the arch."""
429410
with temp_base() as basedir:
430-
result = run_tests(basedir, '--mode=Release', '--arch=ia32')
411+
result = run_tests(basedir, '--arch=ia32')
431412
self.assertIn(
432413
'--arch value (ia32) inconsistent with build config (x64).',
433414
result.stdout, result)
@@ -436,13 +417,13 @@ def testInconsistentArch(self):
436417
def testWrongVariant(self):
437418
"""Test using a bogus variant."""
438419
with temp_base() as basedir:
439-
result = run_tests(basedir, '--mode=Release', '--variants=meh')
420+
result = run_tests(basedir, '--variants=meh')
440421
self.assertEqual(5, result.returncode, result)
441422

442423
def testModeFromBuildConfig(self):
443424
"""Test auto-detection of mode from build config."""
444425
with temp_base() as basedir:
445-
result = run_tests(basedir, '--outdir=out/Release', 'sweet/bananas')
426+
result = run_tests(basedir, '--outdir=out/build', 'sweet/bananas')
446427
self.assertIn('Running tests for x64.release', result.stdout, result)
447428
self.assertEqual(0, result.returncode, result)
448429

@@ -455,7 +436,6 @@ def testReport(self):
455436
with temp_base() as basedir:
456437
result = run_tests(
457438
basedir,
458-
'--mode=Release',
459439
'--variants=default',
460440
'sweet',
461441
'--report',
@@ -471,7 +451,6 @@ def testWarnUnusedRules(self):
471451
with temp_base() as basedir:
472452
result = run_tests(
473453
basedir,
474-
'--mode=Release',
475454
'--variants=default,nooptimization',
476455
'sweet',
477456
'--warn-unused',
@@ -486,7 +465,6 @@ def testCatNoSources(self):
486465
with temp_base() as basedir:
487466
result = run_tests(
488467
basedir,
489-
'--mode=Release',
490468
'--variants=default',
491469
'sweet/bananas',
492470
'--cat',
@@ -505,7 +483,6 @@ def testPredictable(self):
505483
override_build_config(basedir, v8_enable_verify_predictable=True)
506484
result = run_tests(
507485
basedir,
508-
'--mode=Release',
509486
'--progress=verbose',
510487
'--variants=default',
511488
'sweet/bananas',
@@ -524,7 +501,6 @@ def testSlowArch(self):
524501
override_build_config(basedir, v8_target_cpu='arm64')
525502
result = run_tests(
526503
basedir,
527-
'--mode=Release',
528504
'--progress=verbose',
529505
'--variants=default',
530506
'sweet/bananas',
@@ -538,7 +514,6 @@ def testRandomSeedStressWithDefault(self):
538514
with temp_base() as basedir:
539515
result = run_tests(
540516
basedir,
541-
'--mode=Release',
542517
'--progress=verbose',
543518
'--variants=default',
544519
'--random-seed-stress-count=2',
@@ -553,7 +528,6 @@ def testRandomSeedStressWithSeed(self):
553528
with temp_base() as basedir:
554529
result = run_tests(
555530
basedir,
556-
'--mode=Release',
557531
'--progress=verbose',
558532
'--variants=default',
559533
'--random-seed-stress-count=2',
@@ -577,7 +551,6 @@ def testSpecificVariants(self):
577551
override_build_config(basedir, is_asan=True)
578552
result = run_tests(
579553
basedir,
580-
'--mode=Release',
581554
'--progress=verbose',
582555
'--variants=default,stress',
583556
'sweet/bananas',
@@ -599,7 +572,6 @@ def testDotsProgress(self):
599572
with temp_base() as basedir:
600573
result = run_tests(
601574
basedir,
602-
'--mode=Release',
603575
'--progress=dots',
604576
'sweet/cherries',
605577
'sweet/bananas',
@@ -620,7 +592,6 @@ def _testCompactProgress(self, name):
620592
with temp_base() as basedir:
621593
result = run_tests(
622594
basedir,
623-
'--mode=Release',
624595
'--progress=%s' % name,
625596
'sweet/cherries',
626597
'sweet/bananas',
@@ -641,7 +612,6 @@ def testExitAfterNFailures(self):
641612
with temp_base() as basedir:
642613
result = run_tests(
643614
basedir,
644-
'--mode=Release',
645615
'--progress=verbose',
646616
'--exit-after-n-failures=2',
647617
'-j1',
@@ -660,7 +630,7 @@ def testExitAfterNFailures(self):
660630
self.assertEqual(1, result.returncode, result)
661631

662632
def testNumFuzzer(self):
663-
sys_args = ['--command-prefix', sys.executable, '--outdir', 'out/Release']
633+
sys_args = ['--command-prefix', sys.executable, '--outdir', 'out/build']
664634

665635
with temp_base() as basedir:
666636
with capture() as (stdout, stderr):
@@ -674,7 +644,6 @@ def testRunnerFlags(self):
674644
with temp_base() as basedir:
675645
result = run_tests(
676646
basedir,
677-
'--mode=Release',
678647
'--progress=verbose',
679648
'--variants=default',
680649
'--random-seed=42',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

‎deps/v8/tools/unittests/testdata/expected_test_results1.json

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"arch": "x64",
32
"duration_mean": 1,
4-
"mode": "release",
53
"results": [
64
{
7-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
5+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
86
"duration": 1,
97
"exit_code": 1,
108
"expected": [
@@ -29,7 +27,7 @@
2927
"variant_flags": []
3028
},
3129
{
32-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
30+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
3331
"duration": 1,
3432
"exit_code": 1,
3533
"expected": [
@@ -54,7 +52,7 @@
5452
"variant_flags": []
5553
},
5654
{
57-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
55+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
5856
"duration": 1,
5957
"exit_code": 1,
6058
"expected": [
@@ -81,7 +79,7 @@
8179
],
8280
"slowest_tests": [
8381
{
84-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
82+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
8583
"duration": 1,
8684
"exit_code": 1,
8785
"expected": [
@@ -105,7 +103,7 @@
105103
"variant_flags": []
106104
},
107105
{
108-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
106+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
109107
"duration": 1,
110108
"exit_code": 1,
111109
"expected": [
@@ -129,7 +127,7 @@
129127
"variant_flags": []
130128
},
131129
{
132-
"command": "/usr/bin/python out/Release/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
130+
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",
133131
"duration": 1,
134132
"exit_code": 1,
135133
"expected": [

‎deps/v8/tools/unittests/testdata/expected_test_results2.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"arch": "x64",
32
"duration_mean": 1,
4-
"mode": "release",
53
"results": [
64
{
7-
"command": "/usr/bin/python out/Release/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
5+
"command": "/usr/bin/python out/build/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
86
"duration": 1,
97
"exit_code": 1,
108
"expected": [
@@ -28,7 +26,7 @@
2826
"variant_flags": []
2927
},
3028
{
31-
"command": "/usr/bin/python out/Release/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
29+
"command": "/usr/bin/python out/build/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
3230
"duration": 1,
3331
"exit_code": 0,
3432
"expected": [
@@ -54,7 +52,7 @@
5452
],
5553
"slowest_tests": [
5654
{
57-
"command": "/usr/bin/python out/Release/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
55+
"command": "/usr/bin/python out/build/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
5856
"duration": 1,
5957
"exit_code": 0,
6058
"expected": [
@@ -77,7 +75,7 @@
7775
"variant_flags": []
7876
},
7977
{
80-
"command": "/usr/bin/python out/Release/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
78+
"command": "/usr/bin/python out/build/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",
8179
"duration": 1,
8280
"exit_code": 1,
8381
"expected": [

0 commit comments

Comments
 (0)
Please sign in to comment.