Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 11c5630b2c8f00f64861e0dac51a202a > files > 67

php-gtk2-2.0.1-12mdv2010.0.i586.rpm

<?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";
}

?>