Skip to content

Commit

Permalink
[switch] enable gc feature unconditionally in stack_switching tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-emrich committed Dec 2, 2024
1 parent e304307 commit 7d5381a
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions tests/all/stack_switching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ mod test_utils {
}

impl Runner {
pub fn new(enable_gc: bool) -> Runner {
pub fn new() -> Runner {
let mut config = Config::default();
config.wasm_function_references(true);
config.wasm_exceptions(true);
config.wasm_stack_switching(true);
config.wasm_gc(enable_gc);
// Required in order to use recursive types.
config.wasm_gc(true);

let engine = Engine::new(&config).unwrap();

Expand Down Expand Up @@ -389,7 +390,7 @@ mod host {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_host_func(&mut runner);

Expand Down Expand Up @@ -430,7 +431,7 @@ mod host {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_via_export_host_func(&mut runner, "b");

Expand Down Expand Up @@ -475,7 +476,7 @@ mod host {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_via_export_host_func(&mut runner, "b");

Expand Down Expand Up @@ -516,7 +517,7 @@ mod host {
)
)
"#;
let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_via_export_host_func(&mut runner, "b");

Expand Down Expand Up @@ -574,7 +575,7 @@ mod host {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_via_export_host_func(&mut runner, "b");

Expand Down Expand Up @@ -635,7 +636,7 @@ mod host {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let host_func_a = make_i32_inc_via_export_host_func(&mut runner, "b");

Expand All @@ -655,13 +656,8 @@ mod traps {
/// Runs the module given as `wat`. We expect execution to cause the
/// `expected_trap` and a backtrace containing exactly the function names
/// given by `expected_backtrace`.
fn run_test_expect_trap_backtrace(
wat: &str,
enable_gc: bool,
expected_trap: Trap,
expected_backtrace: &[&str],
) {
let runner = Runner::new(enable_gc);
fn run_test_expect_trap_backtrace(wat: &str, expected_trap: Trap, expected_backtrace: &[&str]) {
let runner = Runner::new();
let result = runner.run_test::<()>(wat, &[]);

let err = result.expect_err("Was expecting wasm execution to yield error");
Expand Down Expand Up @@ -732,7 +728,6 @@ mod traps {

run_test_expect_trap_backtrace(
wat,
false,
Trap::UnreachableCodeReached,
&["entry", "a", "b", "c", "d", "e", "f"],
);
Expand Down Expand Up @@ -777,7 +772,6 @@ mod traps {

run_test_expect_trap_backtrace(
wat,
false,
Trap::UnreachableCodeReached,
&["entry", "a", "b", "c"],
);
Expand Down Expand Up @@ -820,7 +814,7 @@ mod traps {
)
"#;

run_test_expect_trap_backtrace(wat, false, Trap::UnreachableCodeReached, &["entry", "a"]);
run_test_expect_trap_backtrace(wat, Trap::UnreachableCodeReached, &["entry", "a"]);

Ok(())
}
Expand Down Expand Up @@ -869,7 +863,6 @@ mod traps {

run_test_expect_trap_backtrace(
wat,
false,
Trap::UnreachableCodeReached,
&["entry", "a", "b", "c"],
);
Expand Down Expand Up @@ -932,7 +925,6 @@ mod traps {
// suspended in $e, and traps in $d
run_test_expect_trap_backtrace(
wat,
false,
Trap::UnreachableCodeReached,
&["entry", "a", "b", "d"],
);
Expand Down Expand Up @@ -985,7 +977,7 @@ mod traps {
// Note that c does not appear in the stack trace:
// In $b, we resume the suspended computation, which started in $d,
// suspended in $e, and traps in $d
run_test_expect_trap_backtrace(wat, false, Trap::UnreachableCodeReached, &["entry", "a"]);
run_test_expect_trap_backtrace(wat, Trap::UnreachableCodeReached, &["entry", "a"]);

Ok(())
}
Expand Down Expand Up @@ -1043,7 +1035,6 @@ mod traps {

run_test_expect_trap_backtrace(
wat,
false,
Trap::UnreachableCodeReached,
&["entry", "a", "b", "f", "c", "d", "e"],
);
Expand Down Expand Up @@ -1113,7 +1104,6 @@ mod traps {

run_test_expect_trap_backtrace(
wat,
true,
Trap::UnreachableCodeReached,
&["entry", "c", "d", "a", "b"],
);
Expand Down Expand Up @@ -1159,7 +1149,7 @@ mod traps {
)
"#;

let mut runner = Runner::new(false);
let mut runner = Runner::new();

let msg = "Host function f panics";

Expand Down Expand Up @@ -1203,7 +1193,7 @@ mod traps {
)
"#;

let runner = Runner::new(false);
let runner = Runner::new();

let error = runner
.run_test::<()>(wat, &[])
Expand Down Expand Up @@ -1256,7 +1246,7 @@ mod misc {
)
"#;

let runner = Runner::new(false);
let runner = Runner::new();
let error = runner
.run_test::<()>(wat, &[])
.expect_err("expected an overflow");
Expand Down

0 comments on commit 7d5381a

Please sign in to comment.