-
Notifications
You must be signed in to change notification settings - Fork 15
Add TestEnv for Nextest support
#120
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
Conversation
selecting the correct glam version manually when testing various spirv-std versions is hard
otherwise I can't build it
adc5b84 to
f181ba7
Compare
|
The template's spirv-std update included Rust-GPU/rust-gpu#380, which forces glam to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our main::cache_dir() function already has a clause for tests:
Ok(if cfg!(test) {
let thread_id = std::thread::current().id();
let id = format!("{thread_id:?}").replace('(', "-").replace(')', "");
dir.join("tests").join(id)
} else {
dir
})So either we need to delete that or, what about if we pass the function the tempdirpath, like cache_dir(Option<PathBuf>)? I think it'd be nice to still be getting test coverage for that function.
But now I'm wondering about tempdir's default use of Drop to automate the directory removal. What if shader_crate_test_path() returned tempfile::TempDir? Would that mean we don't need the thread-local TEMPDIR nor even the tests_teardown?
The main reason behind removing this condition and replacing it with This is because of the following neat reason: when the parent crate has this cfg set in its own tests, child crate (which is dependent on the parent) does not have this cfg set, and so cache dir is always the same for all its tests (which is just
I really hope this hack (due to the lack of Also we could provide an optional path argument for
I haven't thought about that in my PR: I've just tried to preserve testing logic as much as possible (at that moment). |
f181ba7 to
274e658
Compare
c5c454c to
6b615d9
Compare
|
Changed the entire testing infrastructure to use the new
Please rereview! |
TestEnv for Nextest support
99bd3bd to
863feb7
Compare
tombh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, nice work. I really like the check for TestEnv setup in test_cache_dir(). And that self.0.disable_cleanup(true); on panic is very cool.
My only question is whether thread_local! works for both cargo test and cargo nextest? I think so, but just wanted to check. If cargo test runs tests per process (as opposed to cargo nextest's per thread), then by default each test still gets a unique TESTDIR right?
|
Afaik |
|
I may have another idea on how to fix spirv-std 0.9.0 & 0.8.0, but I'd like this merged first to prevent potential conflicts |
TestEnvensures tests get separate cache dirs so they don't clobber themselves if run in parallelcargo nextest runnow workspartial cherry-pick from Divide project into library and binary parts, round 2 #117refactored that part laterspirv-toolsfails to build, see rust-gpu master / spirv-tools fails to build on latest nix rust-gpu#370)