Author: cfinck Date: Thu Jun 18 01:27:17 2009 New Revision: 435
URL: http://svn.reactos.org/svn/reactos?rev=435&view=rev Log: - Add general "Total Tests" and "Failed Tests" column headers to the search results to get sums of all executed and failed tests. A feature for comparing these general numbers through the Compare page will follow later. - Identify crashed tests by an extra column, not by a negative number of total tests. - Add a new status "CANCELED": If we can detect that a test was canceled by testman (maximum log size exceeded) or sysreg (timeout), we show that, otherwise "CRASH" is used. - Simplify some code now that we have only one search result box to care about. - Also sort the results ascending if a user uses the "Compare first two Results" button.
Modified: branches/danny-web/resources/testman/testman.sql branches/danny-web/www/www.reactos.org/testman/ajax-search.php branches/danny-web/www/www.reactos.org/testman/compare.php branches/danny-web/www/www.reactos.org/testman/css/compare.css branches/danny-web/www/www.reactos.org/testman/css/detail.css branches/danny-web/www/www.reactos.org/testman/detail.php branches/danny-web/www/www.reactos.org/testman/js/index.js.php branches/danny-web/www/www.reactos.org/testman/utils.inc.php branches/danny-web/www/www.reactos.org/testman/webservice/lib/WineTest.class.php
Modified: branches/danny-web/resources/testman/testman.sql URL: http://svn.reactos.org/svn/reactos/branches/danny-web/resources/testman/test... ============================================================================== --- branches/danny-web/resources/testman/testman.sql [iso-8859-1] (original) +++ branches/danny-web/resources/testman/testman.sql [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -15,6 +15,7 @@ `id` int(10) unsigned NOT NULL auto_increment, `test_id` int(10) unsigned NOT NULL, `suite_id` int(10) unsigned NOT NULL, + `status` enum('ok','crash','canceled') collate latin1_general_ci NOT NULL, `count` int(10) NOT NULL COMMENT 'Number of all executed tests', `failures` int(10) unsigned NOT NULL COMMENT 'Number of failed tests', `skipped` int(10) unsigned NOT NULL COMMENT 'Number of skipped tests', @@ -30,6 +31,8 @@ `revision` int(9) unsigned NOT NULL, `platform` varchar(24) collate latin1_general_ci NOT NULL, `comment` varchar(255) collate latin1_general_ci default NULL, + `count` int(10) unsigned NOT NULL COMMENT 'Sum of all executed tests', + `failures` int(10) unsigned NOT NULL COMMENT 'Sum of all test failures', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Modified: branches/danny-web/www/www.reactos.org/testman/ajax-search.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/ajax-search.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/ajax-search.php [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -90,7 +90,7 @@ if($_GET["resultlist"]) { $stmt = $dbh->query( - "SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, a.name, r.revision, r.platform, r.comment " . + "SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, a.name, r.revision, r.platform, r.comment, r.count, r.failures " . $tables . $where . $order . "LIMIT " . $result_count ) or die("<error>Query failed #2</error>"); @@ -113,6 +113,8 @@ printf("<revision>%d</revision>", $row["revision"]); printf("<platform>%s</platform>", GetPlatformString($row["platform"])); printf("<comment>%s</comment>", htmlspecialchars($row["comment"])); + printf("<count>%d</count>", $row["count"]); + printf("<failures>%d</failures>", $row["failures"]); echo "</result>"; $last_revision = $row["revision"];
Modified: branches/danny-web/www/www.reactos.org/testman/compare.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/compare.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/compare.php [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -23,11 +23,8 @@ // Return ("" is not possible because of IE...) if // - we have nothing to compare // - both values are identical - // - a crash occured in one of the results if(!$prev_result_row["id"] || - $current_result_row[$subject] == $prev_result_row[$subject] || - $current_result_row[$subject] == -1 || - $prev_result_row[$subject] == -1) + $current_result_row[$subject] == $prev_result_row[$subject]) { return " "; } @@ -45,7 +42,7 @@ if($changed) return; - if($temp == -2) + if($temp == -1) $temp = $current; else if($current != $temp) $changed = true; @@ -140,7 +137,7 @@ for($i = 0; $i < count($id_array); $i++) { $result_stmt[$i] = $dbh->prepare( - "SELECT e.id, e.count, e.failures, e.skipped " . + "SELECT e.id, e.status, e.count, e.failures, e.skipped " . "FROM " . DB_TESTMAN . ".winetest_suites s " . "LEFT JOIN " . DB_TESTMAN . ".winetest_results e ON e.suite_id = s.id AND e.test_id = :testid " . "WHERE s.id IN (" . $suite_idlist . ")" . @@ -194,9 +191,9 @@ $changed = false; $prev_result_row = null; - $temp_totaltests = -2; - $temp_failedtests = -2; - $temp_skippedtests = -2; + $temp_totaltests = -1; + $temp_failedtests = -1; + $temp_skippedtests = -1; for($i = 0; $i < count($result_stmt); $i++) { @@ -216,8 +213,8 @@ if($result_row["id"]) { - printf('<div title="%s" class="box totaltests">%s <span class="diff">%s</span></div>', $testman_langres["totaltests"], GetTotalTestsString($result_row["count"]), GetDifference($result_row, $prev_result_row, "count")); - printf('<div title="%s" class="box %s_failedtests">%d <span class="diff">%s</span></div>', $testman_langres["failedtests"], (($result_row["failures"] > 0 || $result_row["count"] == -1) ? 'real' : 'zero'), $result_row["failures"], GetDifference($result_row, $prev_result_row, "failures")); + printf('<div title="%s" class="box totaltests">%s <span class="diff">%s</span></div>', $testman_langres["totaltests"], GetTotalTestsString($result_row), GetDifference($result_row, $prev_result_row, "count")); + printf('<div title="%s" class="box %s_failedtests">%d <span class="diff">%s</span></div>', $testman_langres["failedtests"], (($result_row["failures"] > 0 || $result_row["status"] != "ok") ? 'real' : 'zero'), $result_row["failures"], GetDifference($result_row, $prev_result_row, "failures")); printf('<div title="%s" class="box skippedtests">%d <span class="diff">%s</span></div>', $testman_langres["skippedtests"], $result_row["skipped"], GetDifference($result_row, $prev_result_row, "skipped")); } else
Modified: branches/danny-web/www/www.reactos.org/testman/css/compare.css URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/css/compare.css [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/css/compare.css [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -101,5 +101,5 @@
#comparetable td div.totaltests { font-weight: bold; - width: 120px; + width: 130px; }
Modified: branches/danny-web/www/www.reactos.org/testman/css/detail.css URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/css/detail.css [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/css/detail.css [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -6,7 +6,7 @@ */
.datatable { - width: 800px; + width: 90%; }
.datatable th, .datatable td {
Modified: branches/danny-web/www/www.reactos.org/testman/detail.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/detail.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/detail.php [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -52,7 +52,7 @@ // Get information about this result $stmt = $dbh->prepare( - "SELECT l.log, e.count, e.failures, e.skipped, s.module, s.test, UNIX_TIMESTAMP(r.timestamp) timestamp, r.revision, r.platform, a.name, r.comment " . + "SELECT l.log, e.status, e.count, e.failures, e.skipped, s.module, s.test, UNIX_TIMESTAMP(r.timestamp) timestamp, r.revision, r.platform, a.name, r.comment " . "FROM " . DB_TESTMAN . ".winetest_results e " . "JOIN " . DB_TESTMAN . ".winetest_logs l ON e.id = l.id " . "JOIN " . DB_TESTMAN . ".winetest_suites s ON e.suite_id = s.id " . @@ -76,17 +76,17 @@ </tr> <tr class="odd" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> <td class="info"><?php echo $testman_langres["totaltests"]; ?>:</td> - <td><?php echo GetTotalTestsString($row["count"]); ?></td> + <td><?php echo GetTotalTestsString($row); ?></td> </tr> <tr class="even" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> <td class="info"><?php echo $testman_langres["failedtests"]; ?>:</td> <td><?php echo $row["failures"]; ?></td> </tr> - <tr class="even" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> + <tr class="odd" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> <td class="info"><?php echo $testman_langres["skippedtests"]; ?>:</td> <td><?php echo $row["skipped"]; ?></td> </tr> - <tr class="odd" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> + <tr class="even" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)"> <td class="info"><?php echo $testman_langres["log"]; ?>:</td> <td><pre><?php $patterns[0] = "#^([a-z]*:?()([a-zA-Z0-9/]+.[a-z]+):([0-9]+)())#m";
Modified: branches/danny-web/www/www.reactos.org/testman/js/index.js.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/js/index.js.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/js/index.js.php [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -56,14 +56,8 @@ return; } - var id = checkbox.name.substr(5); - - // Make sure all checkboxes belonging to this test show the same state - var elems = document.getElementsByName(checkbox.name); - - for(var i = 0; i < elems.length; i++) - elems[i].checked = checkbox.checked; - + var id = checkbox.id.substr(5); + if(checkbox.checked) { SelectedResults[id] = true; @@ -86,19 +80,19 @@ { for(id in SelectedResults) { - var elems = document.getElementsByName("test_" + id); - - for(var i = 0; i < elems.length; i++) - elems[i].checked = true; - } -} - -function Result_OnCheckboxClick(checkbox) + var checkbox = document.getElementById("test_" + id); + + if(checkbox) + checkbox.checked = true; + } +} + +function ResultCheckbox_OnClick(checkbox) { UpdateSelectedResults(checkbox); }
-function Result_OnCellClick(elem) +function ResultCell_OnClick(elem) { var checkbox = elem.parentNode.firstChild.firstChild; checkbox.checked = !checkbox.checked; @@ -340,6 +334,8 @@ html += '<th class="TestCheckbox"></th>'; html += '<th><?php echo addslashes($testman_langres["revision"]); ?></th>'; html += '<th><?php echo addslashes($testman_langres["date"]); ?></th>'; + html += '<th><?php echo addslashes($testman_langres["totaltests"]); ?></th>'; + html += '<th><?php echo addslashes($testman_langres["failedtests"]); ?></th>'; html += '<th><?php echo addslashes($testman_langres["user"]); ?></th>'; html += '<th><?php echo addslashes($testman_langres["platform"]); ?></th>'; html += '<th><?php echo addslashes($testman_langres["comment"]); ?></th>'; @@ -350,7 +346,7 @@ if(!results.length) { - html += '<tr class="even"><td colspan="6"><?php echo addslashes($testman_langres["noresults"]); ?></td></tr>'; + html += '<tr class="even"><td colspan="8"><?php echo addslashes($testman_langres["noresults"]); ?></td></tr>'; } else { @@ -361,17 +357,21 @@ var ResultID = GetTagData(results[i], "id"); var ResultRevision = GetTagData(results[i], "revision"); var ResultDate = GetTagData(results[i], "date"); + var ResultCount = GetTagData(results[i], "count"); + var ResultFailures = GetTagData(results[i], "failures"); var ResultUser = GetTagData(results[i], "user"); var ResultPlatform = GetTagData(results[i], "platform"); var ResultComment = GetTagData(results[i], "comment"); html += '<tr class="' + (oddeven ? "odd" : "even") + '" onmouseover="Result_OnMouseOver(this)" onmouseout="Result_OnMouseOut(this)">'; - html += '<td><input onclick="Result_OnCheckboxClick(this)" type="checkbox" name="test_' + ResultID + '" /></td>'; - html += '<td onclick="Result_OnCellClick(this)">' + ResultRevision + '</td>'; - html += '<td onclick="Result_OnCellClick(this)">' + ResultDate + '</td>'; - html += '<td onclick="Result_OnCellClick(this)">' + ResultUser + '</td>'; - html += '<td onclick="Result_OnCellClick(this)">' + ResultPlatform + '</td>'; - html += '<td onclick="Result_OnCellClick(this)">' + ResultComment + '</td>'; + html += '<td><input onclick="ResultCheckbox_OnClick(this)" type="checkbox" id="test_' + ResultID + '" /></td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultRevision + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultDate + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultCount + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultFailures + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultUser + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultPlatform + '</td>'; + html += '<td onclick="ResultCell_OnClick(this)">' + ResultComment + '</td>'; html += '</tr>';
oddeven = !oddeven; @@ -423,8 +423,30 @@ document.getElementById("ajax_loading_search").style.visibility = "hidden"; }
-function OpenComparePage(parameters) -{ +/** + * Open the Compare page in the user-defined area + * + * @param ResultArray + * Array containing the result IDs to pass to the Compare page. + * The array will be sorted ascending before. + */ +function OpenComparePage(ResultArray) +{ + var parameters = "ids="; + + ResultArray.sort(NumericComparison); + + for(i = 0; i < ResultArray.length; i++) + { + if(!i) + { + parameters += ResultArray[i]; + continue; + } + + parameters += "," + ResultArray[i]; + } + if(document.getElementById("opennewwindow").checked || DetectObsoleteIE()) { window.open("compare.php?" + parameters); @@ -440,19 +462,20 @@
function CompareFirstTwoButton_OnClick() { - var parameters = "ids="; + var IDArray; var trs = document.getElementById("resulttable").getElementsByTagName("tbody")[0].getElementsByTagName("tr"); if(trs[0].firstChild.firstChild.nodeName != "INPUT") return; - // Get the IDs through the "name" attribute of the checkboxes - parameters += trs[0].firstChild.firstChild.name.substr(5); + // Get the IDs through the "id" attribute of the checkboxes + IDArray = new Array(); + IDArray.push(parseInt(trs[0].firstChild.firstChild.id.substr(5))); if(trs[1]) - parameters += "," + trs[1].firstChild.firstChild.name.substr(5); - - OpenComparePage(parameters); + IDArray.push(parseInt(trs[1].firstChild.firstChild.id.substr(5))); + + OpenComparePage(IDArray); }
function PageSwitch(NewPage, StartID) @@ -502,7 +525,6 @@
function CompareSelectedButton_OnClick() { - var parameters = "ids="; var IDArray = new Array(); // Sort the selected IDs @@ -515,21 +537,7 @@ return; } - IDArray.sort(NumericComparison); - - for(i = 0; i < IDArray.length; i++) - { - if(!i) - { - parameters += IDArray[i]; - first = false; - continue; - } - - parameters += "," + IDArray[i]; - } - - OpenComparePage(parameters); + OpenComparePage(IDArray); }
function OpenNewWindowCheckbox_OnClick(checkbox)
Modified: branches/danny-web/www/www.reactos.org/testman/utils.inc.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/te... ============================================================================== --- branches/danny-web/www/www.reactos.org/testman/utils.inc.php [iso-8859-1] (original) +++ branches/danny-web/www/www.reactos.org/testman/utils.inc.php [iso-8859-1] Thu Jun 18 01:27:17 2009 @@ -126,12 +126,11 @@ return date("Y-m-d H:i", $timestamp); } - function GetTotalTestsString($count) + function GetTotalTestsString($row) { - // The number of total tests being -1 indicates that the test crashed while running - if($count == -1) - return "CRASH"; + if($row["status"] != "ok") + return strtoupper($row["status"]); - return $count; + return $row["count"]; } ?>
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] Thu Jun 18 01:27:17 2009 @@ -85,24 +85,32 @@ } 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; + // We found no summary line, now check whether we find any signs that the test was canceled + $lastline = strrchr($log, "["); + + if($lastline && (strpos($lastline, "[SYSREG]") !== FALSE || strpos($lastline, "[TESTMAN]") !== FALSE)) + $status = "canceled"; + else + $status = "crash"; + + $count = 0; $failures = 0; $skipped = 0; } else { // Sum up the values of each summary line + $status = "ok"; $count = array_sum($matches[1]); $failures = array_sum($matches[2]); $skipped = array_sum($matches[3]); } // Add the information into the DB - $stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_results (test_id, suite_id, count, failures, skipped) VALUES (:testid, :suiteid, :count, :failures, :skipped)"); + $stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_results (test_id, suite_id, status, count, failures, skipped) VALUES (:testid, :suiteid, :status, :count, :failures, :skipped)"); $stmt->bindValue(":testid", (int)$test_id); $stmt->bindValue(":suiteid", (int)$suite_id); + $stmt->bindParam(":status", $status); $stmt->bindParam(":count", $count); $stmt->bindParam(":failures", $failures); $stmt->bindParam(":skipped", $skipped); @@ -124,8 +132,15 @@ if(!isset($test_id)) return "Necessary sub-information not specified!"; - // Mark this test as finished, so no more results can be submitted for it - $stmt = $dbh->prepare("UPDATE " . DB_TESTMAN . ".winetest_runs SET finished = 1 WHERE id = :testid AND user_id = :userid"); + // Sum up all results and mark this test as finished, so no more results can be submitted for it + $stmt = $dbh->prepare( + "UPDATE " . DB_TESTMAN . ".winetest_runs " . + "SET " . + "finished = 1, " . + "count = (SELECT SUM(count) FROM " . DB_TESTMAN . ".winetest_results WHERE test_id = :testid), " . + "failures = (SELECT SUM(failures) FROM " . DB_TESTMAN . ".winetest_results WHERE test_id = :testid) " . + "WHERE id = :testid AND user_id = :userid" + ); $stmt->bindParam(":userid", $user_id); $stmt->bindParam(":testid", $test_id); $stmt->execute() or die("Finish(): SQL failed #1");