diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-01-16 16:29:32 -0800 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2020-01-16 16:54:00 -0800 |
| commit | 6246f7e1f90f1b72d5b9b530df2ee81beeb09f20 (patch) | |
| tree | b55fb84675d072e618f443187a0e962864239665 /src/libtest | |
| parent | ecbc222855c890c3aabe4848e8d8b312debcf0ff (diff) | |
Don't propagate __RUST_TEST_INVOKE to subprocess
When -Z panic_abort_tests is enabled, we use an environment variable to tell the subprocess which test to invoke. If that subprocess then invokes another Rust test binary, chaos ensues.
Diffstat (limited to 'src/libtest')
| -rw-r--r-- | src/libtest/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 45669d120c7..7782f62d6ed 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -153,12 +153,13 @@ pub fn test_main_static_abort(tests: &[&TestDescAndFn]) { // If we're being run in SpawnedSecondary mode, run the test here. run_test // will then exit the process. if let Ok(name) = env::var(SECONDARY_TEST_INVOKER_VAR) { + env::remove_var(SECONDARY_TEST_INVOKER_VAR); let test = tests .iter() .filter(|test| test.desc.name.as_slice() == name) .map(make_owned_test) .next() - .expect("couldn't find a test with the provided name"); + .expect(&format!("couldn't find a test with the provided name '{}'", name)); let TestDescAndFn { desc, testfn } = test; let testfn = match testfn { StaticTestFn(f) => f, |
