diff options
Diffstat (limited to 'deps/v8/tools/testrunner/local')
-rw-r--r-- | deps/v8/tools/testrunner/local/command.py | 63 | ||||
-rw-r--r-- | deps/v8/tools/testrunner/local/statusfile.py | 13 | ||||
-rw-r--r-- | deps/v8/tools/testrunner/local/testsuite.py | 17 | ||||
-rwxr-xr-x | deps/v8/tools/testrunner/local/testsuite_test.py | 6 | ||||
-rw-r--r-- | deps/v8/tools/testrunner/local/variants.py | 137 |
5 files changed, 170 insertions, 66 deletions
diff --git a/deps/v8/tools/testrunner/local/command.py b/deps/v8/tools/testrunner/local/command.py index e0ef281b4c..af0981e83d 100644 --- a/deps/v8/tools/testrunner/local/command.py +++ b/deps/v8/tools/testrunner/local/command.py @@ -71,7 +71,7 @@ def handle_sigterm(process, abort_fun, enabled): class BaseCommand(object): def __init__(self, shell, args=None, cmd_prefix=None, timeout=60, env=None, - verbose=False, resources_func=None, handle_sigterm=False): + verbose=False, test_case=None, handle_sigterm=False): """Initialize the command. Args: @@ -81,7 +81,7 @@ class BaseCommand(object): timeout: Timeout in seconds. env: Environment dict for execution. verbose: Print additional output. - resources_func: Callable, returning all test files needed by this command. + test_case: Test case reference. handle_sigterm: Flag indicating if SIGTERM will be used to terminate the underlying process. Should not be used from the main thread, e.g. when using a command to list tests. @@ -268,29 +268,21 @@ class AndroidCommand(BaseCommand): driver = None def __init__(self, shell, args=None, cmd_prefix=None, timeout=60, env=None, - verbose=False, resources_func=None, handle_sigterm=False): + verbose=False, test_case=None, handle_sigterm=False): """Initialize the command and all files that need to be pushed to the Android device. """ - self.shell_name = os.path.basename(shell) - self.shell_dir = os.path.dirname(shell) - self.files_to_push = (resources_func or (lambda: []))() - - # Make all paths in arguments relative and also prepare files from arguments - # for pushing to the device. - rel_args = [] - find_path_re = re.compile(r'.*(%s/[^\'"]+).*' % re.escape(BASE_DIR)) - for arg in (args or []): - match = find_path_re.match(arg) - if match: - self.files_to_push.append(match.group(1)) - rel_args.append( - re.sub(r'(.*)%s/(.*)' % re.escape(BASE_DIR), r'\1\2', arg)) - super(AndroidCommand, self).__init__( - shell, args=rel_args, cmd_prefix=cmd_prefix, timeout=timeout, env=env, + shell, args=args, cmd_prefix=cmd_prefix, timeout=timeout, env=env, verbose=verbose, handle_sigterm=handle_sigterm) + rel_args, files_from_args = args_with_relative_paths(args) + + self.args = rel_args + + test_case_resources = test_case.get_android_resources() if test_case else [] + self.files_to_push = test_case_resources + files_from_args + def execute(self, **additional_popen_kwargs): """Execute the command on the device. @@ -299,20 +291,18 @@ class AndroidCommand(BaseCommand): if self.verbose: print('# %s' % self) - self.driver.push_executable(self.shell_dir, 'bin', self.shell_name) + shell_name = os.path.basename(self.shell) + shell_dir = os.path.dirname(self.shell) - for abs_file in self.files_to_push: - abs_dir = os.path.dirname(abs_file) - file_name = os.path.basename(abs_file) - rel_dir = os.path.relpath(abs_dir, BASE_DIR) - self.driver.push_file(abs_dir, file_name, rel_dir) + self.driver.push_executable(shell_dir, 'bin', shell_name) + self.push_test_resources() start_time = time.time() return_code = 0 timed_out = False try: stdout = self.driver.run( - 'bin', self.shell_name, self.args, '.', self.timeout, self.env) + 'bin', shell_name, self.args, '.', self.timeout, self.env) except CommandFailedException as e: return_code = e.status stdout = e.output @@ -332,6 +322,27 @@ class AndroidCommand(BaseCommand): duration, ) + def push_test_resources(self): + for abs_file in self.files_to_push: + abs_dir = os.path.dirname(abs_file) + file_name = os.path.basename(abs_file) + rel_dir = os.path.relpath(abs_dir, BASE_DIR) + self.driver.push_file(abs_dir, file_name, rel_dir) + + +def args_with_relative_paths(args): + rel_args = [] + files_to_push = [] + find_path_re = re.compile(r'.*(%s/[^\'"]+).*' % re.escape(BASE_DIR)) + for arg in (args or []): + match = find_path_re.match(arg) + if match: + files_to_push.append(match.group(1)) + rel_args.append( + re.sub(r'(.*)%s/(.*)' % re.escape(BASE_DIR), r'\1\2', arg)) + return rel_args, files_to_push + + Command = None diff --git a/deps/v8/tools/testrunner/local/statusfile.py b/deps/v8/tools/testrunner/local/statusfile.py index 5f9766e85c..04485936b6 100644 --- a/deps/v8/tools/testrunner/local/statusfile.py +++ b/deps/v8/tools/testrunner/local/statusfile.py @@ -63,10 +63,12 @@ for var in [ "windows", "linux", "aix", "r1", "r2", "r3", "r5", "r6", "riscv32", "riscv64", "loong64" ]: + assert var not in VARIABLES VARIABLES[var] = var # Allow using variants as keywords. for var in ALL_VARIANTS: + assert var not in VARIABLES VARIABLES[var] = var class StatusFile(object): @@ -244,7 +246,16 @@ def ReadStatusFile(content, variables): prefix_rules = {variant: {} for variant in ALL_VARIANTS} prefix_rules[""] = {} - variables.update(VARIABLES) + # This method can be called with the same `variables` object multiple times. + # Ensure we only update `variables` (and check it for consistency) once. + if ALWAYS not in variables: + # Ensure we don't silently overwrite any build variables with our set of + # default keywords in VARIABLES. + for var in VARIABLES: + assert var not in variables, ( + "build_config variable '%s' conflicts with VARIABLES" % var) + variables.update(VARIABLES) + for conditional_section in ReadContent(content): assert type(conditional_section) == list assert len(conditional_section) == 2 diff --git a/deps/v8/tools/testrunner/local/testsuite.py b/deps/v8/tools/testrunner/local/testsuite.py index 8130841e40..60d52e8d30 100644 --- a/deps/v8/tools/testrunner/local/testsuite.py +++ b/deps/v8/tools/testrunner/local/testsuite.py @@ -115,8 +115,7 @@ class TestLoader(object): def _create_test(self, path, suite, **kwargs): """Converts paths into test objects using the given options""" - return self.test_class( - suite, path, self._path_to_name(path), self.test_config, **kwargs) + return self.test_class(suite, path, self._path_to_name(path), **kwargs) def list_tests(self): """Loads and returns the test objects for a TestSuite""" @@ -247,25 +246,31 @@ def _load_testsuite_module(name, root): class TestSuite(object): @staticmethod - def Load(ctx, root, test_config, framework_name): + def Load(ctx, root, test_config): name = root.split(os.path.sep)[-1] with _load_testsuite_module(name, root) as module: - return module.TestSuite(ctx, name, root, test_config, framework_name) + return module.TestSuite(ctx, name, root, test_config) - def __init__(self, ctx, name, root, test_config, framework_name): + def __init__(self, ctx, name, root, test_config): self.name = name # string self.root = root # string containing path self.test_config = test_config - self.framework_name = framework_name # name of the test runner impl self.tests = None # list of TestCase objects self.statusfile = None self._test_loader = self._test_loader_class()(ctx, self, self._test_class(), self.test_config, self.root) + @property + def framework_name(self): + return self.test_config.framework_name + def status_file(self): return "%s/%s.status" % (self.root, self.name) + def statusfile_outcomes(self, test_name, variant): + return self.statusfile.get_outcomes(test_name, variant) + @property def _test_loader_class(self): raise NotImplementedError diff --git a/deps/v8/tools/testrunner/local/testsuite_test.py b/deps/v8/tools/testrunner/local/testsuite_test.py index fa7374218b..e2c34a55ee 100755 --- a/deps/v8/tools/testrunner/local/testsuite_test.py +++ b/deps/v8/tools/testrunner/local/testsuite_test.py @@ -26,20 +26,22 @@ class TestSuiteTest(unittest.TestCase): self.test_config = TestConfig( command_prefix=[], extra_flags=[], + framework_name='standard_runner', isolates=False, mode_flags=[], no_harness=False, noi18n=False, random_seed=0, run_skipped=False, + shard_count=1, + shard_id=0, shell_dir='fake_testsuite/fake_d8', timeout=10, verbose=False, ) self.suite = TestSuite.Load( - DefaultOSContext(PosixCommand), self.test_root, self.test_config, - "standard_runner") + DefaultOSContext(PosixCommand), self.test_root, self.test_config) def testLoadingTestSuites(self): self.assertEqual(self.suite.name, "fake_testsuite") diff --git a/deps/v8/tools/testrunner/local/variants.py b/deps/v8/tools/testrunner/local/variants.py index f44e445eca..e5344a4880 100644 --- a/deps/v8/tools/testrunner/local/variants.py +++ b/deps/v8/tools/testrunner/local/variants.py @@ -16,7 +16,11 @@ ALL_VARIANT_FLAGS = { "jitless": [["--jitless"]], "sparkplug": [["--sparkplug"]], "maglev": [["--maglev"]], - "stress_maglev": [["--maglev", "--stress-maglev"]], + "maglev_future": [["--maglev", "--maglev-future"]], + "stress_maglev": [[ + "--maglev", "--stress-maglev", + "--optimize-on-next-call-optimizes-to-maglev" + ]], "turboshaft": [["--turboshaft"]], "concurrent_sparkplug": [["--concurrent-sparkplug", "--sparkplug"]], "always_sparkplug": [["--always-sparkplug", "--sparkplug"]], @@ -27,8 +31,14 @@ ALL_VARIANT_FLAGS = { # https://chromium-review.googlesource.com/c/452620/ for more discussion. # For WebAssembly, we test "Liftoff-only" in the nooptimization variant and # "TurboFan-only" in the stress variant. The WebAssembly configuration is - # independent of JS optimizations, so we can combine those configs. - "nooptimization": [["--no-turbofan", "--liftoff", "--no-wasm-tier-up"]], + # independent of JS optimizations, so we can combine those configs. We + # disable lazy compilation to have one test variant that tests eager + # compilation. "Liftoff-only" and eager compilation is not a problem, + # because test functions do typically not get optimized to TurboFan anyways. + "nooptimization": [[ + "--no-turbofan", "--liftoff", "--no-wasm-tier-up", + "--no-wasm-lazy-compilation" + ]], "slow_path": [["--force-slow-path"]], "stress": [[ "--no-liftoff", "--stress-lazy-source-positions", @@ -47,27 +57,40 @@ ALL_VARIANT_FLAGS = { "instruction_scheduling": [["--turbo-instruction-scheduling"]], "stress_instruction_scheduling": [["--turbo-stress-instruction-scheduling"] ], - "wasm_write_protect_code": [["--wasm-write-protect-code-memory"]], # Google3 variants. "google3_icu": [[]], "google3_noicu": [[]], } +# Note these are specifically for the case when Turbofan is either fully +# disabled (i.e. not part of the binary), or when all codegen is disallowed (in +# jitless mode). +kIncompatibleFlagsForNoTurbofan = [ + "--turbofan", "--always-turbofan", "--liftoff", "--validate-asm", + "--maglev", "--stress-concurrent-inlining" +] + # Flags that lead to a contradiction with the flags provided by the respective # variant. This depends on the flags specified in ALL_VARIANT_FLAGS and on the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_VARIANT = { - "jitless": [ - "--turbofan", "--always-turbofan", "--liftoff", "--track-field-types", - "--validate-asm", "--sparkplug", "--concurrent-sparkplug", "--maglev", - "--always-sparkplug", "--regexp-tier-up", "--no-regexp-interpret-all" + "jitless": + kIncompatibleFlagsForNoTurbofan + [ + "--track-field-types", "--sparkplug", "--concurrent-sparkplug", + "--always-sparkplug", "--regexp-tier-up", + "--no-regexp-interpret-all", "--interpreted-frames-native-stack" + ], + "nooptimization": [ + "--turbofan", "--always-turbofan", "--stress-concurrent-inlining" ], - "nooptimization": ["--always-turbofan"], "slow_path": ["--no-force-slow-path"], - "stress_concurrent_allocation": ["--single-threaded-gc", "--predictable"], + "stress_concurrent_allocation": [ + "--single-threaded", "--single-threaded-gc", "--predictable" + ], "stress_concurrent_inlining": [ "--single-threaded", "--predictable", "--lazy-feedback-allocation", - "--assert-types", "--no-concurrent-recompilation" + "--assert-types", "--no-concurrent-recompilation", "--no-turbofan", + "--jitless" ], # The fast API tests initialize an embedder object that never needs to be # serialized to the snapshot, so we don't have a @@ -81,15 +104,13 @@ INCOMPATIBLE_FLAGS_PER_VARIANT = { "sparkplug": ["--jitless", "--no-sparkplug"], "concurrent_sparkplug": ["--jitless"], "maglev": ["--jitless", "--no-maglev"], + "maglev_future": ["--jitless", "--no-maglev", "--no-maglev-future"], "stress_maglev": ["--jitless"], "always_sparkplug": ["--jitless", "--no-sparkplug"], "code_serializer": [ "--cache=after-execute", "--cache=full-code-cache", "--cache=none" ], "experimental_regexp": ["--no-enable-experimental-regexp-engine"], - # There is a negative implication: --perf-prof disables - # --wasm-write-protect-code-memory. - "wasm_write_protect_code": ["--perf-prof"], "assert_types": [ "--concurrent-recompilation", "--stress_concurrent_inlining", "--no-assert-types" @@ -101,17 +122,65 @@ INCOMPATIBLE_FLAGS_PER_VARIANT = { # in _get_statusfile_variables in base_runner.py. # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. +# The keys of the following map support negation through '!', e.g. rule +# +# "!code_comments": [...] +# +# applies when the code_comments build variable is NOT set. INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE = { - "lite_mode": ["--no-lazy-feedback-allocation", "--max-semi-space-size=*", - "--stress-concurrent-inlining"] - + INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"], - "predictable": ["--parallel-compile-tasks-for-eager-toplevel", - "--parallel-compile-tasks-for-lazy", - "--concurrent-recompilation", - "--stress-concurrent-allocation", - "--stress-concurrent-inlining"], - "dict_property_const_tracking": [ - "--stress-concurrent-inlining"], + "!code_comments": ["--code-comments"], + "!is_DEBUG_defined": [ + "--check_handle_count", + "--code_stats", + "--dump_wasm_module", + "--enable_testing_opcode_in_wasm", + "--gc_verbose", + "--print_ast", + "--print_break_location", + "--print_global_handles", + "--print_handles", + "--print_scopes", + "--regexp_possessive_quantifier", + "--trace_backing_store", + "--trace_contexts", + "--trace_isolates", + "--trace_lazy", + "--trace_liftoff", + "--trace_module_status", + "--trace_normalization", + "--trace_turbo_escape", + "--trace_wasm_compiler", + "--trace_wasm_decoder", + "--trace_wasm_instances", + "--trace_wasm_interpreter", + "--trace_wasm_lazy_compilation", + "--trace_wasm_native_heap", + "--trace_wasm_serialization", + "--trace_wasm_stack_switching", + "--trace_wasm_streaming", + "--trap_on_abort", + ], + "!verify_heap": ["--verify-heap"], + "!debug_code": ["--debug-code"], + "!disassembler": [ + "--print_all_code", "--print_code", "--print_opt_code", + "--print_code_verbose", "--print_builtin_code", "--print_regexp_code" + ], + "!slow_dchecks": ["--enable-slow-asserts"], + "!gdbjit": ["--gdbjit", "--gdbjit_full", "--gdbjit_dump"], + "!has_maglev": ["--maglev"], + "!has_turbofan": + kIncompatibleFlagsForNoTurbofan, + "jitless_build_mode": + INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"], + "lite_mode": ["--max-semi-space-size=*"] + + INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"], + "predictable": [ + "--parallel-compile-tasks-for-eager-toplevel", + "--parallel-compile-tasks-for-lazy", "--concurrent-recompilation", + "--stress-concurrent-allocation", "--stress-concurrent-inlining" + ], + "dict_property_const_tracking": ["--stress-concurrent-inlining"], } # Flags that lead to a contradiction when a certain extra-flag is present. @@ -120,15 +189,21 @@ INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE = { # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG = { - "--concurrent-recompilation": ["--predictable", "--assert-types"], - "--parallel-compile-tasks-for-eager-toplevel": ["--predictable"], - "--parallel-compile-tasks-for-lazy": ["--predictable"], - "--gc-interval=*": ["--gc-interval=*"], - "--optimize-for-size": ["--max-semi-space-size=*"], - "--stress_concurrent_allocation": + "--concurrent-recompilation": [ + "--predictable", "--assert-types", "--turboshaft-assert-types", + "--single-threaded" + ], + "--parallel-compile-tasks-for-eager-toplevel": ["--predictable"], + "--parallel-compile-tasks-for-lazy": ["--predictable"], + "--gc-interval=*": ["--gc-interval=*"], + "--optimize-for-size": ["--max-semi-space-size=*"], + "--stress_concurrent_allocation": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_allocation"], - "--stress-concurrent-inlining": + "--stress-concurrent-inlining": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_inlining"], + "--turboshaft-assert-types": [ + "--concurrent-recompilation", "--stress-concurrent-inlining" + ], } SLOW_VARIANTS = set([ |