Add useNextest option for running tests with cargo-nextest#462
Open
macalinao wants to merge 2 commits intonix-community:masterfrom
Open
Add useNextest option for running tests with cargo-nextest#462macalinao wants to merge 2 commits intonix-community:masterfrom
macalinao wants to merge 2 commits intonix-community:masterfrom
Conversation
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.
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.
Summary
useNextestparameter tobuildRustCrateWithFeatures; when true, pre-built test binaries are run viacargo-nextestfor faster per-testcase parallel execution--cargo-metadataand--binaries-metadataJSON so nextest can run binaries built bybuildRustCrate(no cargo required in the test derivation)integration_test_nextestsample + check that exercises the feature end-to-endTest plan
nix-build tests.nix -A checks.integration_test_nextest -Lpassesnix flake check -Lpasses (existing tests unaffected whenuseNextestis not set)integration_teststill passes (default path unchanged)