-
Notifications
You must be signed in to change notification settings - Fork 28
prefer CARGO_TARGET_TMPDIR as location for temporary build files #320
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
base: main
Are you sure you want to change the base?
Conversation
Looking at it again, cargo indeed never sets I think ideally we'd just remove that logic entirely and rely on |
Correct
Sounds right |
Hm, thinking about it, I don't know if we can use |
Could you help me understand how this is run? Is this a test runner, similar to |
This crate is typically a dev-dependency of some other crate, and then that other crate will call us in its tests. See for instance https://github.com/rust-lang/miri/blob/master/tests/ui.rs as a typical user of this crate. |
Yeah, testing libraries are a bit of a pain. In #t-cargo > cargo_bin_exe and tests @ 💬, I'm exploring whether to make some of these available at runtime to make things easier. Otherwise, it'll just require always passing it in like you currently do. I guess runtime access would also be good for not rebuilding just because the target directory moved though I'm unsure how often that happens in practice. CI seems like the most likely culprit. |
In the mean time, you have to put the caller in charge of providing these paths, similar to |
Providing it for dependencies or at runtime seem like good options; passing it in is kind if annoying. In our case it requires a sember bump.
Oli, any preference for what to do? Abort this PR or have the user pass in the value?
|
requiring everyone to pass sth in that is almost always just |
It's different people though -- the user who sets if a different target-dir and build-dir, vs the author of the ui_test-using test suite. If someone configures the target-dir in |
oh, I didn't think about config.toml further up the directory graph than the crate itself... yea that's annoying. I guess we could change the |
Based on discussion at rust-lang/cargo#14125 (comment).
I wasn't sure whether to use build-time or run-time env var lookup. The docs only mention
CARGO_TARGET_TMPDIR
being set at build time for tests. Does ui_test support being built outside of tests? The docs don't mentionCARGO_TARGET_DIR
being set at all so no idea who sets that or when, I figured I'd just keep it as a fallback.