xref: /wasmtime-44.0.1/tests/all/defaults.rs (revision 192f2fcd)
1 use wasmtime::*;
2 
3 #[test]
4 #[cfg_attr(miri, ignore)]
test_tail_call_default() -> Result<()>5 fn test_tail_call_default() -> Result<()> {
6     for (line, expected, cfg) in [
7         (
8             line!(),
9             true,
10             Config::new()
11                 .strategy(Strategy::Cranelift)
12                 .target("x86_64")?,
13         ),
14         (
15             line!(),
16             true,
17             Config::new()
18                 .strategy(Strategy::Cranelift)
19                 .target("aarch64")?,
20         ),
21         (
22             line!(),
23             true,
24             Config::new()
25                 .strategy(Strategy::Cranelift)
26                 .target("riscv64")?,
27         ),
28         (
29             line!(),
30             true,
31             Config::new()
32                 .strategy(Strategy::Cranelift)
33                 .target("s390x")?,
34         ),
35         (
36             line!(),
37             false,
38             Config::new().strategy(Strategy::Winch).target("x86_64")?,
39         ),
40         (
41             line!(),
42             false,
43             Config::new().strategy(Strategy::Winch).target("aarch64")?,
44         ),
45         (
46             line!(),
47             false,
48             Config::new()
49                 .strategy(Strategy::Cranelift)
50                 .wasm_tail_call(false)
51                 .target("x86_64")?,
52         ),
53     ] {
54         cfg.signals_based_traps(true);
55         let engine = Engine::new(cfg)?;
56 
57         eprintln!("running config on line {line}");
58         let wat = r#"
59             (module $from_name_section
60                 (func (export "run") (return_call 0))
61             )
62         "#;
63 
64         let result = engine.precompile_module(wat.as_bytes()).map(|_| ());
65 
66         eprintln!("got: {result:?}");
67 
68         assert_eq!(expected, result.is_ok());
69     }
70 
71     Ok(())
72 }
73