Skip to content

Commit f50783d

Browse files
committed
Only report CLEAN output as BORKED if test passed
1 parent 6f08348 commit f50783d

File tree

1 file changed

+38
-52
lines changed

1 file changed

+38
-52
lines changed

run-tests.php

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,28 +2495,16 @@ function run_test(string $php, $file, array $env): string
24952495
];
24962496
}
24972497

2498+
// Remember CLEAN output to report borked test if it otherwise passes.
2499+
$clean_output = null;
24982500
if ($test->sectionNotEmpty('CLEAN') && (!$no_clean || $cfg['keep']['clean'])) {
24992501
show_file_block('clean', $test->getSection('CLEAN'));
25002502
save_text($test_clean, trim($test->getSection('CLEAN')), $temp_clean);
25012503

25022504
if (!$no_clean) {
25032505
$extra = !IS_WINDOWS ?
25042506
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
2505-
$output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache \"$test_clean\"", $env);
2506-
2507-
if ($output) {
2508-
show_result("BORK", $output, $tested_file, 'reason: invalid output from CLEAN', $temp_filenames);
2509-
$PHP_FAILED_TESTS['BORKED'][] = [
2510-
'name' => $file,
2511-
'test_name' => '',
2512-
'output' => '',
2513-
'diff' => '',
2514-
'info' => "$output [$file]",
2515-
];
2516-
2517-
$junit->markTestAs('BORK', $shortname, $tested, null, $output);
2518-
return 'BORKED';
2519-
}
2507+
$clean_output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache \"$test_clean\"", $env);
25202508
}
25212509

25222510
if (!$cfg['keep']['clean']) {
@@ -2668,25 +2656,6 @@ function run_test(string $php, $file, array $env): string
26682656

26692657
if (preg_match("/^$wanted_re\$/s", $output)) {
26702658
$passed = true;
2671-
if (!$cfg['keep']['php'] && !$leaked) {
2672-
@unlink($test_file);
2673-
@unlink($preload_filename);
2674-
}
2675-
@unlink($tmp_post);
2676-
2677-
if (!$leaked && !$failed_headers) {
2678-
if ($test->hasSection('XFAIL')) {
2679-
$warn = true;
2680-
$info = " (warn: XFAIL section but test passes)";
2681-
} elseif ($test->hasSection('XLEAK')) {
2682-
$warn = true;
2683-
$info = " (warn: XLEAK section but test passes)";
2684-
} else {
2685-
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
2686-
$junit->markTestAs('PASS', $shortname, $tested);
2687-
return 'PASSED';
2688-
}
2689-
}
26902659
}
26912660
} else {
26922661
$wanted = trim($test->getSection('EXPECT'));
@@ -2696,29 +2665,46 @@ function run_test(string $php, $file, array $env): string
26962665
// compare and leave on success
26972666
if (!strcmp($output, $wanted)) {
26982667
$passed = true;
2668+
}
2669+
2670+
$wanted_re = null;
2671+
}
2672+
2673+
if ($passed) {
2674+
if (!$cfg['keep']['php'] && !$leaked) {
2675+
@unlink($test_file);
2676+
@unlink($preload_filename);
2677+
}
2678+
@unlink($tmp_post);
26992679

2700-
if (!$cfg['keep']['php'] && !$leaked) {
2701-
@unlink($test_file);
2702-
@unlink($preload_filename);
2680+
if (!$leaked && !$failed_headers) {
2681+
// If the test passed and CLEAN produced output, report test as borked.
2682+
if ($clean_output) {
2683+
show_result("BORK", $output, $tested_file, 'reason: invalid output from CLEAN', $temp_filenames);
2684+
$PHP_FAILED_TESTS['BORKED'][] = [
2685+
'name' => $file,
2686+
'test_name' => '',
2687+
'output' => '',
2688+
'diff' => '',
2689+
'info' => "$clean_output [$file]",
2690+
];
2691+
2692+
$junit->markTestAs('BORK', $shortname, $tested, null, $clean_output);
2693+
return 'BORKED';
27032694
}
2704-
@unlink($tmp_post);
27052695

2706-
if (!$leaked && !$failed_headers) {
2707-
if ($test->hasSection('XFAIL')) {
2708-
$warn = true;
2709-
$info = " (warn: XFAIL section but test passes)";
2710-
} elseif ($test->hasSection('XLEAK')) {
2711-
$warn = true;
2712-
$info = " (warn: XLEAK section but test passes)";
2713-
} else {
2714-
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
2715-
$junit->markTestAs('PASS', $shortname, $tested);
2716-
return 'PASSED';
2717-
}
2696+
if ($test->hasSection('XFAIL')) {
2697+
$warn = true;
2698+
$info = " (warn: XFAIL section but test passes)";
2699+
} elseif ($test->hasSection('XLEAK')) {
2700+
$warn = true;
2701+
$info = " (warn: XLEAK section but test passes)";
2702+
} else {
2703+
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
2704+
$junit->markTestAs('PASS', $shortname, $tested);
2705+
return 'PASSED';
27182706
}
27192707
}
2720-
2721-
$wanted_re = null;
27222708
}
27232709

27242710
// Test failed so we need to report details.

0 commit comments

Comments
 (0)