[nextest-runner] be build directory-aware#3169
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3169 +/- ##
==========================================
+ Coverage 85.19% 85.22% +0.03%
==========================================
Files 158 158
Lines 46399 46610 +211
==========================================
+ Hits 39529 39723 +194
- Misses 6870 6887 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates nextest’s build artifact handling to support Cargo’s upcoming split between build and target directories, ensuring reuse-build, archiving, and path remapping continue to work correctly when build_directory != target_directory.
Changes:
- Add
build_directorythroughout Rust build metadata and update path joining/mapping for test binaries, build script outputs, and linked paths. - Extend reuse-build remapping with
--build-dir-remap, and split path mapping intomap_target_path()vsmap_build_path(). - Update archive metadata emission to normalize/omit
build_directory, and add CI coverage for Cargo build-dir mode.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| nextest-runner/src/test_command.rs | Sets OUT_DIR based on build_directory rather than target_directory. |
| nextest-runner/src/reuse_build/mod.rs | Adds build-dir remap plumbing and splits path mapping into target vs build mappings. |
| nextest-runner/src/reuse_build/archiver.rs | Writes archive metadata via archive-specific summaries; treats test binaries/build script outputs/linked paths as build-dir relative. |
| nextest-runner/src/redact.rs | Updates redactions to treat linked paths as build-dir relative; adds build-dir redaction. |
| nextest-runner/src/list/test_list.rs | Maps test binary paths via build-dir mapping. |
| nextest-runner/src/list/test_helpers.rs | Updates helper construction for new RustBuildMeta::new(target, build, ...) signature. |
| nextest-runner/src/list/rust_build_meta.rs | Introduces build_directory and updates dylib path resolution + summary/archive summary behavior. |
| nextest-runner/src/list/binary_list.rs | Detects Cargo build dir when available; produces archive-specific summaries that remap test binary paths under target/. |
| nextest-runner/src/errors.rs | Adds BuildDir kind for PathMapper construction errors. |
| nextest-metadata/src/test_list.rs | Adds optional build_directory to serialized metadata with backwards-compatible defaults. |
| fixtures/nextest-tests/cdylib/cdylib-link/build.rs | Avoids recursive build-dir locking and supports old/new dylib output locations. |
| cargo-nextest/src/reuse_build.rs | Adds --build-dir-remap and applies fallback behavior when constructing PathMapper. |
| cargo-nextest/src/dispatch/core/tests.rs | Extends CLI argument parsing tests for --build-dir-remap constraints. |
| cargo-nextest/src/dispatch/core/filter.rs | Passes build_directory into path-mapper creation for reuse-build workflows. |
| .github/workflows/ci.yml | Adds a CI job that runs/archives fixtures with Cargo build-dir enabled and validates archive portability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Upcoming versions of Cargo are going to incorporate a split between the build and target directories. The build directory is for intermediate artifacts, while final build outputs are uplifted to the target directory. Also add `--build-dir-remap` to `PathMapper` and split `map_binary()` into `map_target_path()` and `map_build_path()`, so the `--binaries-metadata` + `--target-dir-remap` workflow works when `build_directory != target_directory`. The remapping behavior is: | `build_dir` in metadata | `--target-dir-remap` | `--build-dir-remap` | target_dir maps to | build_dir maps to | |---|---|---|---|---| | == target_dir | (none) | (none) | unchanged | unchanged | | == target_dir | /new/tgt | (none) | /new/tgt | /new/tgt (fallback) | | == target_dir | /new/tgt | /new/bld | /new/tgt | /new/bld | | != target_dir | (none) | (none) | unchanged | unchanged | | != target_dir | /new/tgt | (none) | /new/tgt | /new/tgt (fallback) | | != target_dir | (none) | /new/bld | unchanged | /new/bld | | != target_dir | /new/tgt | /new/bld | /new/tgt | /new/bld | Also add an integration test with the new build directory support.
2e04327 to
f3965c5
Compare
Upcoming versions of Cargo are going to incorporate a split between the build and target directories. The build directory is for intermediate artifacts, while final build outputs are uplifted to the target directory.
Also add
--build-dir-remaptoPathMapperand splitmap_binary()intomap_target_path()andmap_build_path(), so the--binaries-metadata+--target-dir-remapworkflow works whenbuild_directory != target_directory.The remapping behavior is:
build_dirin metadata--target-dir-remap--build-dir-remapAlso add an integration test with the new build directory support.