@@ -2495,28 +2495,16 @@ function run_test(string $php, $file, array $env): string
2495
2495
];
2496
2496
}
2497
2497
2498
+ // Remember CLEAN output to report borked test if it otherwise passes.
2499
+ $ clean_output = null ;
2498
2500
if ($ test ->sectionNotEmpty ('CLEAN ' ) && (!$ no_clean || $ cfg ['keep ' ]['clean ' ])) {
2499
2501
show_file_block ('clean ' , $ test ->getSection ('CLEAN ' ));
2500
2502
save_text ($ test_clean , trim ($ test ->getSection ('CLEAN ' )), $ temp_clean );
2501
2503
2502
2504
if (!$ no_clean ) {
2503
2505
$ extra = !IS_WINDOWS ?
2504
2506
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD; " : "" ;
2505
- $ output = system_with_timeout ("$ extra $ php $ pass_options $ extra_options -q $ orig_ini_settings $ no_file_cache \"$ test_clean \"" , $ env );
2506
-
2507
- if ($ output ) {
2508
- show_result ("BORK " , $ output , $ tested_file , 'reason: invalid output from CLEAN ' , $ temp_filenames );
2509
- $ PHP_FAILED_TESTS ['BORKED ' ][] = [
2510
- 'name ' => $ file ,
2511
- 'test_name ' => '' ,
2512
- 'output ' => '' ,
2513
- 'diff ' => '' ,
2514
- 'info ' => "$ output [ $ file] " ,
2515
- ];
2516
-
2517
- $ junit ->markTestAs ('BORK ' , $ shortname , $ tested , null , $ output );
2518
- return 'BORKED ' ;
2519
- }
2507
+ $ clean_output = system_with_timeout ("$ extra $ php $ pass_options $ extra_options -q $ orig_ini_settings $ no_file_cache \"$ test_clean \"" , $ env );
2520
2508
}
2521
2509
2522
2510
if (!$ cfg ['keep ' ]['clean ' ]) {
@@ -2668,25 +2656,6 @@ function run_test(string $php, $file, array $env): string
2668
2656
2669
2657
if (preg_match ("/^ $ wanted_re \$/s " , $ output )) {
2670
2658
$ passed = true ;
2671
- if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2672
- @unlink ($ test_file );
2673
- @unlink ($ preload_filename );
2674
- }
2675
- @unlink ($ tmp_post );
2676
-
2677
- if (!$ leaked && !$ failed_headers ) {
2678
- if ($ test ->hasSection ('XFAIL ' )) {
2679
- $ warn = true ;
2680
- $ info = " (warn: XFAIL section but test passes) " ;
2681
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2682
- $ warn = true ;
2683
- $ info = " (warn: XLEAK section but test passes) " ;
2684
- } else {
2685
- show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2686
- $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2687
- return 'PASSED ' ;
2688
- }
2689
- }
2690
2659
}
2691
2660
} else {
2692
2661
$ wanted = trim ($ test ->getSection ('EXPECT ' ));
@@ -2696,29 +2665,46 @@ function run_test(string $php, $file, array $env): string
2696
2665
// compare and leave on success
2697
2666
if (!strcmp ($ output , $ wanted )) {
2698
2667
$ passed = true ;
2668
+ }
2669
+
2670
+ $ wanted_re = null ;
2671
+ }
2672
+
2673
+ if ($ passed ) {
2674
+ if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2675
+ @unlink ($ test_file );
2676
+ @unlink ($ preload_filename );
2677
+ }
2678
+ @unlink ($ tmp_post );
2699
2679
2700
- if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2701
- @unlink ($ test_file );
2702
- @unlink ($ preload_filename );
2680
+ if (!$ leaked && !$ failed_headers ) {
2681
+ // If the test passed and CLEAN produced output, report test as borked.
2682
+ if ($ clean_output ) {
2683
+ show_result ("BORK " , $ output , $ tested_file , 'reason: invalid output from CLEAN ' , $ temp_filenames );
2684
+ $ PHP_FAILED_TESTS ['BORKED ' ][] = [
2685
+ 'name ' => $ file ,
2686
+ 'test_name ' => '' ,
2687
+ 'output ' => '' ,
2688
+ 'diff ' => '' ,
2689
+ 'info ' => "$ clean_output [ $ file] " ,
2690
+ ];
2691
+
2692
+ $ junit ->markTestAs ('BORK ' , $ shortname , $ tested , null , $ clean_output );
2693
+ return 'BORKED ' ;
2703
2694
}
2704
- @unlink ($ tmp_post );
2705
2695
2706
- if (!$ leaked && !$ failed_headers ) {
2707
- if ($ test ->hasSection ('XFAIL ' )) {
2708
- $ warn = true ;
2709
- $ info = " (warn: XFAIL section but test passes) " ;
2710
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2711
- $ warn = true ;
2712
- $ info = " (warn: XLEAK section but test passes) " ;
2713
- } else {
2714
- show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2715
- $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2716
- return 'PASSED ' ;
2717
- }
2696
+ if ($ test ->hasSection ('XFAIL ' )) {
2697
+ $ warn = true ;
2698
+ $ info = " (warn: XFAIL section but test passes) " ;
2699
+ } elseif ($ test ->hasSection ('XLEAK ' )) {
2700
+ $ warn = true ;
2701
+ $ info = " (warn: XLEAK section but test passes) " ;
2702
+ } else {
2703
+ show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2704
+ $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2705
+ return 'PASSED ' ;
2718
2706
}
2719
2707
}
2720
-
2721
- $ wanted_re = null ;
2722
2708
}
2723
2709
2724
2710
// Test failed so we need to report details.
0 commit comments