summaryrefslogtreecommitdiff
path: root/run-tests.php
diff options
context:
space:
mode:
authorFabien Villepinte <fabien.villepinte@gmail.com>2019-09-28 17:48:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-30 17:52:43 +0200
commite49593a7c3159a5673ce74b4e5133f1264dc313f (patch)
tree0c61f064a88fb8ff4f3d057b569a03b1d88da311 /run-tests.php
parent235983dfdec11ddce1e67515a8acfa82778fc4f4 (diff)
downloadphp-git-e49593a7c3159a5673ce74b4e5133f1264dc313f.tar.gz
Mark test as borked when skipif produces invalid output
SKIPIF section should either output nothing, or start with a supported keyword like "skip". Mark all tests that don't do so as BORKED.
Diffstat (limited to 'run-tests.php')
-rwxr-xr-xrun-tests.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/run-tests.php b/run-tests.php
index 98ac24869c..1c7916d68d 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2135,7 +2135,8 @@ TEST $file
junit_start_timer($shortname);
- $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=0 \"$test_skipif\"", $env);
+ $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=1 \"$test_skipif\"", $env);
+ $output = trim($output);
junit_finish_timer($shortname);
@@ -2143,9 +2144,9 @@ TEST $file
@unlink($test_skipif);
}
- if (!strncasecmp('skip', ltrim($output), 4)) {
+ if (!strncasecmp('skip', $output, 4)) {
- if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
+ if (preg_match('/^skip\s*(.+)/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: $m[1]", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
@@ -2160,22 +2161,26 @@ TEST $file
return 'SKIPPED';
}
- if (!strncasecmp('info', ltrim($output), 4)) {
- if (preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) {
- $info = " (info: $m[1])";
- }
- }
-
- if (!strncasecmp('warn', ltrim($output), 4)) {
- if (preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) {
- $warn = true; /* only if there is a reason */
- $info = " (warn: $m[1])";
- }
- }
-
- if (!strncasecmp('xfail', ltrim($output), 5)) {
+ if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) {
+ $info = " (info: $m[1])";
+ } elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s*(.+)/i', $output, $m)) {
+ $warn = true; /* only if there is a reason */
+ $info = " (warn: $m[1])";
+ } elseif (!strncasecmp('xfail', $output, 5)) {
// Pretend we have an XFAIL section
- $section_text['XFAIL'] = trim(substr(ltrim($output), 5));
+ $section_text['XFAIL'] = ltrim(substr($output, 5));
+ } elseif ($output !== '') {
+ show_result("BORK", $output, $tested_file, 'reason: invalid output from SKIPIF', $temp_filenames);
+ $PHP_FAILED_TESTS['BORKED'][] = array(
+ 'name' => $file,
+ 'test_name' => '',
+ 'output' => '',
+ 'diff' => '',
+ 'info' => "$output [$file]",
+ );
+
+ junit_mark_test_as('BORK', $shortname, $tested, null, $output);
+ return 'BORKED';
}
}
}
@@ -2232,7 +2237,7 @@ TEST $file
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',
@@ -2250,7 +2255,7 @@ TEST $file
}
$bork_info = "Redirected test did not contain redirection info";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',