Skip to content

Commit

Permalink
Set the path to the wasi adapter properly. (#772)
Browse files Browse the repository at this point in the history
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 <ryan.levick@fermyon.com>
  • Loading branch information
rylev authored Nov 29, 2023
1 parent 4a3163d commit 0024241
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion crates/test-rust-wasm/artifacts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ fn main() {
std::env::remove_var("CARGO_ENCODED_RUSTFLAGS");

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

let wasi_adapter = out_dir.join("../../../../../tests/wasi_snapshot_preview1.reactor.wasm");
let wasi_adapter = manifest_dir.join("../../../tests/wasi_snapshot_preview1.reactor.wasm");

let mut cmd = Command::new("cargo");
cmd.arg("build")
Expand Down
5 changes: 3 additions & 2 deletions tests/runtime/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{Context, Result};
use heck::ToUpperCamelCase;

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

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

drop(std::fs::remove_dir_all(&out_dir));
std::fs::create_dir_all(&out_dir)?;
Expand Down

0 comments on commit 0024241

Please sign in to comment.