@@ -9,168 +9,6 @@ use crate::util::{copy_dir_all, dylib_env_var};
99
1010impl TestCx < ' _ > {
1111 pub ( super ) fn run_rmake_test ( & self ) {
12- let test_dir = & self . testpaths . file ;
13- if test_dir. join ( "rmake.rs" ) . exists ( ) {
14- self . run_rmake_v2_test ( ) ;
15- } else if test_dir. join ( "Makefile" ) . exists ( ) {
16- self . run_rmake_legacy_test ( ) ;
17- } else {
18- self . fatal ( "failed to find either `rmake.rs` or `Makefile`" )
19- }
20- }
21-
22- fn run_rmake_legacy_test ( & self ) {
23- let cwd = env:: current_dir ( ) . unwrap ( ) ;
24-
25- // FIXME(Zalathar): This should probably be `output_base_dir` to avoid
26- // an unnecessary extra subdirectory, but since legacy Makefile tests
27- // are hopefully going away, it seems safer to leave this perilous code
28- // as-is until it can all be deleted.
29- let tmpdir = cwd. join ( self . output_base_name ( ) ) ;
30- ignore_not_found ( || recursive_remove ( & tmpdir) ) . unwrap ( ) ;
31-
32- fs:: create_dir_all ( & tmpdir) . unwrap ( ) ;
33-
34- let host = & self . config . host ;
35- let make = if host. contains ( "dragonfly" )
36- || host. contains ( "freebsd" )
37- || host. contains ( "netbsd" )
38- || host. contains ( "openbsd" )
39- || host. contains ( "aix" )
40- {
41- "gmake"
42- } else {
43- "make"
44- } ;
45-
46- let mut cmd = Command :: new ( make) ;
47- cmd. current_dir ( & self . testpaths . file )
48- . stdout ( Stdio :: piped ( ) )
49- . stderr ( Stdio :: piped ( ) )
50- . env ( "TARGET" , & self . config . target )
51- . env ( "PYTHON" , & self . config . python )
52- . env ( "S" , & self . config . src_root )
53- . env ( "RUST_BUILD_STAGE" , & self . config . stage_id )
54- . env ( "RUSTC" , cwd. join ( & self . config . rustc_path ) )
55- . env ( "TMPDIR" , & tmpdir)
56- . env ( "LD_LIB_PATH_ENVVAR" , dylib_env_var ( ) )
57- . env ( "HOST_RPATH_DIR" , cwd. join ( & self . config . compile_lib_path ) )
58- . env ( "TARGET_RPATH_DIR" , cwd. join ( & self . config . run_lib_path ) )
59- . env ( "LLVM_COMPONENTS" , & self . config . llvm_components )
60- // We for sure don't want these tests to run in parallel, so make
61- // sure they don't have access to these vars if we run via `make`
62- // at the top level
63- . env_remove ( "MAKEFLAGS" )
64- . env_remove ( "MFLAGS" )
65- . env_remove ( "CARGO_MAKEFLAGS" ) ;
66-
67- if let Some ( ref cargo) = self . config . cargo_path {
68- cmd. env ( "CARGO" , cwd. join ( cargo) ) ;
69- }
70-
71- if let Some ( ref rustdoc) = self . config . rustdoc_path {
72- cmd. env ( "RUSTDOC" , cwd. join ( rustdoc) ) ;
73- }
74-
75- if let Some ( ref node) = self . config . nodejs {
76- cmd. env ( "NODE" , node) ;
77- }
78-
79- if let Some ( ref linker) = self . config . target_linker {
80- cmd. env ( "RUSTC_LINKER" , linker) ;
81- }
82-
83- if let Some ( ref clang) = self . config . run_clang_based_tests_with {
84- cmd. env ( "CLANG" , clang) ;
85- }
86-
87- if let Some ( ref filecheck) = self . config . llvm_filecheck {
88- cmd. env ( "LLVM_FILECHECK" , filecheck) ;
89- }
90-
91- if let Some ( ref llvm_bin_dir) = self . config . llvm_bin_dir {
92- cmd. env ( "LLVM_BIN_DIR" , llvm_bin_dir) ;
93- }
94-
95- if let Some ( ref remote_test_client) = self . config . remote_test_client {
96- cmd. env ( "REMOTE_TEST_CLIENT" , remote_test_client) ;
97- }
98-
99- // We don't want RUSTFLAGS set from the outside to interfere with
100- // compiler flags set in the test cases:
101- cmd. env_remove ( "RUSTFLAGS" ) ;
102-
103- // Use dynamic musl for tests because static doesn't allow creating dylibs
104- if self . config . host . contains ( "musl" ) {
105- cmd. env ( "RUSTFLAGS" , "-Ctarget-feature=-crt-static" ) . env ( "IS_MUSL_HOST" , "1" ) ;
106- }
107-
108- if self . config . bless {
109- cmd. env ( "RUSTC_BLESS_TEST" , "--bless" ) ;
110- // Assume this option is active if the environment variable is "defined", with _any_ value.
111- // As an example, a `Makefile` can use this option by:
112- //
113- // ifdef RUSTC_BLESS_TEST
114- // cp "$(TMPDIR)"/actual_something.ext expected_something.ext
115- // else
116- // $(DIFF) expected_something.ext "$(TMPDIR)"/actual_something.ext
117- // endif
118- }
119-
120- if self . config . target . contains ( "msvc" ) && !self . config . cc . is_empty ( ) {
121- // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
122- // and that `lib.exe` lives next to it.
123- let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
124-
125- // MSYS doesn't like passing flags of the form `/foo` as it thinks it's
126- // a path and instead passes `C:\msys64\foo`, so convert all
127- // `/`-arguments to MSVC here to `-` arguments.
128- let cflags = self
129- . config
130- . cflags
131- . split ( ' ' )
132- . map ( |s| s. replace ( "/" , "-" ) )
133- . collect :: < Vec < _ > > ( )
134- . join ( " " ) ;
135- let cxxflags = self
136- . config
137- . cxxflags
138- . split ( ' ' )
139- . map ( |s| s. replace ( "/" , "-" ) )
140- . collect :: < Vec < _ > > ( )
141- . join ( " " ) ;
142-
143- cmd. env ( "IS_MSVC" , "1" )
144- . env ( "IS_WINDOWS" , "1" )
145- . env ( "MSVC_LIB" , format ! ( "'{}' -nologo" , lib. display( ) ) )
146- . env ( "MSVC_LIB_PATH" , format ! ( "{}" , lib. display( ) ) )
147- . env ( "CC" , format ! ( "'{}' {}" , self . config. cc, cflags) )
148- . env ( "CXX" , format ! ( "'{}' {}" , & self . config. cxx, cxxflags) ) ;
149- } else {
150- cmd. env ( "CC" , format ! ( "{} {}" , self . config. cc, self . config. cflags) )
151- . env ( "CXX" , format ! ( "{} {}" , self . config. cxx, self . config. cxxflags) )
152- . env ( "AR" , & self . config . ar ) ;
153-
154- if self . config . target . contains ( "windows" ) {
155- cmd. env ( "IS_WINDOWS" , "1" ) ;
156- }
157- }
158-
159- let ( output, truncated) =
160- self . read2_abbreviated ( cmd. spawn ( ) . expect ( "failed to spawn `make`" ) ) ;
161- if !output. status . success ( ) {
162- let res = ProcRes {
163- status : output. status ,
164- stdout : String :: from_utf8_lossy ( & output. stdout ) . into_owned ( ) ,
165- stderr : String :: from_utf8_lossy ( & output. stderr ) . into_owned ( ) ,
166- truncated,
167- cmdline : format ! ( "{:?}" , cmd) ,
168- } ;
169- self . fatal_proc_rec ( "make failed" , & res) ;
170- }
171- }
172-
173- fn run_rmake_v2_test ( & self ) {
17412 // For `run-make` V2, we need to perform 2 steps to build and run a `run-make` V2 recipe
17513 // (`rmake.rs`) to run the actual tests. The support library is already built as a tool rust
17614 // library and is available under `build/$TARGET/stageN-tools-bin/librun_make_support.rlib`.
@@ -191,8 +29,6 @@ impl TestCx<'_> {
19129 // recipes to `remove_dir_all($TMPDIR)` without running into issues related trying to remove
19230 // a currently running executable because the recipe executable is not under the
19331 // `rmake_out/` directory.
194- //
195- // This setup intentionally diverges from legacy Makefile run-make tests.
19632 let base_dir = self . output_base_dir ( ) ;
19733 ignore_not_found ( || recursive_remove ( & base_dir) ) . unwrap ( ) ;
19834
0 commit comments