Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Fix running wast tests in different directory (#11764)

Nick Fitzgerald47fb746bdc78
diff --git a/crates/test-util/src/wast.rs b/crates/test-util/src/wast.rs
index 7517f91998..6033aa52b8 100644
--- a/crates/test-util/src/wast.rs
+++ b/crates/test-util/src/wast.rs
@@ -32,21 +32,26 @@ pub mod limits {
/// of the wasmtime repository.
pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
let mut tests = Vec::new();
+
+ let spec_tests = root.join("tests/spec_testsuite");
add_tests(
&mut tests,
- &root.join("tests/spec_testsuite"),
+ &spec_tests,
&FindConfig::Infer(spec_test_config),
- )?;
- add_tests(
- &mut tests,
- &root.join("tests/misc_testsuite"),
- &FindConfig::InTest,
- )?;
+ )
+ .with_context(|| format!("failed to add tests from `{}`", spec_tests.display()))?;
+
+ let misc_tests = root.join("tests/misc_testsuite");
+ add_tests(&mut tests, &misc_tests, &FindConfig::InTest)
+ .with_context(|| format!("failed to add tests from `{}`", misc_tests.display()))?;
+
+ let cm_tests = root.join("tests/component-model/test");
add_tests(
&mut tests,
- &root.join("tests/component-model/test"),
+ &cm_tests,
&FindConfig::Infer(component_test_config),
- )?;
+ )
+ .with_context(|| format!("failed to add tests from `{}`", cm_tests.display()))?;
Ok(tests)
}
diff --git a/tests/wast.rs b/tests/wast.rs
index ca5dccdae8..519379edae 100644
--- a/tests/wast.rs
+++ b/tests/wast.rs
@@ -11,7 +11,7 @@ fn main() {
let tests = if cfg!(miri) {
Vec::new()
} else {
- wasmtime_test_util::wast::find_tests(".".as_ref()).unwrap()
+ wasmtime_test_util::wast::find_tests(env!("CARGO_MANIFEST_DIR").as_ref()).unwrap()
};
let mut trials = Vec::new();