Skip to content

Commit 47fb746

Browse files
authored
Fix running wast tests in different directory (#11764)
1 parent 8ee7a6a commit 47fb746

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

crates/test-util/src/wast.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,26 @@ pub mod limits {
3232
/// of the wasmtime repository.
3333
pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
3434
let mut tests = Vec::new();
35+
36+
let spec_tests = root.join("tests/spec_testsuite");
3537
add_tests(
3638
&mut tests,
37-
&root.join("tests/spec_testsuite"),
39+
&spec_tests,
3840
&FindConfig::Infer(spec_test_config),
39-
)?;
40-
add_tests(
41-
&mut tests,
42-
&root.join("tests/misc_testsuite"),
43-
&FindConfig::InTest,
44-
)?;
41+
)
42+
.with_context(|| format!("failed to add tests from `{}`", spec_tests.display()))?;
43+
44+
let misc_tests = root.join("tests/misc_testsuite");
45+
add_tests(&mut tests, &misc_tests, &FindConfig::InTest)
46+
.with_context(|| format!("failed to add tests from `{}`", misc_tests.display()))?;
47+
48+
let cm_tests = root.join("tests/component-model/test");
4549
add_tests(
4650
&mut tests,
47-
&root.join("tests/component-model/test"),
51+
&cm_tests,
4852
&FindConfig::Infer(component_test_config),
49-
)?;
53+
)
54+
.with_context(|| format!("failed to add tests from `{}`", cm_tests.display()))?;
5055
Ok(tests)
5156
}
5257

tests/wast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() {
1111
let tests = if cfg!(miri) {
1212
Vec::new()
1313
} else {
14-
wasmtime_test_util::wast::find_tests(".".as_ref()).unwrap()
14+
wasmtime_test_util::wast::find_tests(env!("CARGO_MANIFEST_DIR").as_ref()).unwrap()
1515
};
1616

1717
let mut trials = Vec::new();

0 commit comments

Comments
 (0)