Skip to content

Commit

Permalink
Merge pull request #628 from hacspec/fix-test-harness-for-new-name-crate
Browse files Browse the repository at this point in the history
fix(test-harness): `hax-engine-names-extract` needs hax in PATH
  • Loading branch information
W95Psp authored Apr 25, 2024
2 parents ecc4cb6 + a03c1b4 commit 996a929
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion engine/names/extract/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ fn target_dir(suffix: &str) -> camino::Utf8PathBuf {
}

fn get_json() -> String {
let mut cmd = Command::new("cargo-hax");
let mut cmd =
Command::new(std::env::var("HAX_CARGO_COMMAND_PATH").unwrap_or("cargo-hax".to_string()));
cmd.args([
"hax",
"-C",
Expand Down
22 changes: 18 additions & 4 deletions test-harness/src/command_hax_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,23 @@ impl CommandHaxExt for Command {
let root = std::env::current_dir().unwrap();
let root = root.parent().unwrap();
let engine_dir = root.join("engine");
// Make sure binaries are built
// Make sure binaries are built. Note this doesn't
// include `hax-engine-names-extract`: its build
// script requires the driver and CLI of `hax` to be
// available.
assert!(Command::new("cargo")
.args(&["build", "--workspace", "--bins"])
.args(&["build", "--bins"])
.status()
.unwrap()
.success());
let cargo_hax = cargo_bin(CARGO_HAX);
let driver = cargo_bin("driver-hax-frontend-exporter");
// Now the driver & CLI are installed, call `cargo
// build` injecting their paths
assert!(Command::new("cargo")
.args(&["build", "--workspace", "--bin", "hax-engine-names-extract"])
.env("HAX_CARGO_COMMAND_PATH", &cargo_hax)
.env("HAX_RUSTC_DRIVER_BINARY", &driver)
.status()
.unwrap()
.success());
Expand All @@ -49,8 +63,8 @@ impl CommandHaxExt for Command {
.unwrap()
.success());
Some(Paths {
driver: cargo_bin("driver-hax-frontend-exporter"),
cargo_hax: cargo_bin(CARGO_HAX),
driver,
cargo_hax,
engine: engine_dir.join("_build/install/default/bin/hax-engine"),
})
};
Expand Down

0 comments on commit 996a929

Please sign in to comment.