rust-lang / rust-lang/rustwide

Tests fail with a shared CARGO_TARGET_DIR

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
198
Forks
45
Avg merge
18h 46m
Merged PRs (30d)
7

Description

$ CARGO_TARGET_DIR=/home/joshua/.local/lib/cargo/target cargo test hello_world
test buildtest::inside_docker::test_hello_world ... FAILED
test buildtest::test_hello_world ... ok

---- buildtest::inside_docker::test_hello_world stdout ----
thread 'buildtest::inside_docker::test_hello_world' panicked at 'called `Result::unwrap()` on an `Err` value: StripPrefixError(())

the working directory is not a parent of the test binary', tests/buildtest/inside_docker.rs:15:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ CARGO_TARGET_DIR=target cargo test hello_world
test buildtest::test_hello_world ... ok
test buildtest::inside_docker::test_hello_world ... ok

Additionally, rustwide seems to be clearing the cache on every test run with a shared CARGO_TARGET_DIR which is very annoying.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction using a shared CARGO_TARGET_DIR and inspect tests/buildtest/inside_docker.rs at line 15, where the StripPrefixError occurs. Run the two cargo test hello_world commands to compare behavior; done means the inside_docker test passes with a shared target directory and the cache is not cleared on every run.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.