Repository navigation
test(ffi-component): find the component under CARGO_TARGET_DIR - #2943
Merged
Merged
Conversation
The parity and corpus-parity tests looked for the wasip2 component at a hardcoded ../../target/wasm32-wasip2/..., so with CARGO_TARGET_DIR set the artifact was built elsewhere and every component test skipped, letting a local run pass without testing anything. Resolve the artifact in one helper in the crate's lib target, shared by both test files: $CARGO_TARGET_DIR when set (a relative value is taken against the workspace root), else the workspace target/. A missing artifact now prints the exact path that was checked, after the unchanged "skip: component wasm not built" prefix that CI's component-parity job greps for. Every guard now prints the marker; ten of them returned silently before. Unit tests cover the env unset, empty, absolute and relative cases. Closes #2933 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
The "Run parity tests" step piped cargo test into tee without pipefail, so its status was tee's: a failing parity test, or a test crate that did not compile, left the job green. Set pipefail, run --lib --tests (the doc-test binary has no tests), and require every test binary, at least three, to report a nonzero passed count. Also canonicalize workspace_root() so the skip message prints a clean path, pin that with a test, and name corpus_parity.rs in the crate doc. Refs #2933 Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
added a commit
that referenced
this pull request
Nov 11, 2026
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
crates/rustledger-ffi-component-tests/src/lib.rsnow holds the single resolver for the wasip2 component artifact, used by bothtests/parity.rsandtests/corpus_parity.rs(their duplicated hardcodedcomponent_path()copies are removed):CARGO_TARGET_DIRset and absolute: used as isCARGO_TARGET_DIRset and relative: taken against the workspace roottarget/component_built()replaces the 32if !component_path().exists()guards. When the artifact is missing it printsskip: component wasm not built (looked for <exact path>; build it with ...). Ten guards previously returned without printing anything; all of them print the marker now.Why
The tests looked for
../../target/wasm32-wasip2/...regardless ofCARGO_TARGET_DIR, so with a custom target dir every component test skipped and a local run passed without testing anything. CI was protected only because it uses the default target dir.CI compatibility
The
component-parityjob builds withcargo build -p rustledger-ffi-component --target wasm32-wasip2(default target dir) and fails if the log containsskip: component wasm not built. That prefix is unchanged (it is nowSKIP_MARKER), and the default resolution is still<workspace>/target/wasm32-wasip2/debug/rustledger_ffi_component.wasm.CI hardening (second commit)
The
component-parity"Run parity tests" step pipedcargo testintoteewithoutpipefail, so a failing parity test or a non-compiling test crate left the job green; only a skip marker could fail it. It now setspipefail, runs--lib --tests(the doc-test binary has no tests), and requires every test binary, at least three, to reporttest result: ok.with a nonzero passed count.workspace_root()is also canonicalized so the skip message carries no...How to test
Repeat with
CARGO_TARGET_DIRunset. Locally, both runs gave 4 + 2 + 30 tests passed with zero skip markers; the parity suite took about 6 to 7 minutes, which shows the component was actually exercised. PointingCARGO_TARGET_DIRat a directory without the artifact prints the skip marker with the full looked-for path.Closes #2933
🤖 Generated with Claude Code