tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 85b95f98e59c2bbeeb9452f045d87e162b601f10
parent b93f2b4739e34d80c545d9178bfee4e0a21f8f0f
Author: Jon Coppeard <jcoppeard@mozilla.com>
Date:   Fri, 14 Nov 2025 10:44:24 +0000

Bug 1999765  - Fix handling of multiple extra arguments passed to JS shell tests r=sfink

Differential Revision: https://phabricator.services.mozilla.com/D272412

Diffstat:
Mjs/src/jit-test/jit_test.py | 17+++++++++++++----
Mjs/src/tests/jstests.py | 17+++++++++++++----
Mjs/src/tests/lib/results.py | 4++--
3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py @@ -173,14 +173,16 @@ def main(argv): "--args", dest="shell_args", metavar="ARGS", - default="", + default=[], + action="append", help="extra args to pass to the JS shell", ) op.add_argument( "--feature-args", dest="feature_args", metavar="ARGS", - default="", + default=[], + action="append", help="even more args to pass to the JS shell " "(for compatibility with jstests.py)", ) @@ -510,8 +512,8 @@ def main(argv): else: options.ignore_timeouts = set() - prefix = ( - [js_shell] + shlex.split(options.shell_args) + shlex.split(options.feature_args) + prefix = [js_shell] + split_extra_shell_args( + options.shell_args + options.feature_args ) prologue = os.path.join(jittests.LIB_DIR, "prologue.js") if options.remote: @@ -595,5 +597,12 @@ def main(argv): raise +def split_extra_shell_args(args): + result = [] + for option in args: + result.extend(shlex.split(option)) + return result + + if __name__ == "__main__": main(sys.argv[1:]) diff --git a/js/src/tests/jstests.py b/js/src/tests/jstests.py @@ -146,13 +146,15 @@ def parse_args(): "-a", "--args", dest="shell_args", - default="", + default=[], + action="append", help="Extra args to pass to the JS shell.", ) harness_og.add_argument( "--feature-args", dest="feature_args", - default="", + default=[], + action="append", help="Extra args to pass to the JS shell even when feature-testing.", ) harness_og.add_argument( @@ -433,7 +435,7 @@ def parse_args(): if options.rr: debugger_prefix = ["rr", "record"] - js_cmd_args = shlex.split(options.shell_args) + shlex.split(options.feature_args) + js_cmd_args = split_extra_shell_args(options.shell_args + options.feature_args) if options.jorendb: options.passthrough = True options.hide_progress = True @@ -655,6 +657,13 @@ def load_wpt_tests(xul_tester, requested_paths, excluded_paths, update_manifest= return tests +def split_extra_shell_args(args): + result = [] + for option in args: + result.extend(shlex.split(option)) + return result + + def load_tests(options, requested_paths, excluded_paths): """ Returns a tuple: (test_count, test_gen) @@ -672,7 +681,7 @@ def load_tests(options, requested_paths, excluded_paths): xul_abi, xul_os, xul_debug = options.xul_info_src.split(r":") xul_debug = xul_debug.lower() == "true" xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug) - feature_args = shlex.split(options.feature_args) + feature_args = split_extra_shell_args(options.feature_args) xul_tester = manifest.XULInfoTester(xul_info, options, feature_args) test_dir = dirname(abspath(__file__)) diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py @@ -455,7 +455,7 @@ class ResultsSink: result += " | " + test.path args = [] if self.options.shell_args: - args.append(self.options.shell_args) + args.extend(self.options.shell_args) args += test.jitflags result += ' | (args: "{}")'.format(" ".join(args)) if message: @@ -469,7 +469,7 @@ class ResultsSink: details = {"extra": extra.copy() if extra else {}} if self.options.shell_args: - details["extra"]["shell_args"] = self.options.shell_args + details["extra"]["shell_args"] = shlex.join(self.options.shell_args) details["extra"]["jitflags"] = test.jitflags if message: details["message"] = message