Skip to content

Commit 0024241

Browse files
authored
Set the path to the wasi adapter properly. (#772)
Preivously the adapter as assumed to be at set relative path to the target directory which was not true when CARGO_TARGET_DIR was set. Now, the adapter is assumed to be at a set relative path to the artifacts crate which should always be the case. Signed-off-by: Ryan Levick <[email protected]>
1 parent 4a3163d commit 0024241

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

crates/test-rust-wasm/artifacts/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ fn main() {
66
std::env::remove_var("CARGO_ENCODED_RUSTFLAGS");
77

88
let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
9+
let manifest_dir = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());
910

10-
let wasi_adapter = out_dir.join("../../../../../tests/wasi_snapshot_preview1.reactor.wasm");
11+
let wasi_adapter = manifest_dir.join("../../../tests/wasi_snapshot_preview1.reactor.wasm");
1112

1213
let mut cmd = Command::new("cargo");
1314
cmd.arg("build")

tests/runtime/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::Result;
1+
use anyhow::{Context, Result};
22
use heck::ToUpperCamelCase;
33

44
use std::borrow::Cow;
@@ -147,7 +147,8 @@ fn tests(name: &str, dir_name: &str) -> Result<Vec<PathBuf>> {
147147
out_dir.push("runtime-tests");
148148
out_dir.push(name);
149149

150-
let wasi_adapter = std::fs::read(&test_artifacts::ADAPTER)?;
150+
let wasi_adapter =
151+
std::fs::read(&test_artifacts::ADAPTER).context("failed to read the wasi adapter")?;
151152

152153
drop(std::fs::remove_dir_all(&out_dir));
153154
std::fs::create_dir_all(&out_dir)?;

0 commit comments

Comments
 (0)