File tree Expand file tree Collapse file tree 4 files changed +26
-6
lines changed
crates/cargo-test-support/src Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -1383,6 +1383,11 @@ pub trait TestEnvCommandExt: Sized {
13831383 self = self . env_remove ( & k) ;
13841384 }
13851385 }
1386+ for ( k, _v) in env:: vars ( ) {
1387+ if k. starts_with ( "RUSTUP_" ) {
1388+ self = self . env_remove ( & k) ;
1389+ }
1390+ }
13861391 if env:: var_os ( "RUSTUP_TOOLCHAIN" ) . is_some ( ) {
13871392 // Override the PATH to avoid executing the rustup wrapper thousands
13881393 // of times. This makes the testsuite run substantially faster.
Original file line number Diff line number Diff line change 112112 p. process ( make) . env ( "CARGO" , cargo_exe ( ) ) . arg ( "-j2" ) . run ( ) ;
113113}
114114
115+ #[ allow( clippy:: disallowed_methods) ]
115116#[ cargo_test]
116117fn runner_inherits_jobserver ( ) {
117118 let make = make_exe ( ) ;
@@ -196,7 +197,8 @@ test-runner:
196197 . arg ( "run" )
197198 . arg ( "-j2" )
198199 . run ( ) ;
199- p. process ( make)
200+ let mut process = p. process ( make) ;
201+ process
200202 . env ( "PATH" , path)
201203 . env ( "CARGO" , cargo_exe ( ) )
202204 . arg ( "run-runner" )
@@ -206,14 +208,18 @@ test-runner:
206208[RUNNING] `runner target/debug/cargo-jobserver-check[EXE]`
207209this is a runner
208210
209- "# ] ] )
210- . run ( ) ;
211+ "# ] ] ) ;
212+ if let Some ( val) = env:: var_os ( "RUSTUP_HOME" ) {
213+ process. env ( "RUSTUP_HOME" , val) ;
214+ }
215+ process. run ( ) ;
211216 p. process ( make)
212217 . env ( "CARGO" , cargo_exe ( ) )
213218 . arg ( "test" )
214219 . arg ( "-j2" )
215220 . run ( ) ;
216- p. process ( make)
221+ let mut process = p. process ( make) ;
222+ process
217223 . env ( "PATH" , path)
218224 . env ( "CARGO" , cargo_exe ( ) )
219225 . arg ( "test-runner" )
@@ -223,8 +229,11 @@ this is a runner
223229[RUNNING] unittests src/lib.rs (target/debug/deps/cargo_jobserver_check-[HASH][EXE])
224230this is a runner
225231
226- "# ] ] )
227- . run ( ) ;
232+ "# ] ] ) ;
233+ if let Some ( val) = env:: var_os ( "RUSTUP_HOME" ) {
234+ process. env ( "RUSTUP_HOME" , val) ;
235+ }
236+ process. run ( ) ;
228237
229238 // but not from `-j` flag
230239 p. cargo ( "run -j2" )
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ impl CargoProjectExt for Project {
2323 let cargo = cargo_exe ( ) ;
2424 let mut execs = self . process ( & cargo) ;
2525 execs. env ( "CARGO" , cargo) ;
26+ if let Some ( val) = std:: env:: var_os ( "RUSTUP_HOME" ) {
27+ execs. env ( "RUSTUP_HOME" , val) ;
28+ }
2629 execs. arg_line ( cmd) ;
2730 execs
2831 }
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ pub fn cargo_process(arg_line: &str) -> Execs {
1111 let cargo = cargo_exe ( ) ;
1212 let mut p = process ( & cargo) ;
1313 p. env ( "CARGO" , cargo) ;
14+ if let Some ( val) = std:: env:: var_os ( "RUSTUP_HOME" ) {
15+ p. env ( "RUSTUP_HOME" , val) ;
16+ }
1417 p. arg_line ( arg_line) ;
1518 execs ( ) . with_process_builder ( p)
1619}
You can’t perform that action at this time.
0 commit comments