@@ -929,7 +929,7 @@ where
929
929
fn file_handling ( file : & Path ) -> Result < ( ) , String > {
930
930
let path_str = file. display ( ) . to_string ( ) . replace ( "\\ " , "/" ) ;
931
931
if !path_str. ends_with ( ".rs" ) {
932
- return Ok ( ( ) )
932
+ return Ok ( ( ) ) ;
933
933
} else if should_not_remove_test ( & path_str) {
934
934
return Ok ( ( ) ) ;
935
935
} else if should_remove_test ( file, & path_str) {
@@ -1052,35 +1052,48 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1052
1052
Some ( Path :: new ( "rust" ) ) ,
1053
1053
) ?;
1054
1054
// Putting back only the failing ones.
1055
- run_command (
1056
- & [
1057
- & "xargs" ,
1058
- & "-a" ,
1059
- & "../failing-ui-tests.txt" ,
1060
- & "-d'\n '" ,
1061
- & "git" ,
1062
- & "checkout" ,
1063
- & "--" ,
1064
- ] ,
1065
- Some ( Path :: new ( "rust" ) ) ,
1066
- ) ?;
1055
+ let path = "failing-ui-tests.txt" ;
1056
+ if let Ok ( files) = std:: fs:: read_to_string ( path) {
1057
+ for file in files
1058
+ . split ( '\n' )
1059
+ . map ( |line| line. trim ( ) )
1060
+ . filter ( |line| !line. is_empty ( ) )
1061
+ {
1062
+ run_command (
1063
+ & [ & "git" , & "checkout" , & "--" , & file] ,
1064
+ Some ( Path :: new ( "rust" ) ) ,
1065
+ ) ?;
1066
+ }
1067
+ } else {
1068
+ println ! (
1069
+ "Failed to read `{}`, not putting back failing ui tests" ,
1070
+ path
1071
+ ) ;
1072
+ }
1067
1073
Ok ( true )
1068
1074
} )
1069
1075
}
1070
1076
1071
1077
fn test_successful_rustc ( env : & Env , args : & TestArg ) -> Result < ( ) , String > {
1072
1078
test_rustc_inner ( env, args, || {
1073
1079
// Removing the failing tests.
1074
- run_command (
1075
- & [
1076
- & "xargs" ,
1077
- & "-a" ,
1078
- & "../failing-ui-tests.txt" ,
1079
- & "-d'\n '" ,
1080
- & "rm" ,
1081
- ] ,
1082
- Some ( Path :: new ( "rust" ) ) ,
1083
- ) ?;
1080
+ let path = "failing-ui-tests.txt" ;
1081
+ if let Ok ( files) = std:: fs:: read_to_string ( path) {
1082
+ for file in files
1083
+ . split ( '\n' )
1084
+ . map ( |line| line. trim ( ) )
1085
+ . filter ( |line| !line. is_empty ( ) )
1086
+ {
1087
+ let path = Path :: new ( "rust" ) . join ( file) ;
1088
+ std:: fs:: remove_file ( & path)
1089
+ . map_err ( |error| format ! ( "failed to remove `{}`: {:?}" , path. display( ) , error) ) ?;
1090
+ }
1091
+ } else {
1092
+ println ! (
1093
+ "Failed to read `{}`, not putting back failing ui tests" ,
1094
+ path
1095
+ ) ;
1096
+ }
1084
1097
Ok ( true )
1085
1098
} )
1086
1099
}
0 commit comments