Skip to content

Conversation

@Muscraft
Copy link
Member

In #11738, I made a test's "sandbox" folder based on its name instead of a generated number, which can change from run to run. #11812 reverted this change due to problems with path length limits on Windows. After getting frustrated with the generated folders while trying to debug a test recently, I decided that it would be a good idea to bring back name-based folders to platforms that support them.

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-testing-cargo-itself Area: cargo's tests S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 15, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Member

@weihanglo weihanglo Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to call out @ehuss's comment #11738 (comment), though personally fine with this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I missed this when I was going back through that PR. Given that concern, it might make sense for me to bring this up in the next team meeting.

@ehuss
Copy link
Contributor

ehuss commented Oct 28, 2025

There is some documentation in https://github.com/rust-lang/cargo/blob/HEAD/src/doc/contrib/src/tests/writing.md that would need to be updated.

@ehuss
Copy link
Contributor

ehuss commented Nov 11, 2025

@rustbot author

I think @Muscraft indicated he could add some kind of symlink to the first test.
There's also the docs to be updated.

@rustbot rustbot added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2025
@rustbot

This comment has been minimized.

@epage epage changed the title feat: Use test name for dir when running tests feat(test-support): Use test name for dir when running tests Nov 18, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this twice and and it failed

$ cargo t --test testsuite config_include::bad_format
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.80s
     Running tests/testsuite/main.rs (/Users/user/.cargo/build-cache/debug/deps/testsuite-da0240c1196e03cf)

running 1 test
test config_include::bad_format ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 3900 filtered out; finished in 0.11s
$ cargo t --test testsuite config_include::bad_format
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.74s
     Running tests/testsuite/main.rs (/Users/user/.cargo/build-cache/debug/deps/testsuite-da0240c1196e03cf)

running 1 test
test config_include::bad_format ... FAILED

failures:

---- config_include::bad_format stdout ----

thread 'config_include::bad_format' (91574537) panicked at crates/cargo-test-support/src/lib.rs:200:9:

failed running os::unix::fs::symlink(&self.dst, &self.src)
error: File exists (os error 17)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    config_include::bad_format

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3900 filtered out; finished in 0.00s

I am on Mac OS 15.7.1 [64-bit]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out the issue, cargo normally rm -rf's the test directory and I wasn't doing that before I tried to create the symlink.

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation A-testing-cargo-itself Area: cargo's tests S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants