File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/bootstrap/src/core/config Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2479,6 +2479,13 @@ fn find_correct_section_for_field(field_name: &str) -> Vec<WouldBeValidFor> {
2479
2479
. collect ( )
2480
2480
}
2481
2481
2482
+ /// Resolve the build directory used for tests.
2483
+ ///
2484
+ /// - When tests are run through bootstrap (`x.py test`), the build system
2485
+ /// sets `CARGO_TARGET_DIR`, so we can trust and use it here.
2486
+ /// - When tests are run directly with cargo test, `CARGO_TARGET_DIR` will
2487
+ /// not be set. In that case we fall back to resolving relative to
2488
+ /// `CARGO_MANIFEST_DIR`, by walking two parents up and appending `build`.
2482
2489
fn test_build_dir ( ) -> PathBuf {
2483
2490
env:: var_os ( "CARGO_TARGET_DIR" )
2484
2491
. map ( |value| Path :: new ( & value) . parent ( ) . unwrap ( ) . to_path_buf ( ) )
You can’t perform that action at this time.
0 commit comments