@@ -9,8 +9,8 @@ use crate::build;
9
9
use crate :: config:: { Channel , ConfigInfo } ;
10
10
use crate :: utils:: {
11
11
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
12
- run_command, run_command_with_env, run_command_with_output_and_env , rustc_version_info ,
13
- split_args, walk_dir,
12
+ run_command, run_command_with_env, run_command_with_output , run_command_with_output_and_env ,
13
+ rustc_version_info , split_args, walk_dir,
14
14
} ;
15
15
16
16
type Env = HashMap < String , String > ;
@@ -484,6 +484,31 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
484
484
} else {
485
485
run_command_with_output_and_env ( & [ & "git" , & "checkout" ] , rust_dir, Some ( env) ) ?;
486
486
}
487
+
488
+ let mut patches = Vec :: new ( ) ;
489
+ walk_dir (
490
+ "patches/tests" ,
491
+ & mut |_| Ok ( ( ) ) ,
492
+ & mut |file_path : & Path | {
493
+ patches. push ( file_path. to_path_buf ( ) ) ;
494
+ Ok ( ( ) )
495
+ } ,
496
+ false ,
497
+ ) ?;
498
+ patches. sort ( ) ;
499
+ // TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
500
+ // module.
501
+ for file_path in patches {
502
+ println ! ( "[GIT] apply `{}`" , file_path. display( ) ) ;
503
+ let path = Path :: new ( "../.." ) . join ( file_path) ;
504
+ run_command_with_output ( & [ & "git" , & "apply" , & path] , rust_dir) ?;
505
+ run_command_with_output ( & [ & "git" , & "add" , & "-A" ] , rust_dir) ?;
506
+ run_command_with_output (
507
+ & [ & "git" , & "commit" , & "--no-gpg-sign" , & "-m" , & format ! ( "Patch {}" , path. display( ) ) ] ,
508
+ rust_dir,
509
+ ) ?;
510
+ }
511
+
487
512
let cargo = String :: from_utf8 (
488
513
run_command_with_env ( & [ & "rustup" , & "which" , & "cargo" ] , rust_dir, Some ( env) ) ?. stdout ,
489
514
)
@@ -509,14 +534,17 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
509
534
which FileCheck-11 || \
510
535
which FileCheck-12 || \
511
536
which FileCheck-13 || \
512
- which FileCheck-14",
537
+ which FileCheck-14 || \
538
+ which FileCheck",
513
539
] ,
514
540
rust_dir,
515
541
Some ( env) ,
516
542
) {
517
543
Ok ( cmd) => String :: from_utf8_lossy ( & cmd. stdout ) . to_string ( ) ,
518
544
Err ( _) => {
519
545
eprintln ! ( "Failed to retrieve LLVM FileCheck, ignoring..." ) ;
546
+ // FIXME: the test tests/run-make/no-builtins-attribute will fail if we cannot find
547
+ // FileCheck.
520
548
String :: new ( )
521
549
}
522
550
} ;
@@ -1089,19 +1117,18 @@ where
1089
1117
}
1090
1118
1091
1119
fn test_rustc ( env : & Env , args : & TestArg ) -> Result < ( ) , String > {
1092
- // test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
1120
+ test_rustc_inner ( env, args, |_| Ok ( false ) , false , "run-make" ) ?;
1093
1121
test_rustc_inner ( env, args, |_| Ok ( false ) , false , "ui" )
1094
1122
}
1095
1123
1096
1124
fn test_failing_rustc ( env : & Env , args : & TestArg ) -> Result < ( ) , String > {
1097
- let result1 = Ok ( ( ) ) ;
1098
- /*test_rustc_inner(
1125
+ let result1 = test_rustc_inner (
1099
1126
env,
1100
1127
args,
1101
1128
retain_files_callback ( "tests/failing-run-make-tests.txt" , "run-make" ) ,
1102
1129
false ,
1103
1130
"run-make" ,
1104
- )*/
1131
+ ) ;
1105
1132
1106
1133
let result2 = test_rustc_inner (
1107
1134
env,
@@ -1122,14 +1149,13 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1122
1149
false ,
1123
1150
"ui" ,
1124
1151
) ?;
1125
- Ok ( ( ) )
1126
- /*test_rustc_inner(
1152
+ test_rustc_inner (
1127
1153
env,
1128
1154
args,
1129
1155
remove_files_callback ( "tests/failing-run-make-tests.txt" , "run-make" ) ,
1130
1156
false ,
1131
1157
"run-make" ,
1132
- )*/
1158
+ )
1133
1159
}
1134
1160
1135
1161
fn test_failing_ui_pattern_tests ( env : & Env , args : & TestArg ) -> Result < ( ) , String > {
0 commit comments