@@ -678,10 +678,11 @@ function main()
678
678
// Run selected tests.
679
679
$ test_cnt = count ($ test_files );
680
680
681
+ verify_config ();
682
+ write_information ();
683
+
681
684
if ($ test_cnt ) {
682
685
putenv ('NO_INTERACTION=1 ' );
683
- verify_config ();
684
- write_information ();
685
686
usort ($ test_files , "test_sort " );
686
687
$ start_time = time ();
687
688
@@ -721,91 +722,78 @@ function main()
721
722
if ($ output_file != '' && $ just_save_results ) {
722
723
save_or_mail_results ();
723
724
}
724
-
725
- junit_save_xml ();
726
-
727
- if (getenv ('REPORT_EXIT_STATUS ' ) !== '0 ' &&
728
- getenv ('REPORT_EXIT_STATUS ' ) !== 'no ' && ($ sum_results ['FAILED ' ] || $ sum_results ['BORKED ' ] || $ sum_results ['LEAKED ' ])) {
729
- exit (1 );
725
+ } else {
726
+ // Compile a list of all test files (*.phpt).
727
+ $ test_files = array ();
728
+ $ exts_tested = count ($ exts_to_test );
729
+ $ exts_skipped = 0 ;
730
+ $ ignored_by_ext = 0 ;
731
+ sort ($ exts_to_test );
732
+ $ test_dirs = array ();
733
+ $ optionals = array ('Zend ' , 'tests ' , 'ext ' , 'sapi ' );
734
+
735
+ foreach ($ optionals as $ dir ) {
736
+ if (is_dir ($ dir )) {
737
+ $ test_dirs [] = $ dir ;
738
+ }
730
739
}
731
740
732
- return ;
733
- }
734
-
735
- verify_config ();
736
- write_information ();
737
-
738
- // Compile a list of all test files (*.phpt).
739
- $ test_files = array ();
740
- $ exts_tested = count ($ exts_to_test );
741
- $ exts_skipped = 0 ;
742
- $ ignored_by_ext = 0 ;
743
- sort ($ exts_to_test );
744
- $ test_dirs = array ();
745
- $ optionals = array ('Zend ' , 'tests ' , 'ext ' , 'sapi ' );
746
-
747
- foreach ($ optionals as $ dir ) {
748
- if (is_dir ($ dir )) {
749
- $ test_dirs [] = $ dir ;
741
+ // Convert extension names to lowercase
742
+ foreach ($ exts_to_test as $ key => $ val ) {
743
+ $ exts_to_test [$ key ] = strtolower ($ val );
750
744
}
751
- }
752
745
753
- // Convert extension names to lowercase
754
- foreach ($ exts_to_test as $ key => $ val ) {
755
- $ exts_to_test [$ key ] = strtolower ($ val );
756
- }
746
+ foreach ($ test_dirs as $ dir ) {
747
+ find_files (TEST_PHP_SRCDIR . "/ {$ dir }" , $ dir == 'ext ' );
748
+ }
757
749
758
- foreach ($ test_dirs as $ dir ) {
759
- find_files ( TEST_PHP_SRCDIR . " / { $ dir}" , $ dir == 'ext ' );
760
- }
750
+ foreach ($ user_tests as $ dir ) {
751
+ find_files ( $ dir , $ dir == 'ext ' );
752
+ }
761
753
762
- foreach ($ user_tests as $ dir ) {
763
- find_files ($ dir , $ dir == 'ext ' );
764
- }
754
+ $ test_files = array_unique ($ test_files );
755
+ usort ($ test_files , "test_sort " );
765
756
766
- $ test_files = array_unique ( $ test_files );
767
- usort ( $ test_files , " test_sort " );
757
+ $ start_time = time ( );
758
+ show_start ( $ start_time );
768
759
769
- $ start_time = time ();
770
- show_start ($ start_time );
760
+ $ test_cnt = count ($ test_files );
761
+ $ test_idx = 0 ;
762
+ run_all_tests ($ test_files , $ environment );
763
+ $ end_time = time ();
771
764
772
- $ test_cnt = count ($ test_files );
773
- $ test_idx = 0 ;
774
- run_all_tests ($ test_files , $ environment );
775
- $ end_time = time ();
765
+ if ($ failed_tests_file ) {
766
+ fclose ($ failed_tests_file );
767
+ }
776
768
777
- if ($ failed_tests_file ) {
778
- fclose ($ failed_tests_file );
779
- }
769
+ if ($ result_tests_file ) {
770
+ fclose ($ result_tests_file );
771
+ }
780
772
781
- if ($ result_tests_file ) {
782
- fclose ($ result_tests_file );
783
- }
773
+ // Summarize results
784
774
785
- // Summarize results
775
+ if (0 == count ($ test_results )) {
776
+ echo "No tests were run. \n" ;
777
+ return ;
778
+ }
786
779
787
- if (0 == count ($ test_results )) {
788
- echo "No tests were run. \n" ;
789
- return ;
790
- }
780
+ compute_summary ();
791
781
792
- compute_summary ();
782
+ show_end ($ end_time );
783
+ show_summary ();
793
784
794
- show_end ($ end_time );
795
- show_summary ();
785
+ if ($ html_output ) {
786
+ fclose ($ html_file );
787
+ }
796
788
797
- if ($ html_output ) {
798
- fclose ($ html_file );
789
+ save_or_mail_results ();
799
790
}
800
791
801
- save_or_mail_results ();
802
-
803
792
junit_save_xml ();
804
- if (getenv ('REPORT_EXIT_STATUS ' ) !== '0 ' &&
805
- getenv ( ' REPORT_EXIT_STATUS ' ) !== ' no ' && ($ sum_results ['FAILED ' ] || $ sum_results ['LEAKED ' ])) {
793
+ if (getenv ('REPORT_EXIT_STATUS ' ) !== '0 ' && getenv ( ' REPORT_EXIT_STATUS ' ) !== ' no ' &&
794
+ ($ sum_results ['FAILED ' ] || $ sum_results ['LEAKED ' ])) {
806
795
exit (1 );
807
796
}
808
- exit (0 );
809
797
}
810
798
811
799
if (!function_exists ("hrtime " )) {
0 commit comments