Skip to content

Commit e32292c

Browse files
authored
Speed up a "big stack" test, and test Winch (#9636)
* Speed up a "big stack" test, and test Winch This test currently takes 50s locally in debug mode locally so optimize it by disabling optimizations in Cranelift and additionally using the single-pass register allocator. This drops the test time to ~3s locally. * Fix test comments
1 parent 4f386b7 commit e32292c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/all/stack_overflow.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
44
use wasmtime::*;
5+
use wasmtime_test_macros::wasmtime_test;
56

67
#[test]
78
fn host_always_has_some_stack() -> Result<()> {
@@ -119,8 +120,8 @@ fn host_always_has_some_stack() -> Result<()> {
119120
}
120121
}
121122

122-
#[test]
123-
fn big_stack_works_ok() -> Result<()> {
123+
#[wasmtime_test]
124+
fn big_stack_works_ok(config: &mut Config) -> Result<()> {
124125
const N: usize = 10000;
125126

126127
// Build a module with a function that uses a very large amount of stack space,
@@ -143,7 +144,13 @@ fn big_stack_works_ok() -> Result<()> {
143144
s.push_str("(func $get (result i64) i64.const 0)\n");
144145
s.push_str(")\n");
145146

146-
let mut store = Store::<()>::default();
147+
// Disable cranelift optimizations to ensure that this test doesn't take too
148+
// long in debug mode due to the large size of its code.
149+
config.cranelift_opt_level(OptLevel::None);
150+
config.cranelift_regalloc_algorithm(RegallocAlgorithm::SinglePass);
151+
let engine = Engine::new(config)?;
152+
153+
let mut store = Store::new(&engine, ());
147154
let module = Module::new(store.engine(), &s)?;
148155
let instance = Instance::new(&mut store, &module, &[])?;
149156
let func = instance.get_typed_func::<(), i64>(&mut store, "")?;

0 commit comments

Comments
 (0)