@@ -39,7 +39,11 @@ fn prepare_test_specific_dir() -> PathBuf {
3939 // Replace "::" with "_" to make it safe for directory names on Windows systems
4040 let test_path = current. name ( ) . unwrap ( ) . replace ( "::" , "_" ) ;
4141
42- let testdir = parse ( "" ) . tempdir ( ) . join ( test_path) ;
42+ let testdir = crate :: utils:: tests:: TestCtx :: new ( )
43+ . config ( "check" )
44+ . create_config ( )
45+ . tempdir ( )
46+ . join ( test_path) ;
4347
4448 // clean up any old test files
4549 let _ = fs:: remove_dir_all ( & testdir) ;
@@ -64,62 +68,6 @@ fn download_ci_llvm() {
6468 }
6569}
6670
67- // FIXME(onur-ozkan): extend scope of the test
68- // refs:
69- // - https://github.com/rust-lang/rust/issues/109120
70- // - https://github.com/rust-lang/rust/pull/109162#issuecomment-1496782487
71- #[ test]
72- fn detect_src_and_out ( ) {
73- fn test ( cfg : Config , build_dir : Option < & str > ) {
74- // This will bring absolute form of `src/bootstrap` path
75- let current_dir = std:: env:: current_dir ( ) . unwrap ( ) ;
76-
77- // get `src` by moving into project root path
78- let expected_src = current_dir. ancestors ( ) . nth ( 2 ) . unwrap ( ) ;
79- assert_eq ! ( & cfg. src, expected_src) ;
80-
81- // Sanity check for `src`
82- let manifest_dir = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
83- let expected_src = manifest_dir. ancestors ( ) . nth ( 2 ) . unwrap ( ) ;
84- assert_eq ! ( & cfg. src, expected_src) ;
85-
86- // test if build-dir was manually given in bootstrap.toml
87- if let Some ( custom_build_dir) = build_dir {
88- assert_eq ! ( & cfg. out, Path :: new( custom_build_dir) ) ;
89- }
90- // test the native bootstrap way
91- else {
92- // This should bring output path of bootstrap in absolute form
93- let cargo_target_dir = env:: var_os ( "CARGO_TARGET_DIR" ) . expect (
94- "CARGO_TARGET_DIR must been provided for the test environment from bootstrap" ,
95- ) ;
96-
97- // Move to `build` from `build/bootstrap`
98- let expected_out = Path :: new ( & cargo_target_dir) . parent ( ) . unwrap ( ) ;
99- assert_eq ! ( & cfg. out, expected_out) ;
100-
101- let args: Vec < String > = env:: args ( ) . collect ( ) ;
102-
103- // Another test for `out` as a sanity check
104- //
105- // This will bring something similar to:
106- // `{build-dir}/bootstrap/debug/deps/bootstrap-c7ee91d5661e2804`
107- // `{build-dir}` can be anywhere, not just in the rust project directory.
108- let dep = Path :: new ( args. first ( ) . unwrap ( ) ) ;
109- let expected_out = dep. ancestors ( ) . nth ( 5 ) . unwrap ( ) ;
110-
111- assert_eq ! ( & cfg. out, expected_out) ;
112- }
113- }
114-
115- test ( parse ( "" ) , None ) ;
116-
117- {
118- let build_dir = if cfg ! ( windows) { "C:\\ tmp" } else { "/tmp" } ;
119- test ( parse ( & format ! ( "build.build-dir = '{build_dir}'" ) ) , Some ( build_dir) ) ;
120- }
121- }
122-
12371#[ test]
12472fn clap_verify ( ) {
12573 Flags :: command ( ) . debug_assert ( ) ;
0 commit comments