@@ -131,6 +131,7 @@ function show_usage(): void
131
131
Run the tests multiple times in the same process and check the
132
132
output of the last execution (CLI SAPI only).
133
133
134
+ --bless Bless failed tests using scripts/dev/bless_tests.php.
134
135
135
136
HELP ;
136
137
}
@@ -157,7 +158,8 @@ function main(): void
157
158
$ repeat , $ result_tests_file , $ slow_min_ms , $ start_time , $ switch ,
158
159
$ temp_source , $ temp_target , $ test_cnt , $ test_dirs ,
159
160
$ test_files , $ test_idx , $ test_list , $ test_results , $ testfile ,
160
- $ user_tests , $ valgrind , $ sum_results , $ shuffle , $ file_cache , $ num_repeats ;
161
+ $ user_tests , $ valgrind , $ sum_results , $ shuffle , $ file_cache , $ num_repeats ,
162
+ $ bless ;
161
163
// Parallel testing
162
164
global $ workers , $ workerID ;
163
165
global $ context_line_count ;
@@ -357,6 +359,7 @@ function main(): void
357
359
$ preload = false ;
358
360
$ file_cache = null ;
359
361
$ shuffle = false ;
362
+ $ bless = false ;
360
363
$ workers = null ;
361
364
$ context_line_count = 3 ;
362
365
$ num_repeats = 1 ;
@@ -582,6 +585,9 @@ function main(): void
582
585
$ num_repeats = (int ) $ argv [++$ i ];
583
586
$ environment ['SKIP_REPEAT ' ] = 1 ;
584
587
break ;
588
+ case '--bless ' :
589
+ $ bless = true ;
590
+ break ;
585
591
//case 'w'
586
592
case '- ' :
587
593
// repeat check with full switch
@@ -782,6 +788,9 @@ function main(): void
782
788
}
783
789
784
790
$ junit ->saveXML ();
791
+ if ($ bless ) {
792
+ bless_failed_tests ($ PHP_FAILED_TESTS ['FAILED ' ]);
793
+ }
785
794
if (getenv ('REPORT_EXIT_STATUS ' ) !== '0 ' && getenv ('REPORT_EXIT_STATUS ' ) !== 'no ' &&
786
795
($ sum_results ['FAILED ' ] || $ sum_results ['BORKED ' ] || $ sum_results ['LEAKED ' ])) {
787
796
exit (1 );
@@ -3996,4 +4005,19 @@ function check_proc_open_function_exists(): void
3996
4005
}
3997
4006
}
3998
4007
4008
+ function bless_failed_tests (array $ failedTests ): void
4009
+ {
4010
+ if (empty ($ failedTests )) {
4011
+ return ;
4012
+ }
4013
+ $ args = [
4014
+ PHP_BINARY ,
4015
+ __DIR__ . '/scripts/dev/bless_tests.php ' ,
4016
+ ];
4017
+ foreach ($ failedTests as $ test ) {
4018
+ $ args [] = $ test ['name ' ];
4019
+ }
4020
+ proc_open ($ args , [], $ pipes );
4021
+ }
4022
+
3999
4023
main ();
0 commit comments