Пример #1
0
            return $count > 0;
        }
    }
}
$dbg = new Dbg('log/regtest_dbg.log');
$ini = parse_ini_file('sdcc_rw.ini');
$regTestDb = new RegTestDB($ini['host'], $ini['username'], $ini['passwd'], $ini['dbname']);
if ($regTestDb->connect_error) {
    die('Connect failed: (' . $regTestDb->connect_errno . ') ' . $regTestDb->connect_error);
}
// walk through all directories in ./regression_test_results
$d = dir('./regression_test_results');
while (false !== ($entry = $d->read())) {
    //$dbg->dbg('Testing dir ' . $d->path . '/' . $entry);
    if (is_dir($d->path . '/' . $entry) && $entry[0] != '.') {
        $dbg->dbg('Processing dir ' . $d->path . '/' . $entry);
        $sd = dir($d->path . '/' . $entry);
        $platform = $entry;
        while (false !== ($sentry = $sd->read())) {
            //$dbg->dbg('  Testing file ' . $sd->path . '/' . $sentry);
            if (is_file($sd->path . '/' . $sentry)) {
                $matches = array();
                if (preg_match('/^regression-test-' . preg_quote($platform) . '-(\\d{8})-(\\d{4}).*\\.log$/', $sentry, &$matches)) {
                    //$dbg->dbg('  Opening file ' . $sd->path . '/' . $sentry);
                    $date = substr($matches[1], 0, 4) . '-' . substr($matches[1], 4, 2) . '-' . substr($matches[1], 6, 2);
                    $build_number = $matches[2];
                    if (!$regTestDb->is_file_updated($platform, $build_number, $date)) {
                        $handle = fopen($sd->path . '/' . $sentry, 'r');
                        if ($handle) {
                            $dbg->dbg('  Processing file ' . $sd->path . '/' . $sentry);
                            while (($line = fgets($handle)) !== false) {