Files
php-gtk-src/test/bugrunner.php
Christian Weiske 0d3fb6ee85 Small test suite for bugs.
To use it:
- install xautomation program (xte) from http://hoopajoo.net/projects/xautomation.html
- copy bugconfig.php.in to bugconfig.php and change the location of your
   php5 executable
- run bugrunner.php: It will execute all bug_*.phpw.
- If this scripts echo 'ok' means that everything was ok, the bug doesn't
   exist any more. However, if anything other than 'ok' is echoed: The bug
   still exists.
- All the single bug scripts can be run with "debug" as parameter
   which shows the real error message

I know that it's not nice, but it works for now.
2005-07-29 21:27:46 +00:00

46 lines
1008 B
PHP

<?php
/**
* Executes all the bug files and checks the output
*
* Each bug file can be run with a "debug" as parameter
* and will put out the error message
*/
require_once('bugconfig.php');
$counter = array('passed' => 0, 'error' => 0);
function runBugfile($file)
{
global $counter;
$lastline = trim(exec(PHP_EXECUTABLE . ' ' . $file));
if ($lastline == 'ok') {
$status = 'passed';
} else {
$status = 'error';
}
echo str_pad($file, 60, ' ') . $status . "\r\n";
$counter[$status]++;
}
function percent($value, $all)
{
if ($all == 0 || $value == 0) {
return ' 0.00';
}
return number_format(100 / $all * $value, 2);
}
$files = glob('bug_*.phpw');
foreach ($files as $bugfile)
{
runBugfile($bugfile);
}
echo "\r\nScore:\r\n";
$sum = array_sum($counter);
foreach ($counter as $id => $value) {
echo ' ' . str_pad($id, 7, ' ') . ': ' . str_pad($value, 5, ' ', STR_PAD_LEFT) . ' (' . percent($value, $sum) . '%)' . "\r\n";
}
?>