Skip to content

Commit 1a7e716

Browse files
committed
MFH: Add warning level for tests.
1 parent bdcd417 commit 1a7e716

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

run-tests.php

+17-3
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function test_sort($a, $b) {
298298
$n_total = count($test_results);
299299
$n_total += $ignored_by_ext;
300300

301-
$sum_results = array('PASSED'=>0, 'SKIPPED'=>0, 'FAILED'=>0);
301+
$sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 'FAILED'=>0);
302302
foreach ($test_results as $v) {
303303
$sum_results[$v]++;
304304
}
@@ -321,6 +321,7 @@ function test_sort($a, $b) {
321321
---------------------------------------------------------------------
322322
Number of tests : " . sprintf("%4d",$n_total) . "
323323
Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . "
324+
Tests warned : " . sprintf("%4d (%2.1f%%)",$sum_results['WARNED'],$percent_results['WARNED']) . "
324325
Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . "
325326
Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . "
326327
---------------------------------------------------------------------
@@ -593,6 +594,7 @@ function run_test($php,$file)
593594

594595
// Check if test should be skipped.
595596
$info = '';
597+
$warn = false;
596598
if (array_key_exists('SKIPIF', $section_text)) {
597599
if (trim($section_text['SKIPIF'])) {
598600
save_text($tmp_skipif, $section_text['SKIPIF']);
@@ -615,6 +617,14 @@ function run_test($php,$file)
615617
$tested .= $info;
616618
}
617619
}
620+
if (eregi("^warn", trim($output))) {
621+
$reason = (ereg("^warn[[:space:]]*(.+)\$", trim($output))) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
622+
if ($reason) {
623+
$warn = true; /* only if there is a reason */
624+
$info = " (warn: $reason)";
625+
$tested .= $info;
626+
}
627+
}
618628
}
619629
}
620630

@@ -728,7 +738,11 @@ function run_test($php,$file)
728738
}
729739

730740
// Test failed so we need to report details.
731-
echo "FAIL $tested\n";
741+
if ($warn) {
742+
echo "WARN $tested\n";
743+
} else {
744+
echo "FAIL $tested\n";
745+
}
732746

733747
$GLOBALS['__PHP_FAILED_TESTS__'][] = array(
734748
'name' => $file,
@@ -777,7 +791,7 @@ function run_test($php,$file)
777791
error_report($file,$logname,$tested);
778792
}
779793

780-
return 'FAILED';
794+
return $warn ? 'WARNED' : 'FAILED';
781795
}
782796

783797
function generate_diff($wanted,$output)

0 commit comments

Comments
 (0)