@@ -42,7 +42,7 @@ fn get_runners() -> Runners {
42
42
) ;
43
43
runners. insert ( "--extended-regex-tests" , ( "Run extended regex tests" , extended_regex_tests) ) ;
44
44
runners. insert ( "--mini-tests" , ( "Run mini tests" , mini_tests) ) ;
45
-
45
+ runners . insert ( "--cargo-tests" , ( "Run cargo tests" , cargo_tests ) ) ;
46
46
runners
47
47
}
48
48
@@ -203,6 +203,19 @@ fn clean(_env: &Env, args: &TestArg) -> Result<(), String> {
203
203
create_dir ( & path)
204
204
}
205
205
206
+ fn cargo_tests ( test_env : & Env , args : & TestArg ) -> Result < ( ) , String > {
207
+ // First, we call `mini_tests` to build minicore for us. This ensures we are testing with a working `minicore`,
208
+ // and that any changes we have made affect `minicore`(since it would get rebuilt).
209
+ mini_tests ( test_env, args) ?;
210
+ // Then, we copy the env vars from `test_env`
211
+ // We don't want to pass things like `RUSTFLAGS`, since they contain the -Zcodegen-backend flag.
212
+ // That would force `cg_gcc` to *rebuild itself* and only then run tests, which is undesirable.
213
+ let mut env = test_env. clone ( ) ;
214
+ env. remove ( "RUSTFLAGS" ) ;
215
+ // FIXME: maybe we could allow for only a select test to be run?
216
+ run_command_with_output_and_env ( & [ & "cargo" , & "test" ] , None , Some ( & env) ) ?;
217
+ Ok ( ( ) )
218
+ }
206
219
fn mini_tests ( env : & Env , args : & TestArg ) -> Result < ( ) , String > {
207
220
// FIXME: create a function "display_if_not_quiet" or something along the line.
208
221
println ! ( "[BUILD] mini_core" ) ;
@@ -1218,6 +1231,7 @@ fn run_all(env: &Env, args: &TestArg) -> Result<(), String> {
1218
1231
test_libcore ( env, args) ?;
1219
1232
extended_sysroot_tests ( env, args) ?;
1220
1233
test_rustc ( env, args) ?;
1234
+ cargo_tests ( env, args) ?;
1221
1235
Ok ( ( ) )
1222
1236
}
1223
1237
0 commit comments