Author: cfinck Date: Tue Jun 2 04:10:01 2009 New Revision: 427
URL: http://svn.reactos.org/svn/reactos?rev=427&view=rev Log: - Detect multiple summary lines and combine their information for one test. Fixes i.e. advapi32:security only showing 18 out of 1381 tests. - Fix the test name being stored with a trailing line break character inside the database.
Modified: branches/danny-web/www/www.reactos.org/testman/webservice/buildbot_aggregator.php branches/danny-web/www/www.reactos.org/testman/webservice/lib/WineTest.class.php
Modified: branches/danny-web/www/www.reactos.org/testman/webservice/buildbot_aggregator.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/webservice/buildbot_aggregator.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/webservice/buildbot_aggregator.php [iso-8859-1] Tue Jun 2 04:10:01 2009 @@ -70,7 +70,7 @@ break; // Parse the test line - if(!preg_match("#Running Wine Test, Module: (.+), Test: (.+)#", $line, $matches)) + if(!preg_match("#Running Wine Test, Module: (.+), Test: ([\S]+)#", $line, $matches)) die("Wine Test line is invalid!"); // Get a Suite ID for this combination @@ -83,7 +83,7 @@ // Now get the real log $log = ""; - do + for(;;) { $line = fgets($fp); @@ -101,8 +101,11 @@ $log .= "[TESTMAN] Maximum memory for log exceeded, aborting!"; break; } + + // Sysreg might also have noticed a system crash or we even reached the end of the log. Break then. + if(substr($line, 0, 9) == "[SYSREG] " || feof($fp)) + break; } - while(strpos($line, " tests executed (") === false && substr($line, 0, 9) != "[SYSREG] " && !feof($fp)); // Did we already get a Test ID for this run? if(!$test_id)
Modified: branches/danny-web/www/www.reactos.org/testman/webservice/lib/WineTest.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/webservice/lib/WineTest.class.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/webservice/lib/WineTest.class.php [iso-8859-1] Tue Jun 2 04:10:01 2009 @@ -70,16 +70,33 @@ if(!$stmt->fetchColumn()) return "No such test or no permissions!"; - // Parse the log - $line = strrchr($log, ":"); + // Get the test name + $stmt = $dbh->prepare("SELECT test FROM " . DB_TESTMAN . ".winetest_suites WHERE id = :id"); + $stmt->bindParam(":id", $suite_id); + $stmt->execute() or die("Submit(): SQL failed #2"); + $test = $stmt->fetchColumn(); - if(!$line || sscanf($line, ": %u tests executed (%u marked as todo, %u %s%u skipped.", $count, $todo, $failures, $ignore, $skipped) != 5) + // Get all summary lines belonging to this test in the whole log (a test may have multiple summary lines) + $result = preg_match_all("#^{$test}: ([0-9]+) tests executed ([0-9]+ marked as todo, ([0-9]+) failure[s]?), ([0-9]+) skipped.#m", $log, $matches, PREG_PATTERN_ORDER); + + if($result === FALSE) + { + return "preg_match_all failed!"; + } + else if($result == 0) { // We found no summary line, so the test probably crashed // Indicate this by setting count to -1 and set the rest to zero. $count = -1; $failures = 0; $skipped = 0; + } + else + { + // Sum up the values of each summary line + $count = array_sum($matches[1]); + $failures = array_sum($matches[2]); + $skipped = array_sum($matches[3]); } // Add the information into the DB @@ -89,12 +106,12 @@ $stmt->bindParam(":count", $count); $stmt->bindParam(":failures", $failures); $stmt->bindParam(":skipped", $skipped); - $stmt->execute() or die("Submit(): SQL failed #2"); + $stmt->execute() or die("Submit(): SQL failed #3"); $stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_logs (id, log) VALUES (:id, :log)"); $stmt->bindValue(":id", (int)$dbh->lastInsertId()); $stmt->bindParam(":log", $log); - $stmt->execute() or die("Submit(): SQL failed #3"); + $stmt->execute() or die("Submit(): SQL failed #4"); return "OK"; }