Skip to content

test: fix eval and file-close - #43

Open
GregoryLi360 wants to merge 2 commits into
mainfrom
test/fix-eval
Open

test: fix eval and file-close#43
GregoryLi360 wants to merge 2 commits into
mainfrom
test/fix-eval

Conversation

@GregoryLi360

Copy link
Copy Markdown
Contributor

Adds test for entire fix eval pipeline

Comment on lines +79 to +92
let workspace = Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.expect("vmm crate is inside the workspace");

// Cargo supplies both binaries; VMM expects the guest ELF before guest argv
let child = Command::new(env!("CARGO_BIN_EXE_vmm"))
.arg(env!("CARGO_BIN_FILE_FIX_GUEST_fix"))
.arg("eval")
.arg(program.path())
.current_dir(workspace)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
.expect("launch Fix-on-Arca under the VMM");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have Rust embed the guest binary into this one instead or reading it? This currently seems brittle.

@GregoryLi360 GregoryLi360 Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Cargo.toml I added

[dev-dependencies]
fix-guest = { package = "fix", path = "../fix", artifact = "bin:fix", target = "x86_64-unknown-none" }

so calling cargo test should build the Fix guest artifact first. I tried embedding it but couldn't really see a clean way of doing so. Also, I'm not quite sure of the benefit of that approach, is there something that could fail with how it is right now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main thing that concerns me is the path possibly being incorrect depending on the user's config; like their editor might invoke cargo test in the current file's directory rather than the project root. Right now the path is a compile-time literal but it's being evaluated at runtime which is odd. Also philosophically I'm hesitant to have a hard dependency that isn't visible to the compiler/runtime/OS...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I moved the existing WAT build pipeline into a fix_wasm crate. It builds all the .wat files and exports their ELF's literal bytes. fix/build.rs uses those outputs, and the VMM test embeds fix_wasm::ADDBLOB directly.

@keithw

keithw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Now that I'm reading this more closely, it seems like a bit of a roundabout way to accomplish the original goal of testing "fix eval" in CI and making sure it closes properly. E.g. having the test re-exec itself as a subprocess (to be able to capture the error message in stdout).

I suspect there's probably an easier route where, e.g., maybe we add an assert_return "command" to the fix program (or the fix scripting language?) so we can directly write tests and run them from the command line without needing much extra in Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants