From c47ba1c3d009bb2d85075fb47f951e2c8b695665 Mon Sep 17 00:00:00 2001 From: Cheng Shao <terrorjack@type.dance> Date: Mon, 25 Dec 2023 08:45:53 +0000 Subject: [PATCH] testsuite: add opts.target_wrapper This commit adds opts.target_wrapper which allows overriding the target wrapper on a per test case basis when testing a cross target. This is used when testing the wasm backend's JSFFI functionality; the rest of the cases are tested using wasmtime, though the jsffi cases are tested using the node.js based test runner. --- testsuite/driver/testglobals.py | 4 ++++ testsuite/driver/testlib.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index f22ebb994c6b..164891485642 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -414,6 +414,10 @@ class TestOptions: # Command to run before the test self.pre_cmd = None + # Optional per test target wrapper that overrides the default + # one when testing a cross target + self.target_wrapper = None + # Command wrapper: a function to apply to the command before running it self.cmd_wrapper = None diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index c183b656ac3b..448672b91b7b 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -2042,7 +2042,9 @@ async def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: st # Put extra_run_opts last: extra_run_opts('+RTS foo') should work. args = [prog, stats_args, my_rts_flags, extra_run_opts] - if config.target_wrapper is not None: + if opts.target_wrapper is not None: + args = [opts.target_wrapper] + args + elif config.target_wrapper is not None: args = [config.target_wrapper] + args cmd = ' '.join(args) -- GitLab