@@ -1099,7 +1099,9 @@ function find_files(string $dir, bool $is_ext_dir = false, bool $ignore = false)
1099
1099
}
1100
1100
1101
1101
// Otherwise we're only interested in *.phpt files.
1102
- if (substr ($ name , -5 ) == '.phpt ' ) {
1102
+ // (but not those starting with a dot, which are hidden on
1103
+ // many platforms)
1104
+ if (substr ($ name , -5 ) == '.phpt ' && substr ($ name , 0 , 1 ) !== '. ' ) {
1103
1105
if ($ ignore ) {
1104
1106
$ ignored_by_ext ++;
1105
1107
} else {
@@ -2507,14 +2509,16 @@ function run_test(string $php, $file, array $env): string
2507
2509
];
2508
2510
}
2509
2511
2512
+ // Remember CLEAN output to report borked test if it otherwise passes.
2513
+ $ clean_output = null ;
2510
2514
if ($ test ->sectionNotEmpty ('CLEAN ' ) && (!$ no_clean || $ cfg ['keep ' ]['clean ' ])) {
2511
2515
show_file_block ('clean ' , $ test ->getSection ('CLEAN ' ));
2512
2516
save_text ($ test_clean , trim ($ test ->getSection ('CLEAN ' )), $ temp_clean );
2513
2517
2514
2518
if (!$ no_clean ) {
2515
2519
$ extra = !IS_WINDOWS ?
2516
2520
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD; " : "" ;
2517
- system_with_timeout ("$ extra $ php $ pass_options $ extra_options -q $ orig_ini_settings $ no_file_cache \"$ test_clean \"" , $ env );
2521
+ $ clean_output = system_with_timeout ("$ extra $ orig_php $ pass_options -q $ orig_ini_settings $ no_file_cache \"$ test_clean \"" , $ env );
2518
2522
}
2519
2523
2520
2524
if (!$ cfg ['keep ' ]['clean ' ]) {
@@ -2666,25 +2670,6 @@ function run_test(string $php, $file, array $env): string
2666
2670
2667
2671
if (preg_match ("/^ $ wanted_re \$/s " , $ output )) {
2668
2672
$ passed = true ;
2669
- if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2670
- @unlink ($ test_file );
2671
- @unlink ($ preload_filename );
2672
- }
2673
- @unlink ($ tmp_post );
2674
-
2675
- if (!$ leaked && !$ failed_headers ) {
2676
- if ($ test ->hasSection ('XFAIL ' )) {
2677
- $ warn = true ;
2678
- $ info = " (warn: XFAIL section but test passes) " ;
2679
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2680
- $ warn = true ;
2681
- $ info = " (warn: XLEAK section but test passes) " ;
2682
- } else {
2683
- show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2684
- $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2685
- return 'PASSED ' ;
2686
- }
2687
- }
2688
2673
}
2689
2674
} else {
2690
2675
$ wanted = trim ($ test ->getSection ('EXPECT ' ));
@@ -2694,29 +2679,46 @@ function run_test(string $php, $file, array $env): string
2694
2679
// compare and leave on success
2695
2680
if (!strcmp ($ output , $ wanted )) {
2696
2681
$ passed = true ;
2682
+ }
2683
+
2684
+ $ wanted_re = null ;
2685
+ }
2686
+
2687
+ if ($ passed ) {
2688
+ if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2689
+ @unlink ($ test_file );
2690
+ @unlink ($ preload_filename );
2691
+ }
2692
+ @unlink ($ tmp_post );
2693
+
2694
+ if (!$ leaked && !$ failed_headers ) {
2695
+ // If the test passed and CLEAN produced output, report test as borked.
2696
+ if ($ clean_output ) {
2697
+ show_result ("BORK " , $ output , $ tested_file , 'reason: invalid output from CLEAN ' , $ temp_filenames );
2698
+ $ PHP_FAILED_TESTS ['BORKED ' ][] = [
2699
+ 'name ' => $ file ,
2700
+ 'test_name ' => '' ,
2701
+ 'output ' => '' ,
2702
+ 'diff ' => '' ,
2703
+ 'info ' => "$ clean_output [ $ file] " ,
2704
+ ];
2697
2705
2698
- if (!$ cfg ['keep ' ]['php ' ] && !$ leaked ) {
2699
- @unlink ($ test_file );
2700
- @unlink ($ preload_filename );
2706
+ $ junit ->markTestAs ('BORK ' , $ shortname , $ tested , null , $ clean_output );
2707
+ return 'BORKED ' ;
2701
2708
}
2702
- @unlink ($ tmp_post );
2703
2709
2704
- if (!$ leaked && !$ failed_headers ) {
2705
- if ($ test ->hasSection ('XFAIL ' )) {
2706
- $ warn = true ;
2707
- $ info = " (warn: XFAIL section but test passes) " ;
2708
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2709
- $ warn = true ;
2710
- $ info = " (warn: XLEAK section but test passes) " ;
2711
- } else {
2712
- show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2713
- $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2714
- return 'PASSED ' ;
2715
- }
2710
+ if ($ test ->hasSection ('XFAIL ' )) {
2711
+ $ warn = true ;
2712
+ $ info = " (warn: XFAIL section but test passes) " ;
2713
+ } elseif ($ test ->hasSection ('XLEAK ' )) {
2714
+ $ warn = true ;
2715
+ $ info = " (warn: XLEAK section but test passes) " ;
2716
+ } else {
2717
+ show_result ("PASS " , $ tested , $ tested_file , '' , $ temp_filenames );
2718
+ $ junit ->markTestAs ('PASS ' , $ shortname , $ tested );
2719
+ return 'PASSED ' ;
2716
2720
}
2717
2721
}
2718
-
2719
- $ wanted_re = null ;
2720
2722
}
2721
2723
2722
2724
// Test failed so we need to report details.
@@ -2801,6 +2803,9 @@ function run_test(string $php, $file, array $env): string
2801
2803
"gdb")
2802
2804
gdb --args {$ orig_cmd }
2803
2805
;;
2806
+ "lldb")
2807
+ lldb -- {$ orig_cmd }
2808
+ ;;
2804
2809
"valgrind")
2805
2810
USE_ZEND_ALLOC=0 valgrind $2 $ {orig_cmd}
2806
2811
;;
0 commit comments