Skip to content

Add useNextest option for running tests with cargo-nextest#462

Open
macalinao wants to merge 2 commits intonix-community:masterfrom
macalinao:support-nextest
Open

Add useNextest option for running tests with cargo-nextest#462
macalinao wants to merge 2 commits intonix-community:masterfrom
macalinao:support-nextest

Conversation

@macalinao
Copy link
Copy Markdown

Summary

  • Adds useNextest parameter to buildRustCrateWithFeatures; when true, pre-built test binaries are run via cargo-nextest for faster per-testcase parallel execution
  • Generates synthetic --cargo-metadata and --binaries-metadata JSON so nextest can run binaries built by buildRustCrate (no cargo required in the test derivation)
  • Adds integration_test_nextest sample + check that exercises the feature end-to-end

Test plan

  • nix-build tests.nix -A checks.integration_test_nextest -L passes
  • nix flake check -L passes (existing tests unaffected when useNextest is not set)
  • Existing integration_test still passes (default path unchanged)

Adds a `useNextest` parameter to `buildRustCrateWithFeatures` that, when
enabled, runs the pre-built test binaries via cargo-nextest instead of
invoking them directly. This yields faster, per-testcase parallel
execution and better output.

Because crate2nix compiles test binaries via buildRustCrate (not cargo),
we feed nextest synthetic `--cargo-metadata` and `--binaries-metadata`
JSON files pointing at the pre-built binaries. `cargo-nextest` is
invoked standalone, so no cargo dependency is needed.

Includes an `integration_test_nextest` check exercising the feature
end-to-end against the existing integration_test sample project.
The integration_test sample shared a TestDir id between two tests via
cli_test_dir, which races under nextest's parallel execution on macOS
(TestDir::new wipes the directory on each call). cfg-test has
independent tests with no shared state and exercises the same
nextest code path.

Also regenerate Cargo.nix files that embed the buildRustCrate template.
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.

1 participant