@@ -69,7 +69,7 @@ function show_usage(): void
69
69
with value 'bar').
70
70
71
71
-g Comma separated list of groups to show during test run
72
- (possible values: PASS, FAIL, XFAIL, XLEAK, SKIP, BORK, WARN, LEAK, REDIRECT).
72
+ (possible values: PASS, FAIL, XFAIL, XLEAK, SKIP, SKIP_EXT, BORK, WARN, LEAK, REDIRECT).
73
73
74
74
-m Test for memory leaks with Valgrind (equivalent to -M memcheck).
75
75
@@ -1773,6 +1773,18 @@ function skip_test(string $tested, string $tested_file, string $shortname, strin
1773
1773
return 'SKIPPED ' ;
1774
1774
}
1775
1775
1776
+ function skip_ext_test (string $ tested , string $ tested_file , string $ shortname , array $ missing_exts ) {
1777
+ global $ junit ;
1778
+
1779
+ $ reason = 'Required extension ' . (count ($ missing_exts ) > 1 ? 's ' : '' )
1780
+ . ' missing: ' . implode (', ' , $ missing_exts );
1781
+
1782
+ show_result ('SKIP_EXT ' , $ tested , $ tested_file , "reason: $ reason " );
1783
+ $ junit ->initSuite ($ junit ->getSuiteName ($ shortname ));
1784
+ $ junit ->markTestAs ('SKIP_EXT ' , $ shortname , $ tested , 0 , $ reason );
1785
+ return 'SKIPPED_EXT ' ;
1786
+ }
1787
+
1776
1788
//
1777
1789
// Run an individual test case.
1778
1790
//
@@ -2042,9 +2054,7 @@ function run_test(string $php, $file, array $env): string
2042
2054
}
2043
2055
}
2044
2056
if ($ missing ) {
2045
- $ message = 'Required extension ' . (count ($ missing ) > 1 ? 's ' : '' )
2046
- . ' missing: ' . implode (', ' , $ missing );
2047
- return skip_test ($ tested , $ tested_file , $ shortname , $ message );
2057
+ return skip_ext_test ($ tested , $ tested_file , $ shortname , $ missing );
2048
2058
}
2049
2059
}
2050
2060
@@ -3037,6 +3047,7 @@ function compute_summary(): void
3037
3047
'PASSED ' => 0 ,
3038
3048
'WARNED ' => 0 ,
3039
3049
'SKIPPED ' => 0 ,
3050
+ 'SKIPPED_EXT ' => 0 ,
3040
3051
'FAILED ' => 0 ,
3041
3052
'BORKED ' => 0 ,
3042
3053
'LEAKED ' => 0 ,
@@ -3060,7 +3071,7 @@ function get_summary(bool $show_ext_summary): string
3060
3071
{
3061
3072
global $ n_total , $ sum_results , $ percent_results , $ end_time , $ start_time , $ failed_test_summary , $ PHP_FAILED_TESTS , $ valgrind ;
3062
3073
3063
- $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['BORKED ' ];
3074
+ $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['SKIPPED_EXT ' ] - $ sum_results [ ' BORKED ' ];
3064
3075
3065
3076
if ($ x_total ) {
3066
3077
$ x_warned = (100.0 * $ sum_results ['WARNED ' ]) / $ x_total ;
@@ -3083,37 +3094,38 @@ function get_summary(bool $show_ext_summary): string
3083
3094
' ;
3084
3095
}
3085
3096
3086
- $ summary .= '
3087
- Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3097
+ $ summary .=
3098
+ ' Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3088
3099
3089
3100
if ($ sum_results ['BORKED ' ]) {
3090
3101
$ summary .= '
3091
- Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3102
+ Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3092
3103
}
3093
3104
3094
3105
$ summary .= '
3095
- Tests skipped : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3096
- Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3097
- Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3106
+ Tests skipped by ext: ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED_EXT ' ], $ percent_results ['SKIPPED_EXT ' ]) . ' --------
3107
+ Tests skipped other : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3108
+ Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3109
+ Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3098
3110
3099
3111
if ($ sum_results ['XFAILED ' ]) {
3100
3112
$ summary .= '
3101
- Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3113
+ Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3102
3114
}
3103
3115
3104
3116
if ($ valgrind ) {
3105
3117
$ summary .= '
3106
- Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3118
+ Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3107
3119
if ($ sum_results ['XLEAKED ' ]) {
3108
3120
$ summary .= '
3109
- Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3121
+ Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3110
3122
}
3111
3123
}
3112
3124
3113
3125
$ summary .= '
3114
- Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3126
+ Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3115
3127
---------------------------------------------------------------------
3116
- Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3128
+ Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3117
3129
=====================================================================
3118
3130
' ;
3119
3131
$ failed_test_summary = '' ;
@@ -3334,6 +3346,7 @@ class JUnit
3334
3346
'test_fail ' => 0 ,
3335
3347
'test_error ' => 0 ,
3336
3348
'test_skip ' => 0 ,
3349
+ 'test_skip_ext ' => 0 ,
3337
3350
'test_warn ' => 0 ,
3338
3351
'files ' => [],
3339
3352
'execution_time ' => 0 ,
@@ -3374,12 +3387,13 @@ public function saveXML(): void
3374
3387
3375
3388
$ xml = '< ' . '? ' . 'xml version="1.0" encoding="UTF-8" ' . '? ' . '> ' . PHP_EOL ;
3376
3389
$ xml .= sprintf (
3377
- '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3390
+ '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3378
3391
$ this ->rootSuite ['name ' ],
3379
3392
$ this ->rootSuite ['test_total ' ],
3380
3393
$ this ->rootSuite ['test_fail ' ],
3381
3394
$ this ->rootSuite ['test_error ' ],
3382
3395
$ this ->rootSuite ['test_skip ' ],
3396
+ $ this ->rootSuite ['test_skip_ext ' ],
3383
3397
$ this ->rootSuite ['execution_time ' ]
3384
3398
);
3385
3399
$ xml .= $ this ->getSuitesXML ();
@@ -3394,12 +3408,13 @@ private function getSuitesXML(string $suite_name = '')
3394
3408
3395
3409
foreach ($ this ->suites as $ suite_name => $ suite ) {
3396
3410
$ result .= sprintf (
3397
- '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3411
+ '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3398
3412
$ suite ['name ' ],
3399
3413
$ suite ['test_total ' ],
3400
3414
$ suite ['test_fail ' ],
3401
3415
$ suite ['test_error ' ],
3402
3416
$ suite ['test_skip ' ],
3417
+ $ suite ['test_skip_ext ' ],
3403
3418
$ suite ['execution_time ' ]
3404
3419
);
3405
3420
@@ -3459,6 +3474,9 @@ public function markTestAs(
3459
3474
} elseif ('SKIP ' == $ type ) {
3460
3475
$ this ->record ($ suite , 'test_skip ' );
3461
3476
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped> $ escaped_message</skipped> \n" ;
3477
+ } elseif ('SKIP_EXP ' == $ type ) {
3478
+ $ this ->record ($ suite , 'test_skip_ext ' );
3479
+ $ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped_ext> $ escaped_message</skipped_ext> \n" ;
3462
3480
} elseif ('WARN ' == $ type ) {
3463
3481
$ this ->record ($ suite , 'test_warn ' );
3464
3482
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<warning> $ escaped_message</warning> \n" ;
@@ -3605,6 +3623,7 @@ private function mergeSuites(array &$dest, array $source): void
3605
3623
$ dest ['test_fail ' ] += $ source ['test_fail ' ];
3606
3624
$ dest ['test_error ' ] += $ source ['test_error ' ];
3607
3625
$ dest ['test_skip ' ] += $ source ['test_skip ' ];
3626
+ $ dest ['test_skip_ext ' ] += $ source ['test_skip_ext ' ];
3608
3627
$ dest ['test_warn ' ] += $ source ['test_warn ' ];
3609
3628
$ dest ['execution_time ' ] += $ source ['execution_time ' ];
3610
3629
$ dest ['files ' ] += $ source ['files ' ];
0 commit comments