@@ -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
@@ -1768,6 +1768,18 @@ function skip_test(string $tested, string $tested_file, string $shortname, strin
1768
1768
return 'SKIPPED ' ;
1769
1769
}
1770
1770
1771
+ function skip_ext_test (string $ tested , string $ tested_file , string $ shortname , array $ missing_exts ) {
1772
+ global $ junit ;
1773
+
1774
+ $ reason = 'Required extension ' . (count ($ missing_exts ) > 1 ? 's ' : '' )
1775
+ . ' missing: ' . implode (', ' , $ missing_exts );
1776
+
1777
+ show_result ('SKIP_EXT ' , $ tested , $ tested_file , "reason: $ reason " );
1778
+ $ junit ->initSuite ($ junit ->getSuiteName ($ shortname ));
1779
+ $ junit ->markTestAs ('SKIP_EXT ' , $ shortname , $ tested , 0 , $ reason );
1780
+ return 'SKIPPED_EXT ' ;
1781
+ }
1782
+
1771
1783
//
1772
1784
// Run an individual test case.
1773
1785
//
@@ -2037,9 +2049,7 @@ function run_test(string $php, $file, array $env): string
2037
2049
}
2038
2050
}
2039
2051
if ($ missing ) {
2040
- $ message = 'Required extension ' . (count ($ missing ) > 1 ? 's ' : '' )
2041
- . ' missing: ' . implode (', ' , $ missing );
2042
- return skip_test ($ tested , $ tested_file , $ shortname , $ message );
2052
+ return skip_ext_test ($ tested , $ tested_file , $ shortname , $ missing );
2043
2053
}
2044
2054
}
2045
2055
@@ -3031,6 +3041,7 @@ function compute_summary(): void
3031
3041
'PASSED ' => 0 ,
3032
3042
'WARNED ' => 0 ,
3033
3043
'SKIPPED ' => 0 ,
3044
+ 'SKIPPED_EXT ' => 0 ,
3034
3045
'FAILED ' => 0 ,
3035
3046
'BORKED ' => 0 ,
3036
3047
'LEAKED ' => 0 ,
@@ -3053,7 +3064,7 @@ function get_summary(bool $show_ext_summary): string
3053
3064
{
3054
3065
global $ n_total , $ sum_results , $ percent_results , $ end_time , $ start_time , $ failed_test_summary , $ PHP_FAILED_TESTS , $ valgrind ;
3055
3066
3056
- $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['BORKED ' ];
3067
+ $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['SKIPPED_EXT ' ] - $ sum_results [ ' BORKED ' ];
3057
3068
3058
3069
if ($ x_total ) {
3059
3070
$ x_warned = (100.0 * $ sum_results ['WARNED ' ]) / $ x_total ;
@@ -3077,36 +3088,37 @@ function get_summary(bool $show_ext_summary): string
3077
3088
}
3078
3089
3079
3090
$ summary .=
3080
- 'Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3091
+ 'Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3081
3092
3082
3093
if ($ sum_results ['BORKED ' ]) {
3083
3094
$ summary .= '
3084
- Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3095
+ Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3085
3096
}
3086
3097
3087
3098
$ summary .= '
3088
- Tests skipped : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3089
- Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3090
- Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3099
+ Tests skipped by ext: ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED_EXT ' ], $ percent_results ['SKIPPED_EXT ' ]) . ' --------
3100
+ Tests skipped other : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3101
+ Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3102
+ Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3091
3103
3092
3104
if ($ sum_results ['XFAILED ' ]) {
3093
3105
$ summary .= '
3094
- Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3106
+ Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3095
3107
}
3096
3108
3097
3109
if ($ valgrind ) {
3098
3110
$ summary .= '
3099
- Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3111
+ Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3100
3112
if ($ sum_results ['XLEAKED ' ]) {
3101
3113
$ summary .= '
3102
- Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3114
+ Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3103
3115
}
3104
3116
}
3105
3117
3106
3118
$ summary .= '
3107
- Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3119
+ Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3108
3120
---------------------------------------------------------------------
3109
- Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3121
+ Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3110
3122
=====================================================================
3111
3123
' ;
3112
3124
$ failed_test_summary = '' ;
@@ -3327,6 +3339,7 @@ class JUnit
3327
3339
'test_fail ' => 0 ,
3328
3340
'test_error ' => 0 ,
3329
3341
'test_skip ' => 0 ,
3342
+ 'test_skip_ext ' => 0 ,
3330
3343
'test_warn ' => 0 ,
3331
3344
'files ' => [],
3332
3345
'execution_time ' => 0 ,
@@ -3367,12 +3380,13 @@ public function saveXML(): void
3367
3380
3368
3381
$ xml = '< ' . '? ' . 'xml version="1.0" encoding="UTF-8" ' . '? ' . '> ' . PHP_EOL ;
3369
3382
$ xml .= sprintf (
3370
- '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3383
+ '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3371
3384
$ this ->rootSuite ['name ' ],
3372
3385
$ this ->rootSuite ['test_total ' ],
3373
3386
$ this ->rootSuite ['test_fail ' ],
3374
3387
$ this ->rootSuite ['test_error ' ],
3375
3388
$ this ->rootSuite ['test_skip ' ],
3389
+ $ this ->rootSuite ['test_skip_ext ' ],
3376
3390
$ this ->rootSuite ['execution_time ' ]
3377
3391
);
3378
3392
$ xml .= $ this ->getSuitesXML ();
@@ -3387,12 +3401,13 @@ private function getSuitesXML(string $suite_name = '')
3387
3401
3388
3402
foreach ($ this ->suites as $ suite_name => $ suite ) {
3389
3403
$ result .= sprintf (
3390
- '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3404
+ '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3391
3405
$ suite ['name ' ],
3392
3406
$ suite ['test_total ' ],
3393
3407
$ suite ['test_fail ' ],
3394
3408
$ suite ['test_error ' ],
3395
3409
$ suite ['test_skip ' ],
3410
+ $ suite ['test_skip_ext ' ],
3396
3411
$ suite ['execution_time ' ]
3397
3412
);
3398
3413
@@ -3452,6 +3467,9 @@ public function markTestAs(
3452
3467
} elseif ('SKIP ' == $ type ) {
3453
3468
$ this ->record ($ suite , 'test_skip ' );
3454
3469
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped> $ escaped_message</skipped> \n" ;
3470
+ } elseif ('SKIP_EXP ' == $ type ) {
3471
+ $ this ->record ($ suite , 'test_skip_ext ' );
3472
+ $ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped_ext> $ escaped_message</skipped_ext> \n" ;
3455
3473
} elseif ('WARN ' == $ type ) {
3456
3474
$ this ->record ($ suite , 'test_warn ' );
3457
3475
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<warning> $ escaped_message</warning> \n" ;
@@ -3598,6 +3616,7 @@ private function mergeSuites(array &$dest, array $source): void
3598
3616
$ dest ['test_fail ' ] += $ source ['test_fail ' ];
3599
3617
$ dest ['test_error ' ] += $ source ['test_error ' ];
3600
3618
$ dest ['test_skip ' ] += $ source ['test_skip ' ];
3619
+ $ dest ['test_skip_ext ' ] += $ source ['test_skip_ext ' ];
3601
3620
$ dest ['test_warn ' ] += $ source ['test_warn ' ];
3602
3621
$ dest ['execution_time ' ] += $ source ['execution_time ' ];
3603
3622
$ dest ['files ' ] += $ source ['files ' ];
0 commit comments