MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / main

Function main

tests/wast.rs:10–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8use wasmtime_wast::{Async, SpectestConfig, WastContext};
9
10fn main() {
11 env_logger::init();
12
13 let tests = if cfg!(miri) {
14 Vec::new()
15 } else {
16 wasmtime_test_util::wast::find_tests(env!("CARGO_MANIFEST_DIR").as_ref()).unwrap()
17 };
18
19 let mut trials = Vec::new();
20
21 // Check for if we are only running GC-related tests.
22 let gc_keywords = std::env::var("WASMTIME_TEST_GC_KEYWORDS")
23 .ok()
24 .map(|s| s.split(" ").map(|s| s.to_string()).collect::<Vec<_>>());
25
26 let mut add_trial = |test: &WastTest, config: WastConfig| {
27 let name = format!(
28 "{:?}/{}{}{}",
29 config.compiler,
30 if config.pooling { "pooling/" } else { "" },
31 if config.collector != Collector::Auto {
32 format!("{:?}/", config.collector)
33 } else {
34 String::new()
35 },
36 test.path.to_str().unwrap()
37 );
38
39 // Don't add this trial if we are only running GC-related tests and it
40 // doesn't look like a GC-related test.
41 if let Some(ks) = &gc_keywords {
42 if config.collector == Collector::Auto && !ks.iter().any(|kw| name.contains(kw)) {
43 return;
44 }
45 }
46
47 let trial = Trial::test(name, {
48 let test = test.clone();
49 move || run_wast(&test, config).map_err(|e| format!("{e:?}").into())
50 });
51
52 trials.push(trial);
53 };
54
55 // List of supported compilers, filtered by what our current host supports.
56 let mut compilers = vec![
57 Compiler::CraneliftNative,
58 Compiler::Winch,
59 Compiler::CraneliftPulley,
60 ];
61 compilers.retain(|c| c.supports_host());
62
63 // Only test one compiler in ASAN since we're mostly interested in testing
64 // runtime code, not compiler-generated code.
65 if cfg!(asan) {
66 compilers.truncate(1);
67 }

Callers

nothing calls this directly

Calls 15

run_wastFunction · 0.85
splitMethod · 0.80
anyMethod · 0.80
supports_hostMethod · 0.80
test_uses_gc_typesMethod · 0.80
copiedMethod · 0.80
find_testsFunction · 0.70
initFunction · 0.50
newFunction · 0.50
testFunction · 0.50
runFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected