Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factors: Improve tests #2626

Merged
merged 2 commits into from
Jul 11, 2024
Merged

factors: Improve tests #2626

merged 2 commits into from
Jul 11, 2024

Conversation

lann
Copy link
Collaborator

@lann lann commented Jul 10, 2024

The spin-factors-derive expander feature is very useful for debugging macro output but breaks rust-analyzer due to rust-lang/rust-analyzer#17040. Fix with some annoying build script boilerplate.

Also build out the WASI factor a bit, including a test.

lann added 2 commits July 10, 2024 17:21
Rust analyzer doesn't like `include!`s that reach outside of a crate's
own OUT_DIR: rust-lang/rust-analyzer#17040

Fix this by requiring any crate that wants expanded output (in tests)
to have a build script that sets a magic env var.

Signed-off-by: Lann Martin <[email protected]>
@lann lann requested review from calebschoepp and me-diru July 10, 2024 21:28
@@ -0,0 +1,6 @@
fn main() {
println!("cargo::rerun-if-changed=build.rs");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be necessary. build.rs is always run if changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cargo-culted from https://github.com/bytecodealliance/wasmtime/blob/0e5048e20a24f6da19b3794eeb94111f052dc414/crates/component-macro/build.rs#L2

From the cargo docs:

If the build script inherently does not need to re-run under any circumstance, then emitting cargo::rerun-if-changed=build.rs is a simple way to prevent it from being re-run (otherwise, the default if no rerun-if instructions are emitted is to scan the entire package directory for changes).

@lann lann merged commit bea30e7 into fermyon:factors Jul 11, 2024
1 check passed
@lann lann deleted the more-factors-test branch July 11, 2024 13:32
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