2017-10-13 08:13:39 +00:00
|
|
|
# Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2019-02-18 14:01:33 +00:00
|
|
|
# for py2/py3 compatibility
|
|
|
|
from __future__ import print_function
|
|
|
|
from functools import reduce
|
2017-10-13 08:13:39 +00:00
|
|
|
|
2020-10-06 11:40:26 +00:00
|
|
|
from collections import OrderedDict, namedtuple
|
2017-10-16 14:24:43 +00:00
|
|
|
import json
|
2018-02-02 22:46:27 +00:00
|
|
|
import multiprocessing
|
2017-10-16 14:24:43 +00:00
|
|
|
import optparse
|
2017-10-13 08:13:39 +00:00
|
|
|
import os
|
2018-01-31 12:01:49 +00:00
|
|
|
import shlex
|
2017-10-13 08:13:39 +00:00
|
|
|
import sys
|
2019-02-01 09:18:33 +00:00
|
|
|
import traceback
|
2017-10-13 08:13:39 +00:00
|
|
|
|
|
|
|
|
2019-02-18 14:01:33 +00:00
|
|
|
|
2017-10-13 08:13:39 +00:00
|
|
|
# Add testrunner to the path.
|
|
|
|
sys.path.insert(
|
|
|
|
0,
|
|
|
|
os.path.dirname(
|
|
|
|
os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
|
|
|
|
2018-08-10 17:09:34 +00:00
|
|
|
from testrunner.local import command
|
2018-01-31 09:18:13 +00:00
|
|
|
from testrunner.local import testsuite
|
|
|
|
from testrunner.local import utils
|
|
|
|
from testrunner.test_config import TestConfig
|
2018-02-01 12:53:25 +00:00
|
|
|
from testrunner.testproc import progress
|
2018-01-31 13:56:01 +00:00
|
|
|
from testrunner.testproc.rerun import RerunProc
|
2018-01-31 09:18:13 +00:00
|
|
|
from testrunner.testproc.shard import ShardProc
|
2018-01-31 10:21:44 +00:00
|
|
|
from testrunner.testproc.sigproc import SignalProc
|
2018-01-31 09:18:13 +00:00
|
|
|
from testrunner.testproc.timeout import TimeoutProc
|
2020-07-14 12:10:38 +00:00
|
|
|
from testrunner.testproc import util
|
2018-01-17 13:52:47 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
|
|
|
|
BASE_DIR = (
|
|
|
|
os.path.dirname(
|
|
|
|
os.path.dirname(
|
|
|
|
os.path.dirname(
|
|
|
|
os.path.abspath(__file__)))))
|
|
|
|
|
|
|
|
DEFAULT_OUT_GN = 'out.gn'
|
|
|
|
|
|
|
|
# Map of test name synonyms to lists of test suites. Should be ordered by
|
|
|
|
# expected runtimes (suites with slow test cases first). These groups are
|
|
|
|
# invoked in separate steps on the bots.
|
2019-08-26 12:28:06 +00:00
|
|
|
# The mapping from names used here to GN targets (which must stay in sync)
|
|
|
|
# is defined in infra/mb/gn_isolate_map.pyl.
|
2017-10-16 14:24:43 +00:00
|
|
|
TEST_MAP = {
|
2019-08-26 12:28:06 +00:00
|
|
|
# This needs to stay in sync with group("v8_bot_default") in test/BUILD.gn.
|
2017-10-16 14:24:43 +00:00
|
|
|
"bot_default": [
|
|
|
|
"debugger",
|
|
|
|
"mjsunit",
|
|
|
|
"cctest",
|
|
|
|
"wasm-spec-tests",
|
|
|
|
"inspector",
|
|
|
|
"webkit",
|
|
|
|
"mkgrokdump",
|
2018-10-17 19:00:16 +00:00
|
|
|
"wasm-js",
|
2017-10-16 14:24:43 +00:00
|
|
|
"fuzzer",
|
|
|
|
"message",
|
|
|
|
"intl",
|
|
|
|
"unittests",
|
2019-08-26 12:28:06 +00:00
|
|
|
"wasm-api-tests",
|
2017-10-16 14:24:43 +00:00
|
|
|
],
|
2019-08-26 12:28:06 +00:00
|
|
|
# This needs to stay in sync with group("v8_default") in test/BUILD.gn.
|
2017-10-16 14:24:43 +00:00
|
|
|
"default": [
|
|
|
|
"debugger",
|
|
|
|
"mjsunit",
|
|
|
|
"cctest",
|
|
|
|
"wasm-spec-tests",
|
|
|
|
"inspector",
|
|
|
|
"mkgrokdump",
|
2018-10-17 19:00:16 +00:00
|
|
|
"wasm-js",
|
2017-10-16 14:24:43 +00:00
|
|
|
"fuzzer",
|
|
|
|
"message",
|
|
|
|
"intl",
|
|
|
|
"unittests",
|
2019-08-26 12:28:06 +00:00
|
|
|
"wasm-api-tests",
|
2017-10-16 14:24:43 +00:00
|
|
|
],
|
2019-08-26 12:28:06 +00:00
|
|
|
# This needs to stay in sync with group("v8_d8_default") in test/BUILD.gn.
|
2018-01-12 14:21:47 +00:00
|
|
|
"d8_default": [
|
2018-09-06 13:10:50 +00:00
|
|
|
"debugger",
|
2018-01-12 14:21:47 +00:00
|
|
|
"mjsunit",
|
|
|
|
"webkit",
|
2018-09-06 13:10:50 +00:00
|
|
|
"message",
|
|
|
|
"intl",
|
2018-01-12 14:21:47 +00:00
|
|
|
],
|
2019-08-26 12:28:06 +00:00
|
|
|
# This needs to stay in sync with "v8_optimize_for_size" in test/BUILD.gn.
|
2017-10-16 14:24:43 +00:00
|
|
|
"optimize_for_size": [
|
|
|
|
"debugger",
|
|
|
|
"mjsunit",
|
|
|
|
"cctest",
|
|
|
|
"inspector",
|
|
|
|
"webkit",
|
|
|
|
"intl",
|
|
|
|
],
|
|
|
|
"unittests": [
|
|
|
|
"unittests",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2019-11-27 09:20:01 +00:00
|
|
|
# Increase the timeout for these:
|
|
|
|
SLOW_ARCHS = [
|
|
|
|
"arm",
|
|
|
|
"arm64",
|
|
|
|
"mips",
|
|
|
|
"mipsel",
|
|
|
|
"mips64",
|
|
|
|
"mips64el",
|
|
|
|
"s390",
|
|
|
|
"s390x",
|
2021-08-11 11:54:59 +00:00
|
|
|
"riscv64",
|
|
|
|
"loong64"
|
2019-11-27 09:20:01 +00:00
|
|
|
]
|
2018-01-31 12:01:49 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
|
2020-10-06 11:40:26 +00:00
|
|
|
ModeConfig = namedtuple(
|
2020-10-07 16:43:41 +00:00
|
|
|
'ModeConfig', 'label flags timeout_scalefactor status_mode')
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2020-02-19 13:52:16 +00:00
|
|
|
DEBUG_FLAGS = ["--nohard-abort", "--enable-slow-asserts", "--verify-heap"]
|
|
|
|
RELEASE_FLAGS = ["--nohard-abort"]
|
2020-10-06 11:40:26 +00:00
|
|
|
|
|
|
|
DEBUG_MODE = ModeConfig(
|
|
|
|
label='debug',
|
2017-10-26 14:20:26 +00:00
|
|
|
flags=DEBUG_FLAGS,
|
|
|
|
timeout_scalefactor=4,
|
|
|
|
status_mode="debug",
|
2020-10-06 11:40:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
RELEASE_MODE = ModeConfig(
|
|
|
|
label='release',
|
2017-10-26 14:20:26 +00:00
|
|
|
flags=RELEASE_FLAGS,
|
|
|
|
timeout_scalefactor=1,
|
|
|
|
status_mode="release",
|
2020-10-06 11:40:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Normal trybot release configuration. There, dchecks are always on which
|
|
|
|
# implies debug is set. Hence, the status file needs to assume debug-like
|
|
|
|
# behavior/timeouts.
|
|
|
|
TRY_RELEASE_MODE = ModeConfig(
|
|
|
|
label='release+dchecks',
|
2017-10-26 14:20:26 +00:00
|
|
|
flags=RELEASE_FLAGS,
|
2020-10-06 11:40:26 +00:00
|
|
|
timeout_scalefactor=4,
|
2017-10-26 14:20:26 +00:00
|
|
|
status_mode="debug",
|
2020-10-06 11:40:26 +00:00
|
|
|
)
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2018-02-01 12:53:25 +00:00
|
|
|
PROGRESS_INDICATORS = {
|
|
|
|
'verbose': progress.VerboseProgressIndicator,
|
2019-09-17 10:24:30 +00:00
|
|
|
'ci': progress.CIProgressIndicator,
|
2018-02-01 12:53:25 +00:00
|
|
|
'dots': progress.DotsProgressIndicator,
|
|
|
|
'color': progress.ColorProgressIndicator,
|
|
|
|
'mono': progress.MonochromeProgressIndicator,
|
2020-06-25 07:59:25 +00:00
|
|
|
'stream': progress.StreamProgressIndicator,
|
2018-02-01 12:53:25 +00:00
|
|
|
}
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
class TestRunnerError(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
class BuildConfig(object):
|
|
|
|
def __init__(self, build_config):
|
|
|
|
# In V8 land, GN's x86 is called ia32.
|
|
|
|
if build_config['v8_target_cpu'] == 'x86':
|
|
|
|
self.arch = 'ia32'
|
|
|
|
else:
|
|
|
|
self.arch = build_config['v8_target_cpu']
|
|
|
|
|
|
|
|
self.asan = build_config['is_asan']
|
|
|
|
self.cfi_vptr = build_config['is_cfi']
|
2021-02-12 13:45:47 +00:00
|
|
|
self.control_flow_integrity = build_config['v8_control_flow_integrity']
|
2020-09-28 17:49:52 +00:00
|
|
|
self.concurrent_marking = build_config['v8_enable_concurrent_marking']
|
2021-04-21 00:32:15 +00:00
|
|
|
self.single_generation = build_config['v8_enable_single_generation']
|
2021-07-27 06:41:14 +00:00
|
|
|
self.dcheck_always_on = build_config['dcheck_always_on']
|
2017-10-26 14:20:26 +00:00
|
|
|
self.gcov_coverage = build_config['is_gcov_coverage']
|
2018-08-10 17:09:34 +00:00
|
|
|
self.is_android = build_config['is_android']
|
2019-02-27 13:36:17 +00:00
|
|
|
self.is_clang = build_config['is_clang']
|
2018-08-10 17:09:34 +00:00
|
|
|
self.is_debug = build_config['is_debug']
|
2019-05-06 13:18:59 +00:00
|
|
|
self.is_full_debug = build_config['is_full_debug']
|
2017-10-26 14:20:26 +00:00
|
|
|
self.msan = build_config['is_msan']
|
|
|
|
self.no_i18n = not build_config['v8_enable_i18n_support']
|
|
|
|
self.predictable = build_config['v8_enable_verify_predictable']
|
2020-09-07 12:14:41 +00:00
|
|
|
self.simulator_run = (build_config['target_cpu'] !=
|
|
|
|
build_config['v8_target_cpu'])
|
2017-10-26 14:20:26 +00:00
|
|
|
self.tsan = build_config['is_tsan']
|
2019-05-02 07:05:43 +00:00
|
|
|
# TODO(machenbach): We only have ubsan not ubsan_vptr.
|
2017-10-26 14:20:26 +00:00
|
|
|
self.ubsan_vptr = build_config['is_ubsan_vptr']
|
2018-10-16 08:22:23 +00:00
|
|
|
self.verify_csa = build_config['v8_enable_verify_csa']
|
2018-10-19 13:34:53 +00:00
|
|
|
self.lite_mode = build_config['v8_enable_lite_mode']
|
2018-12-19 16:21:38 +00:00
|
|
|
self.pointer_compression = build_config['v8_enable_pointer_compression']
|
2021-04-10 02:09:41 +00:00
|
|
|
self.pointer_compression_shared_cage = build_config['v8_enable_pointer_compression_shared_cage']
|
V8 Sandbox rebranding
This CL renames a number of things related to the V8 sandbox.
Mainly, what used to be under V8_HEAP_SANDBOX is now under
V8_SANDBOXED_EXTERNAL_POINTERS, while the previous V8 VirtualMemoryCage
is now simply the V8 Sandbox:
V8_VIRTUAL_MEMORY_CAGE => V8_SANDBOX
V8_HEAP_SANDBOX => V8_SANDBOXED_EXTERNAL_POINTERS
V8_CAGED_POINTERS => V8_SANDBOXED_POINTERS
V8VirtualMemoryCage => Sandbox
CagedPointer => SandboxedPointer
fake cage => partially reserved sandbox
src/security => src/sandbox
This naming scheme should simplify things: the sandbox is now the large
region of virtual address space inside which V8 mainly operates and
which should be considered untrusted. Mechanisms like sandboxed pointers
are then used to attempt to prevent escapes from the sandbox (i.e.
corruption of memory outside of it). Furthermore, the new naming scheme
avoids the confusion with the various other "cages" in V8, in
particular, the VirtualMemoryCage class, by dropping that name entirely.
Future sandbox features are developed under their own V8_SANDBOX_X flag,
and will, once final, be merged into V8_SANDBOX. Current future features
are sandboxed external pointers (using the external pointer table), and
sandboxed pointers (pointers guaranteed to point into the sandbox, e.g.
because they are encoded as offsets). This CL then also introduces a new
build flag, v8_enable_sandbox_future, which enables all future features.
Bug: v8:10391
Change-Id: I5174ea8f5ab40fb96a04af10853da735ad775c96
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3322981
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78384}
2021-12-15 13:39:15 +00:00
|
|
|
self.sandbox = build_config['v8_enable_sandbox']
|
2021-04-14 14:09:35 +00:00
|
|
|
self.third_party_heap = build_config['v8_enable_third_party_heap']
|
2021-02-22 09:37:09 +00:00
|
|
|
self.webassembly = build_config['v8_enable_webassembly']
|
2021-10-19 10:09:41 +00:00
|
|
|
self.dict_property_const_tracking = build_config['v8_dict_property_const_tracking']
|
2018-01-29 10:24:31 +00:00
|
|
|
# Export only for MIPS target
|
|
|
|
if self.arch in ['mips', 'mipsel', 'mips64', 'mips64el']:
|
|
|
|
self.mips_arch_variant = build_config['mips_arch_variant']
|
|
|
|
self.mips_use_msa = build_config['mips_use_msa']
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2019-05-02 07:05:43 +00:00
|
|
|
@property
|
|
|
|
def use_sanitizer(self):
|
|
|
|
return (self.asan or self.cfi_vptr or self.msan or self.tsan or
|
|
|
|
self.ubsan_vptr)
|
|
|
|
|
2017-11-07 12:47:41 +00:00
|
|
|
def __str__(self):
|
|
|
|
detected_options = []
|
|
|
|
|
|
|
|
if self.asan:
|
|
|
|
detected_options.append('asan')
|
|
|
|
if self.cfi_vptr:
|
|
|
|
detected_options.append('cfi_vptr')
|
2021-02-12 13:45:47 +00:00
|
|
|
if self.control_flow_integrity:
|
|
|
|
detected_options.append('control_flow_integrity')
|
2021-07-27 06:41:14 +00:00
|
|
|
if self.dcheck_always_on:
|
|
|
|
detected_options.append('dcheck_always_on')
|
2017-11-07 12:47:41 +00:00
|
|
|
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.predictable:
|
|
|
|
detected_options.append('predictable')
|
|
|
|
if self.tsan:
|
|
|
|
detected_options.append('tsan')
|
|
|
|
if self.ubsan_vptr:
|
|
|
|
detected_options.append('ubsan_vptr')
|
2018-10-16 08:22:23 +00:00
|
|
|
if self.verify_csa:
|
|
|
|
detected_options.append('verify_csa')
|
2018-10-19 13:34:53 +00:00
|
|
|
if self.lite_mode:
|
|
|
|
detected_options.append('lite_mode')
|
2018-12-19 16:21:38 +00:00
|
|
|
if self.pointer_compression:
|
|
|
|
detected_options.append('pointer_compression')
|
2021-04-10 02:09:41 +00:00
|
|
|
if self.pointer_compression_shared_cage:
|
|
|
|
detected_options.append('pointer_compression_shared_cage')
|
V8 Sandbox rebranding
This CL renames a number of things related to the V8 sandbox.
Mainly, what used to be under V8_HEAP_SANDBOX is now under
V8_SANDBOXED_EXTERNAL_POINTERS, while the previous V8 VirtualMemoryCage
is now simply the V8 Sandbox:
V8_VIRTUAL_MEMORY_CAGE => V8_SANDBOX
V8_HEAP_SANDBOX => V8_SANDBOXED_EXTERNAL_POINTERS
V8_CAGED_POINTERS => V8_SANDBOXED_POINTERS
V8VirtualMemoryCage => Sandbox
CagedPointer => SandboxedPointer
fake cage => partially reserved sandbox
src/security => src/sandbox
This naming scheme should simplify things: the sandbox is now the large
region of virtual address space inside which V8 mainly operates and
which should be considered untrusted. Mechanisms like sandboxed pointers
are then used to attempt to prevent escapes from the sandbox (i.e.
corruption of memory outside of it). Furthermore, the new naming scheme
avoids the confusion with the various other "cages" in V8, in
particular, the VirtualMemoryCage class, by dropping that name entirely.
Future sandbox features are developed under their own V8_SANDBOX_X flag,
and will, once final, be merged into V8_SANDBOX. Current future features
are sandboxed external pointers (using the external pointer table), and
sandboxed pointers (pointers guaranteed to point into the sandbox, e.g.
because they are encoded as offsets). This CL then also introduces a new
build flag, v8_enable_sandbox_future, which enables all future features.
Bug: v8:10391
Change-Id: I5174ea8f5ab40fb96a04af10853da735ad775c96
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3322981
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78384}
2021-12-15 13:39:15 +00:00
|
|
|
if self.sandbox:
|
|
|
|
detected_options.append('sandbox')
|
2021-04-14 14:09:35 +00:00
|
|
|
if self.third_party_heap:
|
|
|
|
detected_options.append('third_party_heap')
|
2021-02-22 09:37:09 +00:00
|
|
|
if self.webassembly:
|
|
|
|
detected_options.append('webassembly')
|
2021-10-19 10:09:41 +00:00
|
|
|
if self.dict_property_const_tracking:
|
|
|
|
detected_options.append('dict_property_const_tracking')
|
2017-11-07 12:47:41 +00:00
|
|
|
|
|
|
|
return '\n'.join(detected_options)
|
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2020-09-30 12:07:31 +00:00
|
|
|
def _do_load_build_config(outdir, verbose=False):
|
|
|
|
build_config_path = os.path.join(outdir, "v8_build_config.json")
|
|
|
|
if not os.path.exists(build_config_path):
|
|
|
|
if verbose:
|
|
|
|
print("Didn't find build config: %s" % build_config_path)
|
|
|
|
raise TestRunnerError()
|
|
|
|
|
|
|
|
with open(build_config_path) as f:
|
|
|
|
try:
|
|
|
|
build_config_json = json.load(f)
|
|
|
|
except Exception: # pragma: no cover
|
|
|
|
print("%s exists but contains invalid json. Is your build up-to-date?"
|
|
|
|
% build_config_path)
|
|
|
|
raise TestRunnerError()
|
|
|
|
|
|
|
|
return BuildConfig(build_config_json)
|
|
|
|
|
|
|
|
|
2017-10-13 08:13:39 +00:00
|
|
|
class BaseTestRunner(object):
|
2017-12-22 15:30:32 +00:00
|
|
|
def __init__(self, basedir=None):
|
|
|
|
self.basedir = basedir or BASE_DIR
|
2017-10-16 14:24:43 +00:00
|
|
|
self.outdir = None
|
2017-10-26 14:20:26 +00:00
|
|
|
self.build_config = None
|
|
|
|
self.mode_options = None
|
2018-08-10 17:09:34 +00:00
|
|
|
self.target_os = None
|
2021-08-20 15:06:40 +00:00
|
|
|
self.infra_staging = False
|
2017-10-25 09:59:54 +00:00
|
|
|
|
2019-04-11 08:58:47 +00:00
|
|
|
@property
|
|
|
|
def framework_name(self):
|
|
|
|
"""String name of the base-runner subclass, used in test results."""
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
2017-12-22 15:30:32 +00:00
|
|
|
def execute(self, sys_args=None):
|
|
|
|
if sys_args is None: # pragma: no cover
|
|
|
|
sys_args = sys.argv[1:]
|
2017-10-26 09:43:03 +00:00
|
|
|
try:
|
2017-10-26 14:20:26 +00:00
|
|
|
parser = self._create_parser()
|
2017-12-22 15:30:32 +00:00
|
|
|
options, args = self._parse_args(parser, sys_args)
|
2021-08-20 15:06:40 +00:00
|
|
|
self.infra_staging = options.infra_staging
|
2018-02-02 22:46:27 +00:00
|
|
|
if options.swarming:
|
|
|
|
# Swarming doesn't print how isolated commands are called. Lets make
|
|
|
|
# this less cryptic by printing it ourselves.
|
2019-02-18 14:01:33 +00:00
|
|
|
print(' '.join(sys.argv))
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2021-06-11 07:24:18 +00:00
|
|
|
# TODO(machenbach): Print used Python version until we have switched to
|
|
|
|
# Python3 everywhere.
|
|
|
|
print('Running with:')
|
|
|
|
print(sys.version)
|
|
|
|
|
2020-07-14 12:10:38 +00:00
|
|
|
# Kill stray processes from previous tasks on swarming.
|
|
|
|
util.kill_processes_linux()
|
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
self._load_build_config(options)
|
2019-02-05 17:53:52 +00:00
|
|
|
command.setup(self.target_os, options.device)
|
2017-10-26 14:20:26 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
self._process_default_options(options)
|
|
|
|
self._process_options(options)
|
|
|
|
except TestRunnerError:
|
|
|
|
parser.print_help()
|
|
|
|
raise
|
|
|
|
|
2018-01-17 10:00:28 +00:00
|
|
|
args = self._parse_test_args(args)
|
2019-01-15 10:43:02 +00:00
|
|
|
tests = self._load_testsuite_generators(args, options)
|
2017-10-25 11:42:29 +00:00
|
|
|
self._setup_env()
|
2018-02-02 22:46:27 +00:00
|
|
|
print(">>> Running tests for %s.%s" % (self.build_config.arch,
|
2020-10-06 11:40:26 +00:00
|
|
|
self.mode_options.label))
|
2019-03-01 13:48:50 +00:00
|
|
|
exit_code = self._do_execute(tests, args, options)
|
|
|
|
if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
|
|
|
|
print("Force exit code 0 after failures. Json test results file "
|
|
|
|
"generated with failure information.")
|
|
|
|
exit_code = utils.EXIT_CODE_PASS
|
|
|
|
return exit_code
|
2017-10-16 14:24:43 +00:00
|
|
|
except TestRunnerError:
|
2019-02-01 09:18:33 +00:00
|
|
|
traceback.print_exc()
|
2018-02-20 17:23:37 +00:00
|
|
|
return utils.EXIT_CODE_INTERNAL_ERROR
|
2018-01-15 17:49:16 +00:00
|
|
|
except KeyboardInterrupt:
|
2018-02-20 17:23:37 +00:00
|
|
|
return utils.EXIT_CODE_INTERRUPTED
|
2019-02-01 09:18:33 +00:00
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
|
|
|
return utils.EXIT_CODE_INTERNAL_ERROR
|
2018-08-10 17:09:34 +00:00
|
|
|
finally:
|
|
|
|
command.tear_down()
|
2017-10-16 14:24:43 +00:00
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
def _create_parser(self):
|
2017-10-16 14:24:43 +00:00
|
|
|
parser = optparse.OptionParser()
|
|
|
|
parser.usage = '%prog [options] [tests]'
|
|
|
|
parser.description = """TESTS: %s""" % (TEST_MAP["default"])
|
|
|
|
self._add_parser_default_options(parser)
|
|
|
|
self._add_parser_options(parser)
|
2017-10-26 14:20:26 +00:00
|
|
|
return parser
|
2017-10-16 14:24:43 +00:00
|
|
|
|
|
|
|
def _add_parser_default_options(self, parser):
|
|
|
|
parser.add_option("--gn", help="Scan out.gn for the last built"
|
|
|
|
" configuration",
|
|
|
|
default=False, action="store_true")
|
|
|
|
parser.add_option("--outdir", help="Base directory with compile output",
|
|
|
|
default="out")
|
|
|
|
parser.add_option("--arch",
|
2017-11-02 18:59:38 +00:00
|
|
|
help="The architecture to run tests for")
|
|
|
|
parser.add_option("--shell-dir", help="DEPRECATED! Executables from build "
|
|
|
|
"directory will be used")
|
2018-05-25 13:22:03 +00:00
|
|
|
parser.add_option("--test-root", help="Root directory of the test suites",
|
|
|
|
default=os.path.join(self.basedir, 'test'))
|
2018-01-31 09:18:13 +00:00
|
|
|
parser.add_option("--total-timeout-sec", default=0, type="int",
|
|
|
|
help="How long should fuzzer run")
|
2018-02-02 22:46:27 +00:00
|
|
|
parser.add_option("--swarming", default=False, action="store_true",
|
|
|
|
help="Indicates running test driver on swarming.")
|
2021-08-20 15:06:40 +00:00
|
|
|
parser.add_option('--infra-staging', help='Use new test runner features',
|
|
|
|
dest='infra_staging', default=None,
|
|
|
|
action='store_true')
|
|
|
|
parser.add_option('--no-infra-staging',
|
|
|
|
help='Opt out of new test runner features',
|
|
|
|
dest='infra_staging', default=None,
|
|
|
|
action='store_false')
|
2018-02-02 22:46:27 +00:00
|
|
|
|
|
|
|
parser.add_option("-j", help="The number of parallel tasks to run",
|
|
|
|
default=0, type=int)
|
2019-02-05 17:53:52 +00:00
|
|
|
parser.add_option("-d", "--device",
|
|
|
|
help="The device ID to run Android tests on. If not "
|
|
|
|
"given it will be autodetected.")
|
2018-02-01 14:55:53 +00:00
|
|
|
|
|
|
|
# Shard
|
|
|
|
parser.add_option("--shard-count", default=1, type=int,
|
|
|
|
help="Split tests into this number of shards")
|
|
|
|
parser.add_option("--shard-run", default=1, type=int,
|
|
|
|
help="Run this shard from the split up tests.")
|
2018-01-31 13:56:01 +00:00
|
|
|
|
2018-02-01 12:53:25 +00:00
|
|
|
# Progress
|
|
|
|
parser.add_option("-p", "--progress",
|
2021-09-29 14:45:12 +00:00
|
|
|
choices=list(PROGRESS_INDICATORS.keys()), default="mono",
|
2018-02-01 12:53:25 +00:00
|
|
|
help="The style of progress indicator (verbose, dots, "
|
|
|
|
"color, mono)")
|
|
|
|
parser.add_option("--json-test-results",
|
|
|
|
help="Path to a file for storing json results.")
|
2020-02-19 14:03:21 +00:00
|
|
|
parser.add_option('--slow-tests-cutoff', type="int", default=100,
|
|
|
|
help='Collect N slowest tests')
|
2018-10-02 13:31:32 +00:00
|
|
|
parser.add_option("--exit-after-n-failures", type="int", default=100,
|
|
|
|
help="Exit after the first N failures instead of "
|
|
|
|
"running all tests. Pass 0 to disable this feature.")
|
2019-09-17 10:24:30 +00:00
|
|
|
parser.add_option("--ci-test-completion",
|
|
|
|
help="Path to a file for logging test completion in the "
|
|
|
|
"context of CI progress indicator. Ignored if "
|
|
|
|
"progress indicator is other than 'ci'.")
|
2018-02-01 12:53:25 +00:00
|
|
|
|
|
|
|
# Rerun
|
2018-01-31 13:56:01 +00:00
|
|
|
parser.add_option("--rerun-failures-count", default=0, type=int,
|
|
|
|
help="Number of times to rerun each failing test case. "
|
|
|
|
"Very slow tests will be rerun only once.")
|
|
|
|
parser.add_option("--rerun-failures-max", default=100, type=int,
|
|
|
|
help="Maximum number of failing test cases to rerun")
|
2017-10-16 14:24:43 +00:00
|
|
|
|
2018-02-01 12:53:25 +00:00
|
|
|
# Test config
|
2018-01-31 12:01:49 +00:00
|
|
|
parser.add_option("--command-prefix", default="",
|
|
|
|
help="Prepended to each shell command used to run a test")
|
2020-09-07 12:14:41 +00:00
|
|
|
parser.add_option('--dont-skip-slow-simulator-tests',
|
|
|
|
help='Don\'t skip more slow tests when using a'
|
|
|
|
' simulator.', default=False, action='store_true',
|
|
|
|
dest='dont_skip_simulator_slow_tests')
|
2018-01-31 12:01:49 +00:00
|
|
|
parser.add_option("--extra-flags", action="append", default=[],
|
|
|
|
help="Additional flags to pass to each test command")
|
|
|
|
parser.add_option("--isolates", action="store_true", default=False,
|
|
|
|
help="Whether to test isolates")
|
|
|
|
parser.add_option("--no-harness", "--noharness",
|
|
|
|
default=False, action="store_true",
|
|
|
|
help="Run without test harness of a given suite")
|
2018-02-01 14:55:53 +00:00
|
|
|
parser.add_option("--random-seed", default=0, type=int,
|
|
|
|
help="Default seed for initializing random generator")
|
2018-11-22 07:33:45 +00:00
|
|
|
parser.add_option("--run-skipped", help="Also run skipped tests.",
|
|
|
|
default=False, action="store_true")
|
2018-01-31 12:01:49 +00:00
|
|
|
parser.add_option("-t", "--timeout", default=60, type=int,
|
|
|
|
help="Timeout for single test in seconds")
|
|
|
|
parser.add_option("-v", "--verbose", default=False, action="store_true",
|
|
|
|
help="Verbose output")
|
2020-03-03 18:04:10 +00:00
|
|
|
parser.add_option('--regenerate-expected-files', default=False, action='store_true',
|
|
|
|
help='Regenerate expected files')
|
2018-01-31 12:01:49 +00:00
|
|
|
|
2018-01-19 13:04:34 +00:00
|
|
|
# TODO(machenbach): Temporary options for rolling out new test runner
|
|
|
|
# features.
|
2018-01-22 14:40:51 +00:00
|
|
|
parser.add_option("--mastername", default='',
|
|
|
|
help="Mastername property from infrastructure. Not "
|
|
|
|
"setting this option indicates manual usage.")
|
|
|
|
parser.add_option("--buildername", default='',
|
|
|
|
help="Buildername property from infrastructure. Not "
|
|
|
|
"setting this option indicates manual usage.")
|
2018-01-19 13:04:34 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
def _add_parser_options(self, parser):
|
|
|
|
pass
|
|
|
|
|
2017-12-22 15:30:32 +00:00
|
|
|
def _parse_args(self, parser, sys_args):
|
|
|
|
options, args = parser.parse_args(sys_args)
|
2017-10-24 11:24:37 +00:00
|
|
|
|
2020-10-06 11:40:26 +00:00
|
|
|
if options.arch and ',' in options.arch: # pragma: no cover
|
|
|
|
print('Multiple architectures are deprecated')
|
2017-10-26 14:20:26 +00:00
|
|
|
raise TestRunnerError()
|
2017-10-25 09:59:54 +00:00
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
return options, args
|
2017-10-25 09:59:54 +00:00
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
def _load_build_config(self, options):
|
|
|
|
for outdir in self._possible_outdirs(options):
|
|
|
|
try:
|
2020-09-30 12:07:31 +00:00
|
|
|
self.build_config = _do_load_build_config(outdir, options.verbose)
|
|
|
|
|
|
|
|
# In auto-detect mode the outdir is always where we found the build config.
|
|
|
|
# This ensures that we'll also take the build products from there.
|
|
|
|
self.outdir = outdir
|
|
|
|
break
|
2017-10-26 14:20:26 +00:00
|
|
|
except TestRunnerError:
|
|
|
|
pass
|
2017-10-25 09:59:54 +00:00
|
|
|
|
2017-12-22 15:30:32 +00:00
|
|
|
if not self.build_config: # pragma: no cover
|
2019-02-18 14:01:33 +00:00
|
|
|
print('Failed to load build config')
|
2017-10-26 14:20:26 +00:00
|
|
|
raise TestRunnerError
|
|
|
|
|
2019-02-18 14:01:33 +00:00
|
|
|
print('Build found: %s' % self.outdir)
|
2017-11-07 12:47:41 +00:00
|
|
|
if str(self.build_config):
|
2019-02-18 14:01:33 +00:00
|
|
|
print('>>> Autodetected:')
|
|
|
|
print(self.build_config)
|
2017-11-07 12:47:41 +00:00
|
|
|
|
2018-08-10 17:09:34 +00:00
|
|
|
# Represents the OS where tests are run on. Same as host OS except for
|
|
|
|
# Android, which is determined by build output.
|
|
|
|
if self.build_config.is_android:
|
|
|
|
self.target_os = 'android'
|
|
|
|
else:
|
|
|
|
self.target_os = utils.GuessOS()
|
|
|
|
|
2017-11-07 12:47:41 +00:00
|
|
|
# Returns possible build paths in order:
|
|
|
|
# gn
|
|
|
|
# outdir
|
2020-10-06 11:40:26 +00:00
|
|
|
# outdir on bots
|
2017-10-26 14:20:26 +00:00
|
|
|
def _possible_outdirs(self, options):
|
2017-11-07 12:47:41 +00:00
|
|
|
def outdirs():
|
|
|
|
if options.gn:
|
|
|
|
yield self._get_gn_outdir()
|
|
|
|
return
|
|
|
|
|
|
|
|
yield options.outdir
|
2020-09-30 12:12:13 +00:00
|
|
|
|
2020-10-06 11:40:26 +00:00
|
|
|
if os.path.basename(options.outdir) != 'build':
|
|
|
|
yield os.path.join(options.outdir, 'build')
|
2017-10-26 14:20:26 +00:00
|
|
|
|
2017-11-07 12:47:41 +00:00
|
|
|
for outdir in outdirs():
|
2017-12-22 15:30:32 +00:00
|
|
|
yield os.path.join(self.basedir, outdir)
|
2017-11-07 12:47:41 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
def _get_gn_outdir(self):
|
2017-12-22 15:30:32 +00:00
|
|
|
gn_out_dir = os.path.join(self.basedir, DEFAULT_OUT_GN)
|
2017-10-16 14:24:43 +00:00
|
|
|
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 os.path.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:
|
|
|
|
print(">>> Latest GN build found: %s" % latest_config)
|
|
|
|
return os.path.join(DEFAULT_OUT_GN, latest_config)
|
|
|
|
|
2017-10-26 14:20:26 +00:00
|
|
|
def _process_default_options(self, options):
|
2020-10-06 11:40:26 +00:00
|
|
|
if self.build_config.is_debug:
|
|
|
|
self.mode_options = DEBUG_MODE
|
2021-07-27 06:41:14 +00:00
|
|
|
elif self.build_config.dcheck_always_on:
|
2020-10-06 11:40:26 +00:00
|
|
|
self.mode_options = TRY_RELEASE_MODE
|
2017-10-26 14:20:26 +00:00
|
|
|
else:
|
2020-10-06 11:40:26 +00:00
|
|
|
self.mode_options = RELEASE_MODE
|
2017-10-26 14:20:26 +00:00
|
|
|
|
|
|
|
if options.arch and options.arch != self.build_config.arch:
|
|
|
|
print('--arch value (%s) inconsistent with build config (%s).' % (
|
|
|
|
options.arch, self.build_config.arch))
|
|
|
|
raise TestRunnerError()
|
|
|
|
|
2017-12-22 15:30:32 +00:00
|
|
|
if options.shell_dir: # pragma: no cover
|
2017-11-02 18:59:38 +00:00
|
|
|
print('Warning: --shell-dir is deprecated. Searching for executables in '
|
|
|
|
'build directory (%s) instead.' % self.outdir)
|
2017-10-16 14:24:43 +00:00
|
|
|
|
2018-02-02 22:46:27 +00:00
|
|
|
if options.j == 0:
|
2018-08-10 17:09:34 +00:00
|
|
|
if self.build_config.is_android:
|
|
|
|
# Adb isn't happy about multi-processed file pushing.
|
|
|
|
options.j = 1
|
|
|
|
else:
|
|
|
|
options.j = multiprocessing.cpu_count()
|
2018-02-02 22:46:27 +00:00
|
|
|
|
2018-01-31 12:01:49 +00:00
|
|
|
options.command_prefix = shlex.split(options.command_prefix)
|
2021-09-29 14:45:12 +00:00
|
|
|
options.extra_flags = sum(list(map(shlex.split, options.extra_flags)), [])
|
2018-01-31 12:01:49 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
def _process_options(self, options):
|
|
|
|
pass
|
2017-10-13 08:13:39 +00:00
|
|
|
|
2017-10-25 11:42:29 +00:00
|
|
|
def _setup_env(self):
|
|
|
|
# Use the v8 root as cwd as some test cases use "load" with relative paths.
|
2017-12-22 15:30:32 +00:00
|
|
|
os.chdir(self.basedir)
|
2017-10-25 11:42:29 +00:00
|
|
|
|
|
|
|
# Many tests assume an English interface.
|
|
|
|
os.environ['LANG'] = 'en_US.UTF-8'
|
|
|
|
|
|
|
|
symbolizer_option = self._get_external_symbolizer_option()
|
|
|
|
|
|
|
|
if self.build_config.asan:
|
2017-11-07 12:27:22 +00:00
|
|
|
asan_options = [
|
|
|
|
symbolizer_option,
|
|
|
|
'allow_user_segv_handler=1',
|
|
|
|
'allocator_may_return_null=1',
|
|
|
|
]
|
2017-10-25 11:42:29 +00:00
|
|
|
if not utils.GuessOS() in ['macos', 'windows']:
|
|
|
|
# LSAN is not available on mac and windows.
|
|
|
|
asan_options.append('detect_leaks=1')
|
2017-11-07 12:27:22 +00:00
|
|
|
else:
|
|
|
|
asan_options.append('detect_leaks=0')
|
2019-05-31 11:13:59 +00:00
|
|
|
if utils.GuessOS() == 'windows':
|
|
|
|
# https://crbug.com/967663
|
|
|
|
asan_options.append('detect_stack_use_after_return=0')
|
2017-10-25 11:42:29 +00:00
|
|
|
os.environ['ASAN_OPTIONS'] = ":".join(asan_options)
|
|
|
|
|
|
|
|
if self.build_config.cfi_vptr:
|
|
|
|
os.environ['UBSAN_OPTIONS'] = ":".join([
|
|
|
|
'print_stacktrace=1',
|
|
|
|
'print_summary=1',
|
|
|
|
'symbolize=1',
|
|
|
|
symbolizer_option,
|
|
|
|
])
|
|
|
|
|
|
|
|
if self.build_config.ubsan_vptr:
|
|
|
|
os.environ['UBSAN_OPTIONS'] = ":".join([
|
|
|
|
'print_stacktrace=1',
|
|
|
|
symbolizer_option,
|
|
|
|
])
|
|
|
|
|
|
|
|
if self.build_config.msan:
|
|
|
|
os.environ['MSAN_OPTIONS'] = symbolizer_option
|
|
|
|
|
|
|
|
if self.build_config.tsan:
|
|
|
|
suppressions_file = os.path.join(
|
2017-12-22 15:30:32 +00:00
|
|
|
self.basedir,
|
2017-10-25 11:42:29 +00:00
|
|
|
'tools',
|
|
|
|
'sanitizers',
|
|
|
|
'tsan_suppressions.txt')
|
|
|
|
os.environ['TSAN_OPTIONS'] = " ".join([
|
|
|
|
symbolizer_option,
|
|
|
|
'suppressions=%s' % suppressions_file,
|
|
|
|
'exit_code=0',
|
|
|
|
'report_thread_leaks=0',
|
|
|
|
'history_size=7',
|
|
|
|
'report_destroy_locked=0',
|
|
|
|
])
|
|
|
|
|
|
|
|
def _get_external_symbolizer_option(self):
|
|
|
|
external_symbolizer_path = os.path.join(
|
2017-12-22 15:30:32 +00:00
|
|
|
self.basedir,
|
2017-10-25 11:42:29 +00:00
|
|
|
'third_party',
|
|
|
|
'llvm-build',
|
|
|
|
'Release+Asserts',
|
|
|
|
'bin',
|
|
|
|
'llvm-symbolizer',
|
|
|
|
)
|
|
|
|
|
|
|
|
if utils.IsWindows():
|
|
|
|
# Quote, because sanitizers might confuse colon as option separator.
|
|
|
|
external_symbolizer_path = '"%s.exe"' % external_symbolizer_path
|
|
|
|
|
|
|
|
return 'external_symbolizer_path=%s' % external_symbolizer_path
|
|
|
|
|
2018-01-17 10:00:28 +00:00
|
|
|
def _parse_test_args(self, args):
|
2018-01-15 17:49:16 +00:00
|
|
|
if not args:
|
|
|
|
args = self._get_default_suite_names()
|
|
|
|
|
|
|
|
# Expand arguments with grouped tests. The args should reflect the list
|
|
|
|
# of suites as otherwise filters would break.
|
|
|
|
def expand_test_group(name):
|
|
|
|
return TEST_MAP.get(name, [name])
|
|
|
|
|
2021-09-29 14:45:12 +00:00
|
|
|
return reduce(list.__add__, list(map(expand_test_group, args)), [])
|
2018-01-15 17:49:16 +00:00
|
|
|
|
2018-05-25 13:22:03 +00:00
|
|
|
def _args_to_suite_names(self, args, test_root):
|
2018-01-17 10:00:28 +00:00
|
|
|
# Use default tests if no test configuration was provided at the cmd line.
|
2018-05-25 13:22:03 +00:00
|
|
|
all_names = set(utils.GetSuitePaths(test_root))
|
2018-01-15 17:49:16 +00:00
|
|
|
args_names = OrderedDict([(arg.split('/')[0], None) for arg in args]) # set
|
|
|
|
return [name for name in args_names if name in all_names]
|
|
|
|
|
|
|
|
def _get_default_suite_names(self):
|
|
|
|
return []
|
|
|
|
|
2019-01-15 10:43:02 +00:00
|
|
|
def _load_testsuite_generators(self, args, options):
|
2019-01-11 11:29:15 +00:00
|
|
|
names = self._args_to_suite_names(args, options.test_root)
|
2018-01-31 09:18:13 +00:00
|
|
|
test_config = self._create_test_config(options)
|
2019-01-11 11:29:15 +00:00
|
|
|
variables = self._get_statusfile_variables(options)
|
2019-02-12 15:30:16 +00:00
|
|
|
|
|
|
|
# Head generator with no elements
|
|
|
|
test_chain = testsuite.TestGenerator(0, [], [])
|
2019-01-11 11:29:15 +00:00
|
|
|
for name in names:
|
2018-01-31 09:18:13 +00:00
|
|
|
if options.verbose:
|
2019-02-18 14:01:33 +00:00
|
|
|
print('>>> Loading test suite: %s' % name)
|
2019-01-11 11:29:15 +00:00
|
|
|
suite = testsuite.TestSuite.Load(
|
2019-04-12 11:46:38 +00:00
|
|
|
os.path.join(options.test_root, name), test_config,
|
|
|
|
self.framework_name)
|
2019-01-11 11:29:15 +00:00
|
|
|
|
|
|
|
if self._is_testsuite_supported(suite, options):
|
2019-02-12 15:30:16 +00:00
|
|
|
tests = suite.load_tests_from_disk(variables)
|
|
|
|
test_chain.merge(tests)
|
2019-01-15 10:43:02 +00:00
|
|
|
|
2019-02-12 15:30:16 +00:00
|
|
|
return test_chain
|
2019-01-11 11:29:15 +00:00
|
|
|
|
|
|
|
def _is_testsuite_supported(self, suite, options):
|
|
|
|
"""A predicate that can be overridden to filter out unsupported TestSuite
|
|
|
|
instances (see NumFuzzer for usage)."""
|
|
|
|
return True
|
2018-02-01 14:55:53 +00:00
|
|
|
|
|
|
|
def _get_statusfile_variables(self, options):
|
|
|
|
simd_mips = (
|
|
|
|
self.build_config.arch in ['mipsel', 'mips', 'mips64', 'mips64el'] and
|
|
|
|
self.build_config.mips_arch_variant == "r6" and
|
|
|
|
self.build_config.mips_use_msa)
|
|
|
|
|
2018-02-28 14:25:35 +00:00
|
|
|
mips_arch_variant = (
|
|
|
|
self.build_config.arch in ['mipsel', 'mips', 'mips64', 'mips64el'] and
|
|
|
|
self.build_config.mips_arch_variant)
|
|
|
|
|
2021-04-22 23:38:28 +00:00
|
|
|
no_simd_hardware = any(
|
2021-02-11 21:27:37 +00:00
|
|
|
i in options.extra_flags for i in ['--noenable-sse3',
|
2022-01-07 15:14:04 +00:00
|
|
|
'--no-enable-sse3',
|
2021-02-11 21:27:37 +00:00
|
|
|
'--noenable-ssse3',
|
|
|
|
'--no-enable-ssse3',
|
|
|
|
'--noenable-sse4-1',
|
|
|
|
'--no-enable-sse4_1'])
|
|
|
|
|
2021-04-22 23:38:28 +00:00
|
|
|
# Set no_simd_hardware on architectures without Simd enabled.
|
2021-02-26 01:18:43 +00:00
|
|
|
if self.build_config.arch == 'mips64el' or \
|
|
|
|
self.build_config.arch == 'mipsel':
|
2021-04-22 23:38:28 +00:00
|
|
|
no_simd_hardware = not simd_mips
|
2021-02-26 01:18:43 +00:00
|
|
|
|
2021-08-11 11:54:59 +00:00
|
|
|
if self.build_config.arch == 'loong64':
|
|
|
|
no_simd_hardware = True
|
|
|
|
|
2021-06-25 13:04:42 +00:00
|
|
|
# S390 hosts without VEF1 do not support Simd.
|
|
|
|
if self.build_config.arch == 's390x' and \
|
|
|
|
not self.build_config.simulator_run and \
|
|
|
|
not utils.IsS390SimdSupported():
|
|
|
|
no_simd_hardware = True
|
|
|
|
|
2021-04-28 19:48:41 +00:00
|
|
|
# Ppc64 processors earlier than POWER9 do not support Simd instructions
|
|
|
|
if self.build_config.arch == 'ppc64' and \
|
|
|
|
not self.build_config.simulator_run and \
|
|
|
|
utils.GuessPowerProcessorVersion() < 9:
|
|
|
|
no_simd_hardware = True
|
|
|
|
|
2018-02-01 14:55:53 +00:00
|
|
|
return {
|
|
|
|
"arch": self.build_config.arch,
|
|
|
|
"asan": self.build_config.asan,
|
|
|
|
"byteorder": sys.byteorder,
|
2020-06-24 19:08:38 +00:00
|
|
|
"cfi_vptr": self.build_config.cfi_vptr,
|
2021-02-12 13:45:47 +00:00
|
|
|
"control_flow_integrity": self.build_config.control_flow_integrity,
|
2020-09-28 17:49:52 +00:00
|
|
|
"concurrent_marking": self.build_config.concurrent_marking,
|
2021-04-21 00:32:15 +00:00
|
|
|
"single_generation": self.build_config.single_generation,
|
2021-07-27 06:41:14 +00:00
|
|
|
"dcheck_always_on": self.build_config.dcheck_always_on,
|
2018-02-01 14:55:53 +00:00
|
|
|
"deopt_fuzzer": False,
|
2018-02-02 12:51:25 +00:00
|
|
|
"endurance_fuzzer": False,
|
2018-02-01 14:55:53 +00:00
|
|
|
"gc_fuzzer": False,
|
|
|
|
"gc_stress": False,
|
|
|
|
"gcov_coverage": self.build_config.gcov_coverage,
|
2021-02-23 12:43:57 +00:00
|
|
|
"has_webassembly": self.build_config.webassembly,
|
2018-02-01 14:55:53 +00:00
|
|
|
"isolates": options.isolates,
|
2019-02-27 13:36:17 +00:00
|
|
|
"is_clang": self.build_config.is_clang,
|
2019-05-07 12:07:59 +00:00
|
|
|
"is_full_debug": self.build_config.is_full_debug,
|
2018-02-28 14:25:35 +00:00
|
|
|
"mips_arch_variant": mips_arch_variant,
|
2020-10-06 11:40:26 +00:00
|
|
|
"mode": self.mode_options.status_mode,
|
2018-02-01 14:55:53 +00:00
|
|
|
"msan": self.build_config.msan,
|
|
|
|
"no_harness": options.no_harness,
|
|
|
|
"no_i18n": self.build_config.no_i18n,
|
2021-04-22 23:38:28 +00:00
|
|
|
"no_simd_hardware": no_simd_hardware,
|
2018-02-01 14:55:53 +00:00
|
|
|
"novfp3": False,
|
2018-11-09 11:57:29 +00:00
|
|
|
"optimize_for_size": "--optimize-for-size" in options.extra_flags,
|
2018-02-01 14:55:53 +00:00
|
|
|
"predictable": self.build_config.predictable,
|
|
|
|
"simd_mips": simd_mips,
|
2020-09-07 12:14:41 +00:00
|
|
|
"simulator_run": self.build_config.simulator_run and
|
|
|
|
not options.dont_skip_simulator_slow_tests,
|
2018-08-10 17:09:34 +00:00
|
|
|
"system": self.target_os,
|
2021-04-14 14:09:35 +00:00
|
|
|
"third_party_heap": self.build_config.third_party_heap,
|
2018-02-01 14:55:53 +00:00
|
|
|
"tsan": self.build_config.tsan,
|
|
|
|
"ubsan_vptr": self.build_config.ubsan_vptr,
|
2018-10-16 08:22:23 +00:00
|
|
|
"verify_csa": self.build_config.verify_csa,
|
2018-10-19 13:34:53 +00:00
|
|
|
"lite_mode": self.build_config.lite_mode,
|
2018-12-19 16:21:38 +00:00
|
|
|
"pointer_compression": self.build_config.pointer_compression,
|
2021-04-10 02:09:41 +00:00
|
|
|
"pointer_compression_shared_cage": self.build_config.pointer_compression_shared_cage,
|
V8 Sandbox rebranding
This CL renames a number of things related to the V8 sandbox.
Mainly, what used to be under V8_HEAP_SANDBOX is now under
V8_SANDBOXED_EXTERNAL_POINTERS, while the previous V8 VirtualMemoryCage
is now simply the V8 Sandbox:
V8_VIRTUAL_MEMORY_CAGE => V8_SANDBOX
V8_HEAP_SANDBOX => V8_SANDBOXED_EXTERNAL_POINTERS
V8_CAGED_POINTERS => V8_SANDBOXED_POINTERS
V8VirtualMemoryCage => Sandbox
CagedPointer => SandboxedPointer
fake cage => partially reserved sandbox
src/security => src/sandbox
This naming scheme should simplify things: the sandbox is now the large
region of virtual address space inside which V8 mainly operates and
which should be considered untrusted. Mechanisms like sandboxed pointers
are then used to attempt to prevent escapes from the sandbox (i.e.
corruption of memory outside of it). Furthermore, the new naming scheme
avoids the confusion with the various other "cages" in V8, in
particular, the VirtualMemoryCage class, by dropping that name entirely.
Future sandbox features are developed under their own V8_SANDBOX_X flag,
and will, once final, be merged into V8_SANDBOX. Current future features
are sandboxed external pointers (using the external pointer table), and
sandboxed pointers (pointers guaranteed to point into the sandbox, e.g.
because they are encoded as offsets). This CL then also introduces a new
build flag, v8_enable_sandbox_future, which enables all future features.
Bug: v8:10391
Change-Id: I5174ea8f5ab40fb96a04af10853da735ad775c96
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3322981
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78384}
2021-12-15 13:39:15 +00:00
|
|
|
"sandbox": self.build_config.sandbox,
|
2021-10-19 10:09:41 +00:00
|
|
|
"dict_property_const_tracking": self.build_config.dict_property_const_tracking,
|
2018-02-01 14:55:53 +00:00
|
|
|
}
|
|
|
|
|
2020-02-19 13:52:16 +00:00
|
|
|
def _runner_flags(self):
|
|
|
|
"""Extra default flags specific to the test runner implementation."""
|
|
|
|
return []
|
|
|
|
|
2018-01-31 09:18:13 +00:00
|
|
|
def _create_test_config(self, options):
|
2018-01-31 12:01:49 +00:00
|
|
|
timeout = options.timeout * self._timeout_scalefactor(options)
|
|
|
|
return TestConfig(
|
|
|
|
command_prefix=options.command_prefix,
|
|
|
|
extra_flags=options.extra_flags,
|
|
|
|
isolates=options.isolates,
|
2020-02-19 13:52:16 +00:00
|
|
|
mode_flags=self.mode_options.flags + self._runner_flags(),
|
2018-01-31 12:01:49 +00:00
|
|
|
no_harness=options.no_harness,
|
|
|
|
noi18n=self.build_config.no_i18n,
|
|
|
|
random_seed=options.random_seed,
|
2018-11-22 07:33:45 +00:00
|
|
|
run_skipped=options.run_skipped,
|
2018-01-31 12:01:49 +00:00
|
|
|
shell_dir=self.outdir,
|
|
|
|
timeout=timeout,
|
|
|
|
verbose=options.verbose,
|
2020-03-03 18:04:10 +00:00
|
|
|
regenerate_expected_files=options.regenerate_expected_files,
|
2018-01-31 12:01:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def _timeout_scalefactor(self, options):
|
2019-05-02 07:05:43 +00:00
|
|
|
"""Increases timeout for slow build configurations."""
|
2018-01-31 12:01:49 +00:00
|
|
|
factor = self.mode_options.timeout_scalefactor
|
|
|
|
if self.build_config.arch in SLOW_ARCHS:
|
2019-11-27 09:20:01 +00:00
|
|
|
factor *= 4.5
|
2019-05-02 07:05:43 +00:00
|
|
|
if self.build_config.lite_mode:
|
2018-01-31 12:01:49 +00:00
|
|
|
factor *= 2
|
|
|
|
if self.build_config.predictable:
|
2019-05-07 12:07:59 +00:00
|
|
|
factor *= 4
|
2021-05-18 11:09:23 +00:00
|
|
|
if self.build_config.tsan:
|
2021-06-22 17:02:06 +00:00
|
|
|
factor *= 2
|
2019-05-02 07:05:43 +00:00
|
|
|
if self.build_config.use_sanitizer:
|
|
|
|
factor *= 1.5
|
2019-05-06 13:18:59 +00:00
|
|
|
if self.build_config.is_full_debug:
|
2019-05-07 12:07:59 +00:00
|
|
|
factor *= 4
|
2018-01-31 12:01:49 +00:00
|
|
|
|
|
|
|
return factor
|
2018-01-31 09:18:13 +00:00
|
|
|
|
2017-10-16 14:24:43 +00:00
|
|
|
# TODO(majeski): remove options & args parameters
|
2018-01-15 17:49:16 +00:00
|
|
|
def _do_execute(self, suites, args, options):
|
2017-10-13 08:13:39 +00:00
|
|
|
raise NotImplementedError()
|
2018-01-17 13:52:47 +00:00
|
|
|
|
2018-02-02 22:46:27 +00:00
|
|
|
def _prepare_procs(self, procs):
|
2021-09-29 14:45:12 +00:00
|
|
|
procs = list([_f for _f in procs if _f])
|
2019-02-18 14:01:33 +00:00
|
|
|
for i in range(0, len(procs) - 1):
|
2018-02-02 22:46:27 +00:00
|
|
|
procs[i].connect_to(procs[i + 1])
|
|
|
|
procs[0].setup()
|
|
|
|
|
2018-01-17 13:52:47 +00:00
|
|
|
def _create_shard_proc(self, options):
|
|
|
|
myid, count = self._get_shard_info(options)
|
|
|
|
if count == 1:
|
|
|
|
return None
|
|
|
|
return ShardProc(myid - 1, count)
|
|
|
|
|
|
|
|
def _get_shard_info(self, options):
|
|
|
|
"""
|
|
|
|
Returns pair:
|
|
|
|
(id of the current shard [1; number of shards], number of shards)
|
|
|
|
"""
|
|
|
|
# Read gtest shard configuration from environment (e.g. set by swarming).
|
|
|
|
# If none is present, use values passed on the command line.
|
|
|
|
shard_count = int(
|
|
|
|
os.environ.get('GTEST_TOTAL_SHARDS', options.shard_count))
|
|
|
|
shard_run = os.environ.get('GTEST_SHARD_INDEX')
|
|
|
|
if shard_run is not None:
|
|
|
|
# The v8 shard_run starts at 1, while GTEST_SHARD_INDEX starts at 0.
|
|
|
|
shard_run = int(shard_run) + 1
|
|
|
|
else:
|
|
|
|
shard_run = options.shard_run
|
|
|
|
|
|
|
|
if options.shard_count > 1:
|
|
|
|
# Log if a value was passed on the cmd line and it differs from the
|
|
|
|
# environment variables.
|
|
|
|
if options.shard_count != shard_count: # pragma: no cover
|
|
|
|
print("shard_count from cmd line differs from environment variable "
|
|
|
|
"GTEST_TOTAL_SHARDS")
|
|
|
|
if (options.shard_run > 1 and
|
|
|
|
options.shard_run != shard_run): # pragma: no cover
|
|
|
|
print("shard_run from cmd line differs from environment variable "
|
|
|
|
"GTEST_SHARD_INDEX")
|
|
|
|
|
|
|
|
if shard_run < 1 or shard_run > shard_count:
|
|
|
|
# TODO(machenbach): Turn this into an assert. If that's wrong on the
|
|
|
|
# bots, printing will be quite useless. Or refactor this code to make
|
|
|
|
# sure we get a return code != 0 after testing if we got here.
|
2019-02-18 14:01:33 +00:00
|
|
|
print("shard-run not a valid number, should be in [1:shard-count]")
|
|
|
|
print("defaulting back to running all tests")
|
2018-01-17 13:52:47 +00:00
|
|
|
return 1, 1
|
|
|
|
|
|
|
|
return shard_run, shard_count
|
2018-01-31 09:18:13 +00:00
|
|
|
|
2019-02-12 15:30:16 +00:00
|
|
|
def _create_progress_indicators(self, test_count, options):
|
2018-02-01 12:53:25 +00:00
|
|
|
procs = [PROGRESS_INDICATORS[options.progress]()]
|
|
|
|
if options.json_test_results:
|
2020-10-07 16:43:41 +00:00
|
|
|
procs.append(progress.JsonTestProgressIndicator(self.framework_name))
|
2019-02-12 15:30:16 +00:00
|
|
|
|
2019-09-17 10:24:30 +00:00
|
|
|
for proc in procs:
|
|
|
|
proc.configure(options)
|
|
|
|
|
2019-02-12 15:30:16 +00:00
|
|
|
for proc in procs:
|
|
|
|
try:
|
|
|
|
proc.set_test_count(test_count)
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
|
|
|
|
2018-02-01 12:53:25 +00:00
|
|
|
return procs
|
|
|
|
|
2018-10-02 13:31:32 +00:00
|
|
|
def _create_result_tracker(self, options):
|
|
|
|
return progress.ResultsTracker(options.exit_after_n_failures)
|
|
|
|
|
2018-01-31 09:18:13 +00:00
|
|
|
def _create_timeout_proc(self, options):
|
|
|
|
if not options.total_timeout_sec:
|
|
|
|
return None
|
|
|
|
return TimeoutProc(options.total_timeout_sec)
|
2018-01-31 10:21:44 +00:00
|
|
|
|
|
|
|
def _create_signal_proc(self):
|
|
|
|
return SignalProc()
|
2018-01-31 13:56:01 +00:00
|
|
|
|
|
|
|
def _create_rerun_proc(self, options):
|
|
|
|
if not options.rerun_failures_count:
|
|
|
|
return None
|
|
|
|
return RerunProc(options.rerun_failures_count,
|
|
|
|
options.rerun_failures_max)
|