@@ -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
@@ -1850,6 +1850,18 @@ function skip_test(string $tested, string $tested_file, string $shortname, strin
1850
1850
return 'SKIPPED ' ;
1851
1851
}
1852
1852
1853
+ function skip_ext_test (string $ tested , string $ tested_file , string $ shortname , array $ missing_exts ) {
1854
+ global $ junit ;
1855
+
1856
+ $ reason = 'Required extension ' . (count ($ missing_exts ) > 1 ? 's ' : '' )
1857
+ . ' missing: ' . implode (', ' , $ missing_exts );
1858
+
1859
+ show_result ('SKIP_EXT ' , $ tested , $ tested_file , "reason: $ reason " );
1860
+ $ junit ->initSuite ($ junit ->getSuiteName ($ shortname ));
1861
+ $ junit ->markTestAs ('SKIP_EXT ' , $ shortname , $ tested , 0 , $ reason );
1862
+ return 'SKIPPED_EXT ' ;
1863
+ }
1864
+
1853
1865
//
1854
1866
// Run an individual test case.
1855
1867
//
@@ -2115,9 +2127,7 @@ function run_test(string $php, $file, array $env): string
2115
2127
}
2116
2128
}
2117
2129
if ($ missing ) {
2118
- $ message = 'Required extension ' . (count ($ missing ) > 1 ? 's ' : '' )
2119
- . ' missing: ' . implode (', ' , $ missing );
2120
- return skip_test ($ tested , $ tested_file , $ shortname , $ message );
2130
+ return skip_ext_test ($ tested , $ tested_file , $ shortname , $ missing );
2121
2131
}
2122
2132
}
2123
2133
@@ -3098,6 +3108,7 @@ function compute_summary(): void
3098
3108
'PASSED ' => 0 ,
3099
3109
'WARNED ' => 0 ,
3100
3110
'SKIPPED ' => 0 ,
3111
+ 'SKIPPED_EXT ' => 0 ,
3101
3112
'FAILED ' => 0 ,
3102
3113
'BORKED ' => 0 ,
3103
3114
'LEAKED ' => 0 ,
@@ -3120,7 +3131,7 @@ function get_summary(bool $show_ext_summary): string
3120
3131
{
3121
3132
global $ n_total , $ sum_results , $ percent_results , $ end_time , $ start_time , $ failed_test_summary , $ PHP_FAILED_TESTS , $ valgrind ;
3122
3133
3123
- $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['BORKED ' ];
3134
+ $ x_total = $ n_total - $ sum_results ['SKIPPED ' ] - $ sum_results ['SKIPPED_EXT ' ] - $ sum_results [ ' BORKED ' ];
3124
3135
3125
3136
if ($ x_total ) {
3126
3137
$ x_warned = (100.0 * $ sum_results ['WARNED ' ]) / $ x_total ;
@@ -3144,36 +3155,37 @@ function get_summary(bool $show_ext_summary): string
3144
3155
}
3145
3156
3146
3157
$ summary .=
3147
- 'Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3158
+ 'Number of tests : ' . sprintf ('%4d ' , $ n_total ) . ' ' . sprintf ('%8d ' , $ x_total );
3148
3159
3149
3160
if ($ sum_results ['BORKED ' ]) {
3150
3161
$ summary .= '
3151
- Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3162
+ Tests borked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['BORKED ' ], $ percent_results ['BORKED ' ]) . ' -------- ' ;
3152
3163
}
3153
3164
3154
3165
$ summary .= '
3155
- Tests skipped : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3156
- Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3157
- Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3166
+ Tests skipped by ext: ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED_EXT ' ], $ percent_results ['SKIPPED_EXT ' ]) . ' --------
3167
+ Tests skipped other : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['SKIPPED ' ], $ percent_results ['SKIPPED ' ]) . ' --------
3168
+ Tests warned : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['WARNED ' ], $ percent_results ['WARNED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_warned ) . '
3169
+ Tests failed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['FAILED ' ], $ percent_results ['FAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_failed );
3158
3170
3159
3171
if ($ sum_results ['XFAILED ' ]) {
3160
3172
$ summary .= '
3161
- Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3173
+ Expected fail : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XFAILED ' ], $ percent_results ['XFAILED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xfailed );
3162
3174
}
3163
3175
3164
3176
if ($ valgrind ) {
3165
3177
$ summary .= '
3166
- Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3178
+ Tests leaked : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['LEAKED ' ], $ percent_results ['LEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_leaked );
3167
3179
if ($ sum_results ['XLEAKED ' ]) {
3168
3180
$ summary .= '
3169
- Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3181
+ Expected leak : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['XLEAKED ' ], $ percent_results ['XLEAKED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_xleaked );
3170
3182
}
3171
3183
}
3172
3184
3173
3185
$ summary .= '
3174
- Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3186
+ Tests passed : ' . sprintf ('%4d (%5.1f%%) ' , $ sum_results ['PASSED ' ], $ percent_results ['PASSED ' ]) . ' ' . sprintf ('(%5.1f%%) ' , $ x_passed ) . '
3175
3187
---------------------------------------------------------------------
3176
- Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3188
+ Time taken : ' . sprintf ('%4d seconds ' , $ end_time - $ start_time ) . '
3177
3189
=====================================================================
3178
3190
' ;
3179
3191
$ failed_test_summary = '' ;
@@ -3395,6 +3407,7 @@ class JUnit
3395
3407
'test_fail ' => 0 ,
3396
3408
'test_error ' => 0 ,
3397
3409
'test_skip ' => 0 ,
3410
+ 'test_skip_ext ' => 0 ,
3398
3411
'test_warn ' => 0 ,
3399
3412
'files ' => [],
3400
3413
'execution_time ' => 0 ,
@@ -3432,12 +3445,13 @@ public function saveXML(): void
3432
3445
3433
3446
$ xml = '< ' . '? ' . 'xml version="1.0" encoding="UTF-8" ' . '? ' . '> ' . PHP_EOL ;
3434
3447
$ xml .= sprintf (
3435
- '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3448
+ '<testsuites name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3436
3449
$ this ->rootSuite ['name ' ],
3437
3450
$ this ->rootSuite ['test_total ' ],
3438
3451
$ this ->rootSuite ['test_fail ' ],
3439
3452
$ this ->rootSuite ['test_error ' ],
3440
3453
$ this ->rootSuite ['test_skip ' ],
3454
+ $ this ->rootSuite ['test_skip_ext ' ],
3441
3455
$ this ->rootSuite ['execution_time ' ]
3442
3456
);
3443
3457
$ xml .= $ this ->getSuitesXML ();
@@ -3452,12 +3466,13 @@ private function getSuitesXML(string $suite_name = '')
3452
3466
3453
3467
foreach ($ this ->suites as $ suite_name => $ suite ) {
3454
3468
$ result .= sprintf (
3455
- '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" time="%s"> ' . PHP_EOL ,
3469
+ '<testsuite name="%s" tests="%s" failures="%d" errors="%d" skip="%d" skip_ext="%d" time="%s"> ' . PHP_EOL ,
3456
3470
$ suite ['name ' ],
3457
3471
$ suite ['test_total ' ],
3458
3472
$ suite ['test_fail ' ],
3459
3473
$ suite ['test_error ' ],
3460
3474
$ suite ['test_skip ' ],
3475
+ $ suite ['test_skip_ext ' ],
3461
3476
$ suite ['execution_time ' ]
3462
3477
);
3463
3478
@@ -3517,6 +3532,9 @@ public function markTestAs(
3517
3532
} elseif ('SKIP ' == $ type ) {
3518
3533
$ this ->record ($ suite , 'test_skip ' );
3519
3534
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped> $ escaped_message</skipped> \n" ;
3535
+ } elseif ('SKIP_EXP ' == $ type ) {
3536
+ $ this ->record ($ suite , 'test_skip_ext ' );
3537
+ $ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<skipped_ext> $ escaped_message</skipped_ext> \n" ;
3520
3538
} elseif ('WARN ' == $ type ) {
3521
3539
$ this ->record ($ suite , 'test_warn ' );
3522
3540
$ this ->rootSuite ['files ' ][$ file_name ]['xml ' ] .= "<warning> $ escaped_message</warning> \n" ;
@@ -3660,6 +3678,7 @@ private function mergeSuites(array &$dest, array $source): void
3660
3678
$ dest ['test_fail ' ] += $ source ['test_fail ' ];
3661
3679
$ dest ['test_error ' ] += $ source ['test_error ' ];
3662
3680
$ dest ['test_skip ' ] += $ source ['test_skip ' ];
3681
+ $ dest ['test_skip_ext ' ] += $ source ['test_skip_ext ' ];
3663
3682
$ dest ['test_warn ' ] += $ source ['test_warn ' ];
3664
3683
$ dest ['execution_time ' ] += $ source ['execution_time ' ];
3665
3684
$ dest ['files ' ] += $ source ['files ' ];
0 commit comments