Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CARGO_TARGET_TMPDIR if set #2

Open
dimo414 opened this issue Sep 23, 2023 · 3 comments
Open

Use CARGO_TARGET_TMPDIR if set #2

dimo414 opened this issue Sep 23, 2023 · 3 comments

Comments

@dimo414
Copy link

dimo414 commented Sep 23, 2023

Cargo provides a temp directory for integration tests via CARGO_TARGET_TMPDIR. It's unfortunately not currently set for unit tests but it might still be nice to use it when it's available (I am only using testdir with integration tests, and I imagine that's somewhat typical). rust-lang/cargo#9375 has some context behind the motivation for this variable and why it's only set for integration tests.

FWIW I went looking for this setting because I was a little surprised testdir creates all its directories right in the target/ root; it ends up creating nine entries that seem like they could be nested under a common parent directory to keep the root dir cleaner. So in addition to / instead of using CARGO_TARGET_TMPDIR it might be nice to put all these paths under a single common directory such as target/testdir/dir-*.

@flub
Copy link
Owner

flub commented Oct 4, 2023

So in addition to / instead of using CARGO_TARGET_TMPDIR it might be nice to put all these paths under a single common directory such as target/testdir/dir-*.

Mind filing a separate issue for this?

@flub
Copy link
Owner

flub commented Oct 4, 2023

Thanks for the reference. Doing this I guess means that testdir would behave differently when running integration tests as when running unittests because cargo will always set this directory for integration tests? So now you'd have two paths where you have to go look depending on which tests you happened to run. I'm not entirely sure how much I like this.

@dimo414
Copy link
Author

dimo414 commented Oct 5, 2023

Yeah I agree it's too bad the var isn't consistently set (it sounds like others would like it too), but it might still make sense to respect it if/when it is set, even if that's not always the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants