Skip to content

Commit

Permalink
Speed up a "big stack" test by using Winch
Browse files Browse the repository at this point in the history
This test currently takes 50s locally in debug mode locally so instead
switch it to using Winch so it finishes much faster.
  • Loading branch information
alexcrichton committed Nov 20, 2024
1 parent 6b67899 commit 428c128
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/all/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
use wasmtime::*;
use wasmtime_test_macros::wasmtime_test;

#[test]
fn host_always_has_some_stack() -> Result<()> {
Expand Down Expand Up @@ -119,8 +120,10 @@ fn host_always_has_some_stack() -> Result<()> {
}
}

#[test]
fn big_stack_works_ok() -> Result<()> {
// Don't test Cranelift here because it takes too long to compiler in debug
// mode.
#[wasmtime_test(strategies(not(Cranelift)))]
fn big_stack_works_ok(config: &mut Config) -> Result<()> {
const N: usize = 10000;

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

let mut store = Store::<()>::default();
let engine = Engine::new(config)?;

let mut store = Store::new(&engine, ());
let module = Module::new(store.engine(), &s)?;
let instance = Instance::new(&mut store, &module, &[])?;
let func = instance.get_typed_func::<(), i64>(&mut store, "")?;
Expand Down

0 comments on commit 428c128

Please sign in to comment.