Skip to content

Commit bc6edf8

Browse files
miss-islingtonhoodmanefreakboy3742
authored
[3.14] gh-145177: Add emscripten run --test, uses test args from config.toml (GH-146160) (#146186)
This allows us to change the test arguments from the python repo rather than having to change buildmaster-config. (cherry picked from commit 6b5511d) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent 6a84361 commit bc6edf8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Platforms/emscripten/__main__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,10 @@ def run_emscripten_python(context):
578578
if args and args[0] == "--":
579579
args = args[1:]
580580

581-
os.execv(str(exec_script), [str(exec_script)] + args)
581+
if context.test:
582+
args = load_config_toml()["test-args"] + args
583+
584+
os.execv(str(exec_script), [str(exec_script), *args])
582585

583586

584587
def build_target(context):
@@ -695,6 +698,15 @@ def main():
695698
"run",
696699
help="Run the built emscripten Python",
697700
)
701+
run.add_argument(
702+
"--test",
703+
action="store_true",
704+
default=False,
705+
help=(
706+
"If passed, will add the default test arguments to the beginning of the command. "
707+
"Default arguments loaded from Platforms/emscripten/config.toml"
708+
)
709+
)
698710
run.add_argument(
699711
"args",
700712
nargs=argparse.REMAINDER,
@@ -704,6 +716,7 @@ def main():
704716
)
705717
)
706718
add_cross_build_dir_option(run)
719+
707720
clean = subcommands.add_parser(
708721
"clean", help="Delete files and directories created by this script"
709722
)

Platforms/emscripten/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# Python versions.
44
emscripten-version = "4.0.12"
55
node-version = "24"
6+
test-args = [
7+
"-m", "test",
8+
"-v",
9+
"-uall",
10+
"--rerun",
11+
"--single-process",
12+
"-W",
13+
]
614

715
[libffi]
816
url = "https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz"

0 commit comments

Comments
 (0)