Skip to content

fix(sync-plugin): skip wasm32-wasip2 fixture build when target is not installed#544

Open
lwshang wants to merge 3 commits intomainfrom
lwshang/543-skip-test-fixture-build-for-non-test
Open

fix(sync-plugin): skip wasm32-wasip2 fixture build when target is not installed#544
lwshang wants to merge 3 commits intomainfrom
lwshang/543-skip-test-fixture-build-for-non-test

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented May 1, 2026

Summary

  • In build.rs, gates build_test_fixture() behind a check that the wasm32-wasip2 target is actually installed (via rustc --print sysroot). CARGO_CFG_TEST was not viable — Cargo does not set it for build scripts.
  • In runtime.rs, switches env!("TEST_PLUGIN_WASM")option_env! with an early return, so fixture-dependent tests compile and skip gracefully when the fixture was not built.

Fixes #543

Behavior

Environment cargo build cargo test
Without wasm32-wasip2 (e.g. Homebrew) ✅ succeeds ✅ compiles; fixture tests skip
With wasm32-wasip2 (dev / CI) ✅ succeeds ✅ all 5 tests run and pass

Test plan

  • cargo build -p icp-sync-plugin succeeds without wasm32-wasip2 target installed
  • cargo test -p icp-sync-plugin --lib passes (fixture tests skip when target absent, run when present)

🤖 Generated with Claude Code

lwshang and others added 2 commits May 1, 2026 16:31
…builds

Fixes #543

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…builds

CARGO_CFG_TEST is not set by Cargo for build scripts, so instead gate
the fixture build on whether the wasm32-wasip2 target is installed
(checked via rustc sysroot). Fixture-dependent tests use option_env!
and return early when the fixture was not built, so they compile and
pass on machines without the wasm32-wasip2 target.

Fixes #543

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lwshang lwshang changed the title fix(sync-plugin): skip wasm32-wasip2 test fixture build for non-test builds fix(sync-plugin): skip wasm32-wasip2 fixture build when target is not installed May 1, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review May 1, 2026 20:57
@lwshang lwshang requested a review from a team as a code owner May 1, 2026 20:57
@lwshang lwshang enabled auto-merge (squash) May 1, 2026 20:57
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.

build.rs: skip wasm32-wasip2 test fixture build for non-test builds

2 participants