Skip to content

Bug: default store directory does not respect CARGO_TARGET_DIR #2066

Description

@tgross35

Description of the issue

Description:

Nextest always tries to create the store directory at the workspace root, which fails if the workspace is read-only.

Steps to reproduce:

  1. Go to any existing project, ensure the target directory is clean (or at least target/nextest does not exist)
  2. Launch a Docker container that mounts the current workspace as read only, and sets CARGO_TARGET_DIR. : docker run --rm -e CARGO_TARGET_DIR=/target -v "$(pwd):/checkout:ro" -it rust bash
  3. Install nextest: cargo install cargo-nextest
  4. cd /checkout
  5. Try running tests normally: cargo test. This should work
  6. Try running tests via nextest: cargo nextest run. This fails with something like:
error: failed to create store dir at `/checkout/target/nextest/default`

Caused by:
  Read-only file system (os error 30)

Expected outcome

By default, rather than using a path relative to the workspace root, nextest should create its store directory within CARGO_TARGET_DIR if it is set.

Actual result

Unable to create the file (see above)

Nextest version

cargo-nextest 0.9.87 (fee71ad7b 2024-12-17)
release: 0.9.87
commit-hash: fee71ad7ba08be06519cf9eeb495c6fce0a2e888
commit-date: 2024-12-17
host: aarch64-unknown-linux-gnu

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions