Modified: web/qa/trunk/reports/details.php
===================================================================
--- web/qa/trunk/reports/details.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/details.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,116 +1,122 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-$startTime = microtime(true);
-include "../include/functions.php";
-include "../include/release-qa.php";
-
-// sanitize
-if (!preg_match('@^[a-z0-9]{32}$@', $_GET['signature'])) {
- exit('Invalid signature');
-}
-
-if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
- exit('invalid version');
-}
-
-$signature = $_GET['signature'];
-$version = $_GET['version'];
-
-$DBFILE = dirname(__FILE__).'/db/'.$version.'.sqlite';
-
-$database = new SQLite3($DBFILE, SQLITE3_OPEN_READONLY);
-
-if (!$database) {
- $error = (file_exists($yourfile)) ? "Impossible to open, check permissions" : "Impossible to create, check permissions";
- die("Error: ".$error);
-}
-
-// GET infos from DB
-$query = 'SELECT reports.* FROM failed JOIN reports ON reports.id=failed.id_report WHERE signature=X\''.$signature.'\'';
-
-$q = $database->query($query);
-$reportsArray = array();
-while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
- $reportsArray[$tab['id']] = $tab;
-}
-
-$tab = $database->query('SELECT test_name FROM failed WHERE signature=X\''.$signature.'\' LIMIT 1');
-list($testName) = $tab->fetchArray(SQLITE3_NUM);
-
-// We stop everything
-$database->close();
-
-$TITLE = "Report details";
-common_header();
-?>
-
-
-
List of reports associated
-
Test name:
-
Version:
-
-
-
-
-
- | Date |
- Failed tests |
- Email |
- |
-
-
-'."\n";
- echo ' '.$report['date'].' | '."\n";
- echo ' '.$report['nb_failed'].' | '."\n";
- echo ' ***'.strstr($report['user_email'], ' at ').' | '."\n";
- echo '  | '."\n";
- echo ' '."\n";
- }
-
-?>
-
-
-
-
-
-
Goto: PHPInfo Build environment
-
-
PHPInfo
';
- echo $reportsArray[$idreport]['phpinfo'];
- echo '
';
- echo '
Build environment
';
- echo str_replace($reportsArray[$idreport]['user_email'], '*** (truncated on purpose) ***', $reportsArray[$idreport]['build_env']);
-
-}
-
-
-echo '
';
-$SITE_UPDATE = "
Generated in ".round((microtime(true)-$startTime)*1000)." ms";
-common_footer();
+ |
+# +----------------------------------------------------------------------+
+# $Id$
+
+$startTime = microtime(true);
+include "../include/functions.php";
+include "../include/release-qa.php";
+
+// sanitize
+if (!preg_match('@^[a-z0-9]{32}$@', $_GET['signature'])) {
+ exit('Invalid signature');
+}
+
+if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
+ exit('invalid version');
+}
+
+$signature = $_GET['signature'];
+$version = $_GET['version'];
+
+$dbFile = dirname(__FILE__).'/db/'.$version.'.sqlite';
+
+$database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
+
+if (!$database) {
+ die("Error opening DB file: ".$database->lastErrorMsg());
+}
+
+// GET infos from DB
+$query = 'SELECT reports.* FROM failed JOIN reports ON reports.id=failed.id_report WHERE signature=X\''.$signature.'\'';
+
+$q = $database->query($query);
+$reportsArray = array();
+while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
+ $reportsArray[$tab['id']] = $tab;
+}
+
+$tab = $database->query('SELECT test_name FROM failed WHERE signature=X\''.$signature.'\' LIMIT 1');
+list($testName) = $tab->fetchArray(SQLITE3_NUM);
+
+// We stop everything
+$database->close();
+
+$TITLE = "Report details";
+common_header();
+?>
+
+
+
+
+List of reports associated
+
Test name:
+
Version:
+
+
+
+
+
+ | Date |
+ Failed tests |
+ Email |
+ |
+
+
+'."\n";
+ echo ' '.$report['date'].' | '."\n";
+ echo ' '.$report['nb_failed'].' | '."\n";
+ echo ' ***'.strstr($report['user_email'], ' at ').' | '."\n";
+ echo ' ';
+ echo ' | '."\n";
+ echo ' '."\n";
+ }
+
+?>
+
+
+
+
+
+
Goto: PHPInfo Build environment
+
+
PHPInfo
';
+ echo $reportsArray[$idreport]['phpinfo'];
+ echo '
';
+ echo '
Build environment
';
+ echo str_replace(
+ $reportsArray[$idreport]['user_email'],
+ '*** (truncated on purpose) ***',
+ $reportsArray[$idreport]['build_env']
+ );
+
+}
+
+
+echo '
';
+$SITE_UPDATE = "
Generated in ".round((microtime(true)-$startTime)*1000)." ms";
+common_footer();
Modified: web/qa/trunk/reports/index.php
===================================================================
--- web/qa/trunk/reports/index.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/index.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,167 +1,170 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-$startTime = microtime(true);
-
-include "../include/functions.php";
-include "../include/release-qa.php";
-
-$TITLE = "PHP Test reports Summary";
-
-if (isset($_GET['version'])) {
- //sanity check
- if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
- exit('invalid version');
- }
- $VERSION = $_GET['version'];
- $TITLE .= ' - PHP Version '.$_GET['version'];
-}
-
-require 'reportsfunctions.php';
-
-
-$reportsPerVersion = get_summary_data();
-
-if (isset($VERSION)) {
- $DBFILE = dirname(__FILE__).'/db/'.$VERSION.'.sqlite';
- if (!file_exists($DBFILE)) {
- die('no data for this version');
- }
- $database = new SQLite3($DBFILE, SQLITE3_OPEN_READONLY);
- if (!($database instanceof SQLite3)) {
- die("Error opening DB file: ".$database->lastErrorMsg());
- }
- $failedTestsArray = array();
- $query = 'SELECT test_name,COUNT(failed.id) as cpt,COUNT(DISTINCT diff) as variations, date(date) as date FROM failed,reports WHERE failed.id_report = reports.id
- GROUP BY test_name ORDER BY cpt DESC LIMIT 50';
- $q = @$database->query($query);
- if (!$q) die("Error querying DB: ".$database->lastErrorMsg());
- while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
- $failedTestsArray[] = $tab;
- }
- $database->close();
-}
-
-
-
-
-common_header();
-?>
-
-
-
-
Reports per version
-
-
-
-
- | PHP Version |
- Reports |
- Unique failed tests |
- Total failed tests |
- Last report date |
-
-
-
- $line) {
-
- if (version_compare($version, '5.3.6', '<')) {
- continue;
- }
-
- echo '';
- echo '| '.$version.' | ';
- echo ''.$line['nbReports'].' | ';
- echo ''.$line['nbFailingTests'].' | ';
- echo ''.$line['nbFailures'].' | ';
- echo '';
-
- $lastReport = time()-strtotime($line['lastReport']);
-
- if($lastReport < 3600) {
- $_tmp = round($lastReport/60);
- echo "$_tmp ", ($_tmp == 1) ? 'minute' : 'minutes';
- } elseif ($lastReport < 3600*24) {
- $_tmp = round($lastReport/3600);
- echo "$_tmp ", ($_tmp == 1) ? 'hour' : 'hours';
- } elseif ($lastReport < 3600*24*60) {
- $_tmp = round($lastReport/3600/24);
- echo "$_tmp ", ($_tmp == 1) ? 'day' : 'days';
- } else {
- $_tmp = floor($lastReport/3600/24/30);
- echo "$_tmp ", ($_tmp == 1) ? 'month' : 'months';
- }
- echo " ago";
- echo ' | ';
- echo '
'."\n";
-}
-?>
-
-
-
-
-
-
-
-
-
- | Test name |
- Count |
- Variations |
- Last reported date |
- |
-
-
-
- '.$line['test_name'].' | ';
- echo ''.$line['cpt'].' | ';
- echo ''.$line['variations'].' | ';
- echo ''.$line['date'].' | ';
- echo '
-  | ';
- echo ''."\n";
- $i++;
- }
-
- ?>
-
-There are more failing tests not printed here (with less occurences)';
-}
-endif;
-?>
-
-
- Generated in ".round((microtime(true)-$startTime)*1000)." ms";
-common_footer();
-
+ |
+# +----------------------------------------------------------------------+
+# $Id$
+
+$startTime = microtime(true);
+
+include "../include/functions.php";
+include "../include/release-qa.php";
+
+$TITLE = "PHP Test reports Summary";
+
+if (isset($_GET['version'])) {
+ //sanity check
+ if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
+ exit('invalid version');
+ }
+ $getVersion = $_GET['version'];
+ $TITLE .= ' - PHP Version '.$_GET['version'];
+}
+
+require 'reportsfunctions.php';
+
+
+$reportsPerVersion = get_summary_data();
+
+if (isset($getVersion)) {
+ $dbFile = dirname(__FILE__).'/db/'.$getVersion.'.sqlite';
+ if (!file_exists($dbFile)) {
+ die('no data for this version');
+ }
+ $database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
+ if (!($database instanceof SQLite3)) {
+ die("Error opening DB file: ".$database->lastErrorMsg());
+ }
+ $failedTestsArray = array();
+ $query = 'SELECT test_name,COUNT(failed.id) as cpt,COUNT(DISTINCT diff) as variations,
+ date(date) as date FROM failed,reports WHERE failed.id_report = reports.id
+ GROUP BY test_name ORDER BY cpt DESC LIMIT 50';
+ $q = @$database->query($query);
+ if (!$q) die("Error querying DB: ".$database->lastErrorMsg());
+ while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
+ $failedTestsArray[] = $tab;
+ }
+ $database->close();
+}
+
+
+common_header();
+?>
+
+
+
+
+
+Reports per version
+
+
+
+
+ | PHP Version |
+ Reports |
+ Unique failed tests |
+ Total failed tests |
+ Last report date |
+
+
+
+ $line) {
+
+ if (version_compare($getVersion, '5.3.6', '<')) {
+ continue;
+ }
+
+ echo '';
+ echo '| '.$getVersion.' | ';
+ echo ''.$line['nbReports'].' | ';
+ echo ''.$line['nbFailingTests'].' | ';
+ echo ''.$line['nbFailures'].' | ';
+ echo '';
+
+ $lastReport = time()-strtotime($line['lastReport']);
+
+ if ($lastReport < 3600) {
+ $tmpValue = round($lastReport/60);
+ echo "$tmpValue ", ($tmpValue == 1) ? 'minute' : 'minutes';
+ } elseif ($lastReport < 3600*24) {
+ $tmpValue = round($lastReport/3600);
+ echo "$tmpValue ", ($tmpValue == 1) ? 'hour' : 'hours';
+ } elseif ($lastReport < 3600*24*60) {
+ $tmpValue = round($lastReport/3600/24);
+ echo "$tmpValue ", ($tmpValue == 1) ? 'day' : 'days';
+ } else {
+ $tmpValue = floor($lastReport/3600/24/30);
+ echo "$tmpValue ", ($tmpValue == 1) ? 'month' : 'months';
+ }
+ unset($tmpValue);
+ echo " ago";
+ echo ' | ';
+ echo '
'."\n";
+}
+?>
+
+
+
+
+
+
+
+
+
+ | Test name |
+ Count |
+ Variations |
+ Last reported date |
+ |
+
+
+
+ '.$line['test_name'].' | ';
+ echo ''.$line['cpt'].' | ';
+ echo ''.$line['variations'].' | ';
+ echo ''.$line['date'].' | ';
+ echo '
+  | ';
+ echo ''."\n";
+ $i++;
+ }
+
+ ?>
+
+There are more failing tests not printed here (with less occurences)';
+}
+endif;
+?>
+
+
+".
+ "Generated in ".round((microtime(true)-$startTime)*1000)." ms";
+common_footer();
+
Modified: web/qa/trunk/reports/parserfunc.php
===================================================================
--- web/qa/trunk/reports/parserfunc.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/parserfunc.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,248 +1,248 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-function insertToDb_phpmaketest($array, $QA_RELEASES = array())
-{
- if (!is_array($array)) {
- // impossible to fetch data. We'll record this error later ...
-
- } else {
- if ($array['userEmail'] == null)
- $array['userEmail'] = 'NULL';
- else
- $array['userEmail'] = "'".addslashes($array['userEmail'])."'";
-
- if (strtolower($array['status']) == 'failed')
- $array['status'] = 0;
-
- elseif (strtolower($array['status']) == 'success')
- $array['status'] = 1;
-
- else
- die('status unknown: '.$array['status']);
-
- if (!is_valid_php_version($array['version'], $QA_RELEASES)) {
- exit('invalid version');
- }
-
- $DBFILE = dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
-
- if (!file_exists($DBFILE)) {
- //Create DB
- $dbi = new SQLite3($DBFILE, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
- $query = 'CREATE TABLE failed (
- `id` integer PRIMARY KEY AUTOINCREMENT,
- `id_report` bigint(20) NOT NULL,
- `test_name` varchar(128) NOT NULL,
- `output` STRING NOT NULL,
- `diff` STRING NOT NULL,
- `signature` binary(16) NOT NULL
- )';
- $dbi->exec($query);
- if ($dbi->lastErrorCode() != '') {
- echo "ERROR: ".$dbi->lastErrorMsg()."\n";
- exit;
- }
-
- $query = 'CREATE TABLE reports (
- id integer primary key AUTOINCREMENT,
- date datetime NOT NULL,
- status smallint(1) not null,
- nb_failed unsigned int(10) NOT NULL,
- nb_expected_fail unsigned int(10) NOT NULL,
- build_env STRING NOT NULL,
- phpinfo STRING NOT NULL,
- user_email varchar(64) default null
- )';
- $dbi->exec($query);
- if ($dbi->lastErrorCode() != '') {
- echo "ERROR: ".$dbi->lastErrorMsg()."\n";
- exit;
- }
- $dbi->close();
- }
- $dbi = new SQLite3($DBFILE, SQLITE3_OPEN_READWRITE) or exit('cannot open DB to record results');
-
- $query = "INSERT INTO `reports` (`id`, `date`, `status`,
- `nb_failed`, `nb_expected_fail`, `build_env`, `phpinfo`, user_email) VALUES (null,
- datetime(".((int) $array['date']).", 'unixepoch', 'localtime'),
- '".addslashes($array['status'])."',
- '".count($array['failedTest'])."',
- '".count($array['expectedFailedTest'])."',
- ('".$dbi->escapeString($array['buildEnvironment'])."'),
- ('".$dbi->escapeString($array['phpinfo'])."'), ".$array['userEmail']."
- )";
- // userEmail is already escaped on line 28
-
- $dbi->query($query);
- if ($dbi->lastErrorCode() != '') {
- echo "ERROR: ".$dbi->error."\n";
- exit;
- }
-
- $reportId = $dbi->lastInsertRowID();
-
- foreach ($array['tests'] as $name => $test) {
- $query = "INSERT INTO `failed`
- (`id`, `id_report`, `test_name`, signature, `output`, `diff`) VALUES (null,
- '".$reportId."', '".$name."',
- X'".md5($name.'__'.$test['diff'])."',
- ('".$dbi->escapeString($test['output'])."'), ('".$dbi->escapeString($test['diff'])."'))";
-
- $dbi->query($query);
- if ($dbi->lastErrorCode() != '') {
- echo "ERROR: ".$dbi->error."\n";
- exit;
- }
-
- }
- $dbi->close();
- }
- return true;
-}
-
-function parse_phpmaketest($version, $status, $file) {
-
- $extract = array();
-
- $extract['version'] = $version;
- $extract['status'] = $status;
- $extract['userEmail'] = null;
-
- $extract['date'] = time();
-
- $extract['expectedFailedTest'] = array();
- $extract['failedTest'] = array();
- $extract['outputsRaw'] = array();
- $extract['tests'] = array();
- $extract['phpinfo'] = '';
- $extract['buildEnvironment'] = '';
-
- //for each part
- $rows = explode("\n", $file);
- $currentPart = '';
- $currentTest = '';
-
- foreach ($rows as $row) {
- if (preg_match('@^={5,}@', $row) && $currentPart != 'phpinfo' && $currentPart != 'buildEnvironment') {
- // =======
- $currentPart = '';
- }
- elseif ($currentPart == '' && trim($row) == 'FAILED TEST SUMMARY') {
- $currentPart = 'failedTest';
- }
- elseif ($currentPart == '' && trim($row) == 'EXPECTED FAILED TEST SUMMARY') {
- $currentPart = 'expectedFailedTest';
- }
- elseif ($currentPart == '' && trim($row) == 'BUILD ENVIRONMENT') {
- $currentPart = 'buildEnvironment';
- $currentTest = '';
- }
- elseif (trim($row) == 'PHPINFO') {
- $currentPart = 'phpinfo';
- $currentTest = '';
- }
- elseif ($currentPart == 'failedTest' || $currentPart == 'expectedFailedTest') {
- preg_match('@ \[([^\]]{1,})\]@', $row, $tab);
- if (count($tab) == 2)
- if (!isset($extract[$currentPart]) || !in_array($tab[1], $extract[$currentPart]))
- $extract[$currentPart][] = $tab[1];
- }
- elseif ($currentPart == 'buildEnvironment') {
- if (preg_match('@User\'s E-mail: (.*)$@', $row, $tab)) {
- //User's E-mail
- $extract['userEmail'] = trim($tab[1]);
- }
- if (!isset($extract[$currentPart]))
- $extract[$currentPart] = '';
-
- $extract[$currentPart] .= $row."\n";
- }
- elseif ($currentPart == 'phpinfo') {
- if (!isset($extract[$currentPart]))
- $extract[$currentPart] = '';
-
- $extract[$currentPart] .= $row."\n";
- }
- elseif (substr(trim($row), -5) == '.phpt') {
- $currentTest = trim($row);
- continue;
- }
- if ($currentPart == '' && $currentTest != '') {
- if (!isset($extract['outputsRaw'][$currentTest]))
- $extract['outputsRaw'][$currentTest] = '';
-
- $extract['outputsRaw'][$currentTest] .= $row."\n";
- }
- }
- // 2nd try to cleanup name
- $prefix = '';
-
-
- foreach ($extract['outputsRaw'] as $name => $output) {
- if (strpos($name, '/ext/') !== false) {
- $prefix = substr($name, 0, strpos($name, '/ext/'));
- break;
- }
- if (strpos($name, '/Zend/') !== false) {
- $prefix = substr($name, 0, strpos($name, '/Zend/'));
- break;
- }
- if (strpos($name, '/lang/') !== false) {
- $prefix = substr($name, 0, strpos($name, '/lang/'));
- break;
- }
- }
-
- if ($prefix == '' && count($extract['outputsRaw']) > 0) {
- return 'cannot determine prefix (last test name: '.$name.')';
- }
-
-
- // 2nd loop on outputs
- foreach ($extract['outputsRaw'] as $name => $output) {
- $name = substr($name, strlen($prefix));
- $extract['tests'][$name] = array ('output' => '', 'diff' => '');
- $outputTest = '';
- $diff = '';
- $startDiff = false;
- $output = explode("\n", $output);
-
- foreach ($output as $row) {
- if (preg_match('@^={5,}$@', $row)) {
- if ($outputTest != '') $startDiff = true;
- }
- elseif ($startDiff === false) {
- $outputTest .= $row."\n";
- }
- elseif (preg_match('@^[0-9]{1,}@', $row)) {
- $diff .= $row."\n";
- }
- }
- $extract['tests'][$name]['output'] = $outputTest;
- $extract['tests'][$name]['diff'] = rtrim( preg_replace('@ [^\s]{1,}'.substr($name, 0, -1).'@', ' %s/'.basename(substr($name, 0, -1)), $diff));
- }
- unset($extract['outputsRaw']);
-
- // cleanup phpInfo
- $extract['phpinfo'] = preg_replace('@^={1,}\s+@', '', $extract['phpinfo']);
- $extract['buildEnvironment'] = trim(preg_replace('@^={1,}\s+@', '', $extract['buildEnvironment']));
- $extract['buildEnvironment'] = preg_replace('@={1,}$@', '', trim($extract['buildEnvironment']));
-
- return $extract;
-}
+ |
+# +----------------------------------------------------------------------+
+# $Id$
+
+function insertToDb_phpmaketest($array, $QA_RELEASES = array())
+{
+ if (!is_array($array)) {
+ // impossible to fetch data. We'll record this error later ...
+
+ } else {
+ if ($array['userEmail'] == null)
+ $array['userEmail'] = 'NULL';
+ else
+ $array['userEmail'] = "'".addslashes($array['userEmail'])."'";
+
+ if (strtolower($array['status']) == 'failed')
+ $array['status'] = 0;
+
+ elseif (strtolower($array['status']) == 'success')
+ $array['status'] = 1;
+
+ else
+ die('status unknown: '.$array['status']);
+
+ if (!is_valid_php_version($array['version'], $QA_RELEASES)) {
+ exit('invalid version');
+ }
+
+ $dbFile = dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
+
+ if (!file_exists($dbFile)) {
+ //Create DB
+ $dbi = new SQLite3($dbFile, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
+ $query = 'CREATE TABLE failed (
+ `id` integer PRIMARY KEY AUTOINCREMENT,
+ `id_report` bigint(20) NOT NULL,
+ `test_name` varchar(128) NOT NULL,
+ `output` STRING NOT NULL,
+ `diff` STRING NOT NULL,
+ `signature` binary(16) NOT NULL
+ )';
+ $dbi->exec($query);
+ if ($dbi->lastErrorCode() != '') {
+ echo "ERROR: ".$dbi->lastErrorMsg()."\n";
+ exit;
+ }
+
+ $query = 'CREATE TABLE reports (
+ id integer primary key AUTOINCREMENT,
+ date datetime NOT NULL,
+ status smallint(1) not null,
+ nb_failed unsigned int(10) NOT NULL,
+ nb_expected_fail unsigned int(10) NOT NULL,
+ build_env STRING NOT NULL,
+ phpinfo STRING NOT NULL,
+ user_email varchar(64) default null
+ )';
+ $dbi->exec($query);
+ if ($dbi->lastErrorCode() != '') {
+ echo "ERROR: ".$dbi->lastErrorMsg()."\n";
+ exit;
+ }
+ $dbi->close();
+ }
+ $dbi = new SQLite3($dbFile, SQLITE3_OPEN_READWRITE) or exit('cannot open DB to record results');
+
+ $query = "INSERT INTO `reports` (`id`, `date`, `status`,
+ `nb_failed`, `nb_expected_fail`, `build_env`, `phpinfo`, user_email) VALUES (null,
+ datetime(".((int) $array['date']).", 'unixepoch', 'localtime'),
+ '".addslashes($array['status'])."',
+ '".count($array['failedTest'])."',
+ '".count($array['expectedFailedTest'])."',
+ ('".$dbi->escapeString($array['buildEnvironment'])."'),
+ ('".$dbi->escapeString($array['phpinfo'])."'), ".$array['userEmail']."
+ )";
+ // userEmail is already escaped on line 28
+
+ $dbi->query($query);
+ if ($dbi->lastErrorCode() != '') {
+ echo "ERROR: ".$dbi->error."\n";
+ exit;
+ }
+
+ $reportId = $dbi->lastInsertRowID();
+
+ foreach ($array['tests'] as $name => $test) {
+ $query = "INSERT INTO `failed`
+ (`id`, `id_report`, `test_name`, signature, `output`, `diff`) VALUES (null,
+ '".$reportId."', '".$name."',
+ X'".md5($name.'__'.$test['diff'])."',
+ ('".$dbi->escapeString($test['output'])."'), ('".$dbi->escapeString($test['diff'])."'))";
+
+ $dbi->query($query);
+ if ($dbi->lastErrorCode() != '') {
+ echo "ERROR: ".$dbi->error."\n";
+ exit;
+ }
+
+ }
+ $dbi->close();
+ }
+ return true;
+}
+
+function parse_phpmaketest($version, $status, $file)
+{
+ $extract = array();
+
+ $extract['version'] = $version;
+ $extract['status'] = $status;
+ $extract['userEmail'] = null;
+
+ $extract['date'] = time();
+
+ $extract['expectedFailedTest'] = array();
+ $extract['failedTest'] = array();
+ $extract['outputsRaw'] = array();
+ $extract['tests'] = array();
+ $extract['phpinfo'] = '';
+ $extract['buildEnvironment'] = '';
+
+ //for each part
+ $rows = explode("\n", $file);
+ $currentPart = '';
+ $currentTest = '';
+
+ foreach ($rows as $row) {
+ if (preg_match('@^={5,}@', $row) && $currentPart != 'phpinfo' && $currentPart != 'buildEnvironment') {
+ // =======
+ $currentPart = '';
+
+ } elseif ($currentPart == '' && trim($row) == 'FAILED TEST SUMMARY') {
+ $currentPart = 'failedTest';
+
+ } elseif ($currentPart == '' && trim($row) == 'EXPECTED FAILED TEST SUMMARY') {
+ $currentPart = 'expectedFailedTest';
+
+ } elseif ($currentPart == '' && trim($row) == 'BUILD ENVIRONMENT') {
+ $currentPart = 'buildEnvironment';
+ $currentTest = '';
+
+ } elseif (trim($row) == 'PHPINFO') {
+ $currentPart = 'phpinfo';
+ $currentTest = '';
+
+ } elseif ($currentPart == 'failedTest' || $currentPart == 'expectedFailedTest') {
+ preg_match('@ \[([^\]]{1,})\]@', $row, $tab);
+ if (count($tab) == 2)
+ if (!isset($extract[$currentPart]) || !in_array($tab[1], $extract[$currentPart]))
+ $extract[$currentPart][] = $tab[1];
+
+ } elseif ($currentPart == 'buildEnvironment') {
+ if (preg_match('@User\'s E-mail: (.*)$@', $row, $tab)) {
+ //User's E-mail
+ $extract['userEmail'] = trim($tab[1]);
+ }
+ if (!isset($extract[$currentPart]))
+ $extract[$currentPart] = '';
+ $extract[$currentPart] .= $row."\n";
+
+ } elseif ($currentPart == 'phpinfo') {
+ if (!isset($extract[$currentPart]))
+ $extract[$currentPart] = '';
+ $extract[$currentPart] .= $row."\n";
+
+ } elseif (substr(trim($row), -5) == '.phpt') {
+ $currentTest = trim($row);
+ continue;
+ }
+ if ($currentPart == '' && $currentTest != '') {
+ if (!isset($extract['outputsRaw'][$currentTest]))
+ $extract['outputsRaw'][$currentTest] = '';
+ $extract['outputsRaw'][$currentTest] .= $row."\n";
+
+ }
+ }
+ // 2nd try to cleanup name
+ $prefix = '';
+
+
+ foreach ($extract['outputsRaw'] as $name => $output) {
+ if (strpos($name, '/ext/') !== false) {
+ $prefix = substr($name, 0, strpos($name, '/ext/'));
+ break;
+ }
+ if (strpos($name, '/Zend/') !== false) {
+ $prefix = substr($name, 0, strpos($name, '/Zend/'));
+ break;
+ }
+ if (strpos($name, '/lang/') !== false) {
+ $prefix = substr($name, 0, strpos($name, '/lang/'));
+ break;
+ }
+ }
+
+ if ($prefix == '' && count($extract['outputsRaw']) > 0) {
+ return 'cannot determine prefix (last test name: '.$name.')';
+ }
+
+
+ // 2nd loop on outputs
+ foreach ($extract['outputsRaw'] as $name => $output) {
+ $name = substr($name, strlen($prefix));
+ $extract['tests'][$name] = array ('output' => '', 'diff' => '');
+ $outputTest = '';
+ $diff = '';
+ $startDiff = false;
+ $output = explode("\n", $output);
+
+ foreach ($output as $row) {
+ if (preg_match('@^={5,}$@', $row)) {
+ if ($outputTest != '') $startDiff = true;
+
+ } elseif ($startDiff === false) {
+ $outputTest .= $row."\n";
+
+ } elseif (preg_match('@^[0-9]{1,}@', $row)) {
+ $diff .= $row."\n";
+ }
+ }
+ $extract['tests'][$name]['output'] = $outputTest;
+ $extract['tests'][$name]['diff'] = rtrim(
+ preg_replace('@ [^\s]{1,}'.substr($name, 0, -1).'@', ' %s/'.basename(substr($name, 0, -1)), $diff)
+ );
+ }
+ unset($extract['outputsRaw']);
+
+ // cleanup phpInfo
+ $extract['phpinfo'] = preg_replace('@^={1,}\s+@', '', $extract['phpinfo']);
+ $extract['buildEnvironment'] = trim(preg_replace('@^={1,}\s+@', '', $extract['buildEnvironment']));
+ $extract['buildEnvironment'] = preg_replace('@={1,}$@', '', trim($extract['buildEnvironment']));
+
+ return $extract;
+}
Modified: web/qa/trunk/reports/reportsfunctions.php
===================================================================
--- web/qa/trunk/reports/reportsfunctions.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/reportsfunctions.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,54 +1,57 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-/**
- * Analyse sqlite files and retrieve data from it
- * @return array
- */
-function get_summary_data()
-{
- $data = array();
- $d = dir (dirname(__FILE__).'/db/');
- while (false !== ($entry = $d->read())) {
- if (substr($entry, -7) == '.sqlite') {
- //extract version from filename
- $version = substr($entry, 0, -7);
-
- // open database file
- $database = new SQLite3(dirname(__FILE__).'/db/'.$entry, SQLITE3_OPEN_READONLY);
-
- //retrieve data
- $query = $database->query("SELECT COUNT(*) AS nbReports, MAX(`date`) AS lastReport
- FROM reports");
- if (!$query)
- die("An error occured when reading a DB file.");
- $row = $query->fetchArray(SQLITE3_ASSOC);
- $data[$version] = $row;
-
- $query = $database->query("select count(distinct test_name) as nbFailingTests, count(*) as nbFailures from failed");
- if (!$query)
- die("An error occured when reading a DB file.");
- $row = $query->fetchArray(SQLITE3_ASSOC);
- $data[$version]['nbFailingTests'] = $row['nbFailingTests'];
- $data[$version]['nbFailures'] = $row['nbFailures'];
-
- $database->close();
- }
- }
- return $data;
-}
+ |
+# +----------------------------------------------------------------------+
+# $Id$
+
+/**
+ * Analyse sqlite files and retrieve data from it
+ * @return array
+ */
+function get_summary_data()
+{
+ $data = array();
+ $d = dir(dirname(__FILE__).'/db/');
+ while (false !== ($entry = $d->read())) {
+ if (substr($entry, -7) == '.sqlite') {
+ //extract version from filename
+ $version = substr($entry, 0, -7);
+
+ // open database file
+ $database = new SQLite3(dirname(__FILE__).'/db/'.$entry, SQLITE3_OPEN_READONLY);
+
+ //retrieve data
+ $query = $database->query(
+ "SELECT COUNT(*) AS nbReports, MAX(`date`) AS lastReport FROM reports"
+ );
+ if (!$query)
+ die("An error occured when reading a DB file.");
+ $row = $query->fetchArray(SQLITE3_ASSOC);
+ $data[$version] = $row;
+
+ $query = $database->query(
+ "select count(distinct test_name) as nbFailingTests, count(*) as nbFailures from failed"
+ );
+ if (!$query)
+ die("An error occured when reading a DB file.");
+ $row = $query->fetchArray(SQLITE3_ASSOC);
+ $data[$version]['nbFailingTests'] = $row['nbFailingTests'];
+ $data[$version]['nbFailures'] = $row['nbFailures'];
+
+ $database->close();
+ }
+ }
+ return $data;
+}
Modified: web/qa/trunk/reports/test-insert.php
===================================================================
--- web/qa/trunk/reports/test-insert.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/test-insert.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,178 +1,186 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-require 'parserfunc.php';
-echo 'Testing QA report parsing and database handling
';
-echo ''."\n";
-
-$str = file_get_contents('sample.txt');
-echo 'Content length: '.strlen($str);
-if (strlen($str) == 126341) echo " OK \n";
-else echo " KO (value: ".strlen($str)." \n";
-echo "Parsing with function parse_phpmaketest() ... \n";
-$array = parse_phpmaketest('5.3.7-dev', 'failed', $str);
-
-printf("%-30s", "Result should be array: ");
-if (is_array($array)) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "Version extracted match: ");
-if ($array['version'] == '5.3.7-dev') echo " OK \n";
-else echo " KO. value extracted: ".$array['version']." \n";
-
-printf("%-30s", "Test email match: ");
-if ($array['userEmail'] == 'thisisatestmail@testdomain.com') echo " OK \n";
-else echo " KO. value extracted: ".$array['userEmail']." \n";
-
-printf("%-30s", "extract 17 expectedFailedTest");
-if (count($array['expectedFailedTest']) == 17) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "extract 33 failedTest");
-if (count($array['failedTest']) == 33) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "33 detailed test");
-if (count($array['tests']) == 33) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "specific expectedFailedTest");
-if (in_array('Zend/tests/bug48770_3.phpt', $array['expectedFailedTest'])) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "specific failedTest");
-if (in_array('ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt', $array['failedTest'])) echo " OK \n";
-else echo " KO \n";
-
-printf("%-30s", "specific test diff");
-$strlen = strlen($array['tests']['/tests/func/010.phpt']['diff']);
-if (isset($array['tests']['/tests/func/010.phpt']['diff']) && $strlen >= 290 ) echo " OK (size: ".$strlen." ) - optimal==293 \n";
-else echo " KO \n";
-
-printf("%-30s", "specific test output");
-$strlen = strlen($array['tests']['/tests/func/010.phpt']['output']);
-if (isset($array['tests']['/tests/func/010.phpt']['output']) && $strlen >= 165 ) echo " OK (size: ".$strlen." ) - optimal==167 \n";
-else echo " KO \n";
-
-printf("%-30s", "phpinfo");
-if (strlen($array['phpinfo']) >= 27940) echo " OK (size: ".strlen($array['phpinfo']).") \n";
-else echo " KO \n";
-
-printf("%-30s", "buildEnvironment");
-if (strlen($array['buildEnvironment']) >= 4500) echo " OK (size: ".strlen($array['buildEnvironment']).") \n";
-else echo " KO \n";
-
-// total diff / output, to see if we parsed everything Ok
-$totalDiff = 0;
-$totalOutput = 0;
-
-foreach ($array['tests'] as $name => $content) {
- $totalDiff += strlen($content['diff']);
- $totalOutput += strlen($content['output']);
-}
-
-printf("%-30s", "Total diff length");
-if ($totalDiff >= 27900) echo " OK (size: ".$totalDiff." - optimal = 27938) \n";
-else echo " KO \n";
-
-printf("%-30s", "Total output length");
-if ($totalOutput >= 31950) echo " OK (size: ".$totalOutput." - optimal = 31971) \n";
-else echo " KO \n";
-
-
-// now insert data and check
-echo "\nTesting SQLite insertion ...\n";
-
-$return = insertToDb_phpmaketest ($array);
-printf("%-30s", "Function call");
-
-if ($return === true) echo " OK \n";
-else echo " KO (return: ".$return.") \n";
-
-$DBFILE = dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
-
-printf("%-30s", "DB file exists");
-if (file_exists($DBFILE)) echo " OK \n";
-else echo " KO \n";
-
-$database = new SQLite3($DBFILE, SQLITE3_OPEN_READONLY);
-
-if (!$database) {
- $error = (file_exists($yourfile)) ? "Impossible to open, check permissions" : "Impossible to create, check permissions";
- die("Error: ".$error);
-}
-
-// Check report ?
-$query = 'SELECT * FROM reports WHERE user_email = \'thisisatestmail@testdomain.com\' ORDER BY date DESC LIMIT 1';
-$q = $database->query($query);
-$sqlReport = $q->fetchArray(SQLITE3_ASSOC);
-printf("%-30s", "Found report in DB");
-if (is_array($sqlReport) && isset($sqlReport['id'])) echo " OK (id: ".$sqlReport['id'].") \n";
-else echo " KO \n";
-
-// check how many failed ?
-if (!isset($sqlReport['id'])) die('cannot make more tests');
-
-$query = 'SELECT * FROM failed WHERE id_report = '.$sqlReport['id'];
-$q = $database->query($query);
-$sqlFailed = array();
-while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
- $sqlFailed[$tab['test_name']] = $tab;
-}
-
-printf("%-30s", "Found 33 failedTest");
-if (count($sqlFailed) == 33) echo " OK \n";
-else { echo " KO (found: ".count($sqlFailed).") \n"; var_dump($sqlFailed); }
-
-printf("%-30s", "specific test diff");
-$strlen = strlen($sqlFailed['/tests/func/010.phpt']['diff']);
-if (isset($sqlFailed['/tests/func/010.phpt']['diff']) && $strlen >= 290 ) echo " OK (size: ".$strlen." ) - optimal==293 \n";
-else echo " KO \n";
-
-printf("%-30s", "specific test output");
-$strlen = strlen($sqlFailed['/tests/func/010.phpt']['output']);
-if (isset($sqlFailed['/tests/func/010.phpt']['output']) && $strlen >= 165 ) echo " OK (size: ".$strlen." ) - optimal==167 \n";
-else echo " KO \n";
-
-$totalDiff = 0;
-$totalOutput = 0;
-
-foreach ($sqlFailed as $name => $content) {
- $totalDiff += strlen($content['diff']);
- $totalOutput += strlen($content['output']);
-}
-
-printf("%-30s", "Total diff length");
-if ($totalDiff >= 27900) echo " OK (size: ".$totalDiff." - optimal = 27938) \n";
-else echo " KO \n";
-
-printf("%-30s", "Total output length");
-if ($totalOutput >= 31950) echo " OK (size: ".$totalOutput." - optimal = 31971) \n";
-else echo " KO \n";
-
-// Cleanup
-$database->close();
-
-$database = new SQLite3($DBFILE, SQLITE3_OPEN_READWRITE) or exit('cannot open DB to remove test');
-$database->exec('DELETE FROM failed WHERE id_report = '.$sqlReport['id']);
-$database->exec('DELETE FROM reports WHERE id = '.$sqlReport['id']);
-$database->close();
-echo "Cleanup done";
-
-
-
+ |
+# +----------------------------------------------------------------------+
+# $Id$
+
+require 'parserfunc.php';
+echo 'Testing QA report parsing and database handling
';
+echo ''."\n";
+
+$str = file_get_contents('sample.txt');
+echo 'Content length: '.strlen($str);
+if (strlen($str) == 126341) echo " OK \n";
+else echo " KO (value: ".strlen($str)." \n";
+echo "Parsing with function parse_phpmaketest() ... \n";
+$array = parse_phpmaketest('5.3.7-dev', 'failed', $str);
+
+printf("%-30s", "Result should be array: ");
+if (is_array($array)) echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "Version extracted match: ");
+if ($array['version'] == '5.3.7-dev') echo " OK \n";
+else echo " KO. value extracted: ".$array['version']." \n";
+
+printf("%-30s", "Test email match: ");
+if ($array['userEmail'] == 'thisisatestmail@testdomain.com') echo " OK \n";
+else echo " KO. value extracted: ".$array['userEmail']." \n";
+
+printf("%-30s", "extract 17 expectedFailedTest");
+if (count($array['expectedFailedTest']) == 17) echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "extract 33 failedTest");
+if (count($array['failedTest']) == 33) echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "33 detailed test");
+if (count($array['tests']) == 33) echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "specific expectedFailedTest");
+if (in_array('Zend/tests/bug48770_3.phpt', $array['expectedFailedTest'])) echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "specific failedTest");
+if (in_array('ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt', $array['failedTest']))
+ echo " OK \n";
+else echo " KO \n";
+
+printf("%-30s", "specific test diff");
+$strlen = strlen($array['tests']['/tests/func/010.phpt']['diff']);
+if (isset($array['tests']['/tests/func/010.phpt']['diff']) && $strlen >= 290 )
+ echo " OK (size: ".$strlen." ) - optimal==293 \n";
+else echo " KO \n";
+
+printf("%-30s", "specific test output");
+$strlen = strlen($array['tests']['/tests/func/010.phpt']['output']);
+if (isset($array['tests']['/tests/func/010.phpt']['output']) && $strlen >= 165 )
+ echo " OK (size: ".$strlen." ) - optimal==167 \n";
+else echo " KO \n";
+
+printf("%-30s", "phpinfo");
+if (strlen($array['phpinfo']) >= 27940) echo " OK (size: ".strlen($array['phpinfo']).") \n";
+else echo " KO \n";
+
+printf("%-30s", "buildEnvironment");
+if (strlen($array['buildEnvironment']) >= 4500)
+ echo " OK (size: ".strlen($array['buildEnvironment']).") \n";
+else echo " KO \n";
+
+// total diff / output, to see if we parsed everything Ok
+$totalDiff = 0;
+$totalOutput = 0;
+
+foreach ($array['tests'] as $name => $content) {
+ $totalDiff += strlen($content['diff']);
+ $totalOutput += strlen($content['output']);
+}
+
+printf("%-30s", "Total diff length");
+if ($totalDiff >= 27900) echo " OK (size: ".$totalDiff." - optimal = 27938) \n";
+else echo " KO \n";
+
+printf("%-30s", "Total output length");
+if ($totalOutput >= 31950) echo " OK (size: ".$totalOutput." - optimal = 31971) \n";
+else echo " KO \n";
+
+
+// now insert data and check
+echo "\nTesting SQLite insertion ...\n";
+
+$return = insertToDb_phpmaketest($array);
+printf("%-30s", "Function call");
+
+if ($return === true) echo " OK \n";
+else echo " KO (return: ".$return.") \n";
+
+$dbFile = dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
+
+printf("%-30s", "DB file exists");
+if (file_exists($dbFile)) echo " OK \n";
+else echo " KO \n";
+
+$database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
+
+if (!$database) {
+ die("Error opening DB file: ".$database->lastErrorMsg());
+}
+
+// Check report ?
+$query = 'SELECT * FROM reports WHERE user_email = \'thisisatestmail@testdomain.com\' ORDER BY date DESC LIMIT 1';
+$q = $database->query($query);
+$sqlReport = $q->fetchArray(SQLITE3_ASSOC);
+printf("%-30s", "Found report in DB");
+if (is_array($sqlReport) && isset($sqlReport['id']))
+ echo " OK (id: ".$sqlReport['id'].") \n";
+else echo " KO \n";
+
+// check how many failed ?
+if (!isset($sqlReport['id'])) die('cannot make more tests');
+
+$query = 'SELECT * FROM failed WHERE id_report = '.$sqlReport['id'];
+$q = $database->query($query);
+$sqlFailed = array();
+while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
+ $sqlFailed[$tab['test_name']] = $tab;
+}
+
+printf("%-30s", "Found 33 failedTest");
+if (count($sqlFailed) == 33) {
+ echo " OK \n";
+} else {
+ echo " KO (found: ".count($sqlFailed).") \n";
+ var_dump($sqlFailed);
+}
+
+printf("%-30s", "specific test diff");
+$strlen = strlen($sqlFailed['/tests/func/010.phpt']['diff']);
+if (isset($sqlFailed['/tests/func/010.phpt']['diff']) && $strlen >= 290 )
+ echo " OK (size: ".$strlen." ) - optimal==293 \n";
+else echo " KO \n";
+
+printf("%-30s", "specific test output");
+$strlen = strlen($sqlFailed['/tests/func/010.phpt']['output']);
+if (isset($sqlFailed['/tests/func/010.phpt']['output']) && $strlen >= 165 )
+ echo " OK (size: ".$strlen." ) - optimal==167 \n";
+else echo " KO \n";
+
+$totalDiff = 0;
+$totalOutput = 0;
+
+foreach ($sqlFailed as $name => $content) {
+ $totalDiff += strlen($content['diff']);
+ $totalOutput += strlen($content['output']);
+}
+
+printf("%-30s", "Total diff length");
+if ($totalDiff >= 27900) echo " OK (size: ".$totalDiff." - optimal = 27938) \n";
+else echo " KO \n";
+
+printf("%-30s", "Total output length");
+if ($totalOutput >= 31950) echo " OK (size: ".$totalOutput." - optimal = 31971) \n";
+else echo " KO \n";
+
+// Cleanup
+$database->close();
+
+$database = new SQLite3($dbFile, SQLITE3_OPEN_READWRITE) or exit('cannot open DB to remove test');
+$database->exec('DELETE FROM failed WHERE id_report = '.$sqlReport['id']);
+$database->exec('DELETE FROM reports WHERE id = '.$sqlReport['id']);
+$database->close();
+echo "Cleanup done";
+
Modified: web/qa/trunk/reports/viewreports.php
===================================================================
--- web/qa/trunk/reports/viewreports.php 2011-06-20 10:13:38 UTC (rev 312331)
+++ web/qa/trunk/reports/viewreports.php 2011-06-20 12:08:35 UTC (rev 312332)
@@ -1,163 +1,181 @@
- |
-# +----------------------------------------------------------------------+
-# $Id$
-
-$startTime = microtime(true);
-include "../include/functions.php";
-include "../include/release-qa.php";
-
-// sanitize
-if (!preg_match('@^[a-zA-Z\.0-9\-_/]{1,}$@', $_GET['test'])) {
- exit('Invalid test');
-}
-
-if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
- exit('invalid version');
-}
-
-$testName = $_GET['test'];
-$version = $_GET['version'];
-
-$DBFILE = dirname(__FILE__).'/db/'.$version.'.sqlite';
-$SITE_UPDATE = date("D M d H:i:s Y T", filemtime($DBFILE))."
\n";
-$database = new SQLite3($DBFILE, SQLITE3_OPEN_READONLY);
-
-if (!$database) {
- $error = (file_exists($yourfile)) ? "Impossible to open, check permissions" : "Impossible to create, check permissions";
- die("Error: ".$error);
-}
-
-// GET infos from DB
-$query = 'SELECT id,signature, COUNT(*) as cpt, output, diff FROM failed WHERE test_name="'.$database->escapeString($testName).'"
-GROUP BY diff ORDER BY COUNT(*) desc';
-
-$q = $database->query($query);
-$allDiffArray = array();
-$sumCount = 0;
-while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
- $allDiffArray[] = $tab;
- $sumCount += $tab['cpt'];
-}
-// We stop everything
-$database->close();
-
-
-
-//URL test
-if (substr($version, 0, 3) == '5.2') {
- $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/'.ltrim($testName, '/').'?view=markup';
-} elseif (substr($version, 0, 3) == '5.3') {
- $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/'.ltrim($testName, '/').'?view=markup';
-} elseif (substr($version, 0, 3) == '5.4') {
- $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/'.ltrim($testName, '/').'?view=markup';
-} else {
- $urlTest = '';
-}
-
-// BUG url
-if (preg_match('@bug([0-9]{1,}).phpt$@', $testName, $preg)) {
- $BugUrl = 'http://bugs.php.net/'.$preg[1];
-} else {
- $BugUrl = '';
-}
-
-
-
-
-$TITLE = "Reports for test ".$testName;
-common_header();
-echo '';
-echo '
Test: '.$testName.' - Version '.$version.' ';
-if ($urlTest != '') {
- echo '
';
-}
-if ($BugUrl != '') {
- echo '
';
-}
-?>
-
-
-
-
-
-
-
-
-
- | Count |
- Diff |
-
-
-
-\n ".$diff['cpt'].' ('.round($diff['cpt']/$sumCount*100)."%) ";
- echo ' | ';
- echo "\n \n";
- echo '';
- $diff2 = explode("\x0d", $diff['diff']);
- foreach ($diff2 as $line) {
- if (preg_match('@([0-9]{2,})(\-{1}) @', $line)) {
- echo ' '.htmlentities($line).' '."\n";
-
- } elseif (preg_match('@[0-9]{2,}[\+]{1,} @', $line)) {
- echo ' '.htmlentities($line).' '."\n";
-
- } else echo $line;
- }
- echo ' | '."\n ";
-
- //echo 'View complete output | ';
-
- echo ''."\n";
- echo ' |
';
- $i++;
- if ($i > 20) break;
-}
-?>
-
-
- |
+# +----------------------------------------------------------------------+
+# $Id$
+
+$startTime = microtime(true);
+include "../include/functions.php";
+include "../include/release-qa.php";
+
+// sanitize
+if (!preg_match('@^[a-zA-Z\.0-9\-_/]{1,}$@', $_GET['test'])) {
+ exit('Invalid test');
+}
+
+if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
+ exit('invalid version');
+}
+
+$testName = $_GET['test'];
+$version = $_GET['version'];
+
+$dbFile = dirname(__FILE__).'/db/'.$version.'.sqlite';
+$siteUpdate = date("D M d H:i:s Y T", filemtime($dbFile))."
\n";
+$database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
+
+if (!$database) {
+ die("Error: Impossible to open, check permissions");
+}
+
+// GET infos from DB
+$query = 'SELECT id,signature, COUNT(*) as cpt, output, diff FROM failed
+WHERE test_name="'.$database->escapeString($testName).'"
+GROUP BY diff ORDER BY COUNT(*) desc';
+
+$q = $database->query($query);
+$allDiffArray = array();
+$sumCount = 0;
+while ($tab = $q->fetchArray(SQLITE3_ASSOC)) {
+ $allDiffArray[] = $tab;
+ $sumCount += $tab['cpt'];
+}
+// We stop everything
+$database->close();
+
+
+
+//URL test
+if (substr($version, 0, 3) == '5.2') {
+ $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/'.
+ ltrim($testName, '/').'?view=markup';
+} elseif (substr($version, 0, 3) == '5.3') {
+ $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/'.
+ ltrim($testName, '/').'?view=markup';
+} elseif (substr($version, 0, 3) == '5.4') {
+ $urlTest = 'http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/'.
+ ltrim($testName, '/').'?view=markup';
+} else {
+ $urlTest = '';
+}
+
+// BUG url
+if (preg_match('@bug([0-9]{1,}).phpt$@', $testName, $preg)) {
+ $bugUrl = 'http://bugs.php.net/'.$preg[1];
+} else {
+ $bugUrl = '';
+}
+
+
+
+
+$TITLE = "Reports for test ".$testName;
+common_header();
+?>
+
+
+
+
+';
+ echo '
';
+}
+if ($bugUrl != '') {
+ echo ' ';
+ echo '
';
+}
+?>
+
+
+
+
+
+
+
+
+
+ | Count |
+ Diff |
+
+
+
+\n ".$diff['cpt'].' (';
+ echo round($diff['cpt']/$sumCount*100)."%) ";
+ echo '';
+ echo ' | ';
+ echo "\n \n";
+ echo '';
+ $diffExploded = explode("\x0d", $diff['diff']);
+ foreach ($diffExploded as $line) {
+ if (preg_match('@([0-9]{2,})(\-{1}) @', $line)) {
+ echo ' '.htmlentities($line).' '."\n";
+
+ } elseif (preg_match('@[0-9]{2,}[\+]{1,} @', $line)) {
+ echo ' '.htmlentities($line).' '."\n";
+
+ } else {
+ // Should not happen. But print it anyway
+ echo $line;
+ }
+ }
+ echo ' | '."\n ";
+
+ // Complete output will be available in the future (present in DB file)
+ //echo 'View complete output | ';
+
+ echo ''."\n";
+ echo ' |
';
+ $i++;
+ if ($i > 20) break;
+}
+?>
+
+
+