[ros-diffs] [cfinck] 39743: - Add a BuildBot aggregator script for getting the test result information from the BuildBot logs - Make the WineTest class functions more general, so that they can be used for the aggregator script - Show the comment in the results (option added to rosautotest in r39698) - Add an option to search for test results by user - Make the result information order consistent - Support searching for results by pressing the Return key - Update translations accordingly (Polish translation updated by Mariusz Przybylski, pay7n at o2.pl) - Add "utils.php" to the Web Service for sharing stuff between different callers - Coding style adjustments: Use camelCase for class functions as it's done in Danny's RosCMS v4

cfinck at svn.reactos.org cfinck at svn.reactos.org
Tue Feb 24 23:24:06 CET 2009


Author: cfinck
Date: Wed Feb 25 01:24:06 2009
New Revision: 39743

URL: http://svn.reactos.org/svn/reactos?rev=39743&view=rev
Log:
- Add a BuildBot aggregator script for getting the test result information from the BuildBot logs
- Make the WineTest class functions more general, so that they can be used for the aggregator script
- Show the comment in the results (option added to rosautotest in r39698)
- Add an option to search for test results by user
- Make the result information order consistent
- Support searching for results by pressing the Return key
- Update translations accordingly (Polish translation updated by Mariusz Przybylski, pay7n at o2.pl)
- Add "utils.php" to the Web Service for sharing stuff between different callers
- Coding style adjustments: Use camelCase for class functions as it's done in Danny's RosCMS v4

Added:
    trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php   (with props)
    trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php   (with props)
Modified:
    trunk/web/reactos.org/htdocs/shared/lang/pl.inc.php
    trunk/web/reactos.org/htdocs/testman/ajax-search.php
    trunk/web/reactos.org/htdocs/testman/compare.php
    trunk/web/reactos.org/htdocs/testman/detail.php
    trunk/web/reactos.org/htdocs/testman/index.php
    trunk/web/reactos.org/htdocs/testman/js/index.js.php
    trunk/web/reactos.org/htdocs/testman/lang/de.inc.php
    trunk/web/reactos.org/htdocs/testman/lang/en.inc.php
    trunk/web/reactos.org/htdocs/testman/lang/pl.inc.php
    trunk/web/reactos.org/htdocs/testman/webservice/index.php
    trunk/web/reactos.org/htdocs/testman/webservice/lib/WineTest.class.php

Modified: trunk/web/reactos.org/htdocs/shared/lang/pl.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/shared/lang/pl.inc.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/shared/lang/pl.inc.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/shared/lang/pl.inc.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -6,6 +6,7 @@
   COPYRIGHT:  Copyright 2008-2009 Colin Finck <colin at reactos.org>
   TRANSLATOR: Maciej Bialas
               Olaf Siejka
+              Mariusz Przybylski
   
   charset=utf-8 without BOM
 */
@@ -13,7 +14,7 @@
 	$shared_langres = array(
 		"language" => "Język",
 		
-		"rangeinfo" => "Możesz wprowadzić numer wersji (np. %s) lub przedział wersji (np. %s-%s)",
+		"rangeinfo" => "Możesz wprowadzić numer rewizji (np. %s) lub przedział rewizji (np. %s-%s)",
 		
 		"firstpage_title" => "Przejdź do pierwszej strony",
 		"prevpage_title" => "Poprzednia strona",

Modified: trunk/web/reactos.org/htdocs/testman/ajax-search.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/ajax-search.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/ajax-search.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/ajax-search.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -8,7 +8,7 @@
 
 	header("Content-type: text/xml");
 	
-	if(!isset($_GET["startrev"]) || !isset($_GET["endrev"]) || !isset($_GET["platform"]))
+	if(!isset($_GET["startrev"]) || !isset($_GET["endrev"]) || !isset($_GET["user"]) || !isset($_GET["platform"]))
 		die("<error>Necessary information not specified!</error>");
 
 
@@ -28,28 +28,33 @@
 	// Prepare the WHERE clause
 	$where = "";
 	
-	if($_GET["startrev"] || $_GET["startid"] || $_GET["platform"])
+	if($_GET["startrev"] || $_GET["startid"] || $_GET["user"] || $_GET["platform"])
 	{
 		// Begin the WHERE clause with "WHERE 1 ", so we can begin all following statements with AND :-)
 		$where = "WHERE 1 ";
 		
 		if($_GET["startrev"])
-			$where .= "AND revision >= " . (int)$_GET["startrev"] . " AND revision <= " . (int)$_GET["endrev"] . " ";
+			$where .= "AND r.revision >= " . (int)$_GET["startrev"] . " AND r.revision <= " . (int)$_GET["endrev"] . " ";
 		
 		if($_GET["startid"])
-			$where .= "AND id >= " . (int)$_GET["startid"] . " ";
+			$where .= "AND r.id >= " . (int)$_GET["startid"] . " ";
+		
+		if($_GET["user"])
+			$where .= "AND u.user_name LIKE " . $dbh->quote($_GET["user"] . "%") . " ";
 		
 		if($_GET["platform"])
-			$where .= "AND platform LIKE " . $dbh->quote($_GET["platform"] . "%") . " ";
+			$where .= "AND r.platform LIKE " . $dbh->quote($_GET["platform"] . "%") . " ";
 	}
 	
-	// Prepare the ORDER clause
+	// Prepare some clauses
+	$tables = "FROM " . DB_TESTMAN . ".winetest_runs r JOIN " . DB_ROSCMS . ".users u ON r.user_id = u.user_id ";
 	$order = "ORDER BY revision ASC, id ASC ";
 	
 	echo "<results>";
 	
 	// First determine how many results we would get in total with this query
-	$stmt = $dbh->query("SELECT COUNT(*) FROM " . DB_TESTMAN . ".winetest_runs " . $where) or die("<error>Query failed #1</error>");
+	$stmt = $dbh->query("SELECT COUNT(*) " . $tables . $where) or die("<error>Query failed #1</error>");
+	
 	$result_count = $stmt->fetchColumn();
 	
 	if($result_count > RESULTS_PER_PAGE)
@@ -76,11 +81,8 @@
 		if($_GET["resultlist"])
 		{
 			$stmt = $dbh->query(
-				"SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, u.user_name, r.revision, r.platform " .
-				"FROM " . DB_TESTMAN . ".winetest_runs r " .
-				"JOIN " . DB_ROSCMS . ".users u ON r.user_id = u.user_id " .
-				$where .
-				$order .
+				"SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, u.user_name, r.revision, r.platform, r.comment " .
+				$tables .	$where . $order .
 				"LIMIT " . RESULTS_PER_PAGE
 			) or die("<error>Query failed #2</error>");
 			
@@ -101,6 +103,7 @@
 				printf("<user>%s</user>", htmlspecialchars($row["user_name"]));
 				printf("<revision>%d</revision>", $row["revision"]);
 				printf("<platform>%s</platform>", GetPlatformString($row["platform"]));
+				printf("<comment>%s</comment>", htmlspecialchars($row["comment"]));
 				echo "</result>";
 				
 				$last_revision = $row["revision"];
@@ -109,16 +112,17 @@
 		else
 		{
 			// Get the first and last revision belonging to this call
-			$stmt = $dbh->query("SELECT id, revision FROM " . DB_TESTMAN . ".winetest_runs " . $where . $order . "LIMIT 1") or die("<error>Query failed #3</error>");
+			$stmt = $dbh->query("SELECT r.id, r.revision " . $tables . $where .	$order . "LIMIT 1") or die("<error>Query failed #3</error>");
 			$row = $stmt->fetch(PDO::FETCH_ASSOC);
 			$first_id = $row["id"];
 			$first_revision = $row["revision"];
 			
-			$stmt = $dbh->query("SELECT revision FROM " . DB_TESTMAN . ".winetest_runs " . $where . $order . "LIMIT " . ($result_count - 1) . ", 1") or die("<error>Query failed #4</error>");
+			$stmt = $dbh->query("SELECT r.revision " . $tables . $where . $order . "LIMIT " . ($result_count - 1) . ", 1") or die("<error>Query failed #4</error>");
 			$last_revision = $stmt->fetchColumn();
 		}
 		
-		$stmt = $dbh->query("SELECT id FROM " . DB_TESTMAN . ".winetest_runs " . $where . $order . "LIMIT " . $result_count . ", 1") or die("<error>Query failed #5</error>");
+		// Get the next ID (= the first ID after our limit)
+		$stmt = $dbh->query("SELECT r.id " . $tables . $where .	$order . "LIMIT " . $result_count . ", 1") or die("<error>Query failed #5</error>");
 		$next_id = $stmt->fetchColumn();
 	}
 	

Modified: trunk/web/reactos.org/htdocs/testman/compare.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/compare.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/compare.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/compare.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -170,7 +170,7 @@
 		$row = $stmt->fetch(PDO::FETCH_ASSOC);
 		
 		echo '<th onmousedown="ResultHead_OnMouseDown(this)">';
-		printf($testman_langres["resulthead"], $row["revision"], GetPlatformString($row["platform"]), $row["user_name"], GetDateString($row["timestamp"]));
+		printf($testman_langres["resulthead"], $row["revision"], GetDateString($row["timestamp"]), $row["user_name"], GetPlatformString($row["platform"]));
 		echo '</th>';
 	}
 	

Modified: trunk/web/reactos.org/htdocs/testman/detail.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/detail.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/detail.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/detail.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -53,7 +53,7 @@
 	
 	// Get information about this result
 	$stmt = $dbh->prepare(
-		"SELECT e.log, e.count, e.todo, e.failures, e.skipped, s.module, s.test, UNIX_TIMESTAMP(r.timestamp) timestamp, r.revision, r.platform, u.user_name " .
+		"SELECT e.log, e.count, e.todo, e.failures, e.skipped, s.module, s.test, UNIX_TIMESTAMP(r.timestamp) timestamp, r.revision, r.platform, u.user_name, r.comment " .
 		"FROM " . DB_TESTMAN . ".winetest_results e " .
 		"JOIN " . DB_TESTMAN . ".winetest_suites s ON e.suite_id = s.id " .
 		"JOIN " . DB_TESTMAN . ".winetest_runs r ON e.test_id = r.id " .
@@ -106,16 +106,20 @@
 		<td><?php echo $row["revision"]; ?></td>
 	</tr>
 	<tr class="odd" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)">
-		<td class="info"><?php echo $testman_langres["platform"]; ?>:</td>
-		<td><?php echo GetPlatformString($row["platform"]); ?></td>
+		<td class="info"><?php echo $testman_langres["date"]; ?>:</td>
+		<td><?php echo GetDateString($row["timestamp"]); ?></td>
 	</tr>
 	<tr class="even" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)">
 		<td class="info"><?php echo $testman_langres["user"]; ?>:</td>
 		<td><?php echo $row["user_name"]; ?></td>
 	</tr>
 	<tr class="odd" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)">
-		<td class="info"><?php echo $testman_langres["date"]; ?>:</td>
-		<td><?php echo GetDateString($row["timestamp"]); ?></td>
+		<td class="info"><?php echo $testman_langres["platform"]; ?>:</td>
+		<td><?php echo GetPlatformString($row["platform"]); ?></td>
+	</tr>
+	<tr class="even" onmouseover="Row_OnMouseOver(this)" onmouseout="Row_OnMouseOut(this)">
+		<td class="info"><?php echo $testman_langres["comment"]; ?>:</td>
+		<td><?php echo GetPlatformString($row["comment"]); ?></td>
 	</tr>
 </table>
 

Modified: trunk/web/reactos.org/htdocs/testman/index.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/index.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/index.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/index.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -93,10 +93,11 @@
 							<thead>
 								<tr class="head">
 									<th class="TestCheckbox"></th>
+									<th><?php echo $testman_langres["revision"]; ?></th>
 									<th><?php echo $testman_langres["date"]; ?></th>
-									<th><?php echo $testman_langres["revision"]; ?></th>
 									<th><?php echo $testman_langres["user"]; ?></th>
 									<th><?php echo $testman_langres["platform"]; ?></th>
+									<th><?php echo $testman_langres["comment"]; ?></th>
 								</tr>
 							</thead>
 							<tbody>
@@ -112,7 +113,7 @@
 									}
 									
 									$stmt = $dbh->query(
-										"SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, u.user_name, r.revision, r.platform " .
+										"SELECT r.id, UNIX_TIMESTAMP(r.timestamp) timestamp, u.user_name, r.revision, r.platform, r.comment " .
 										"FROM " . DB_TESTMAN . ".winetest_runs r " .
 										"JOIN " . DB_ROSCMS . ".users u ON r.user_id = u.user_id " .
 										"ORDER BY revision DESC, id DESC " .
@@ -128,10 +129,11 @@
 										
 										printf('<tr class="%s" onmouseover="Result_OnMouseOver(this)" onmouseout="Result_OnMouseOut(this)">', ($oddeven ? "odd" : "even"));
 										printf('<td><input onclick="Result_OnCheckboxClick(this)" type="checkbox" name="test_%s" /></td>', $row["id"]);
+										printf('<td onclick="Result_OnCellClick(this)">%s</td>', $row["revision"]);
 										printf('<td onclick="Result_OnCellClick(this)">%s</td>', GetDateString($row["timestamp"]));
-										printf('<td onclick="Result_OnCellClick(this)">%s</td>', $row["revision"]);
 										printf('<td onclick="Result_OnCellClick(this)">%s</td>', htmlspecialchars($row["user_name"]));
 										printf('<td onclick="Result_OnCellClick(this)">%s</td>', GetPlatformString($row["platform"]));
+										printf('<td onclick="Result_OnCellClick(this)">%s</td>', htmlspecialchars($row["comment"]));
 										echo "</tr>";
 										
 										$oddeven = !$oddeven;
@@ -170,17 +172,23 @@
 						
 						<table id="searchform">
 							<tr>
-								<td><?php echo $testman_langres["search_revision"]; ?>:</td>
+								<td><?php echo $testman_langres["revision"]; ?>:</td>
 								<td>
-									<input type="text" id="search_revision" value="" size="12" onkeyup="SearchRevisionInput_OnKeyUp(this)" /><br />
+									<input type="text" id="search_revision" value="" size="12" onkeypress="SearchInputs_OnKeyPress(event)" onkeyup="SearchRevisionInput_OnKeyUp(this)" /><br />
 									
 									<img src="../shared/images/info.gif" alt="" /> <?php printf($shared_langres["rangeinfo"], $rev, ($rev - 50), $rev); ?>
 								</td>
 							</tr>
 							<tr>
-								<td><?php echo $testman_langres["search_platform"]; ?>:</td>
+								<td><?php echo $testman_langres["user"]; ?>:</td>
 								<td>
-									<select id="search_platform" size="1">
+									<input type="text" id="search_user" value="" size="24" onkeypress="SearchInputs_OnKeyPress(event)" />
+								</td>
+							</tr>
+							<tr>
+								<td><?php echo $testman_langres["platform"]; ?>:</td>
+								<td>
+									<select id="search_platform" size="1" onkeypress="SearchInputs_OnKeyPress(event)">
 										<option></option>
 										<option value="reactos">ReactOS</option>
 										<option value="5.0">Windows 2000</option>

Modified: trunk/web/reactos.org/htdocs/testman/js/index.js.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/js/index.js.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/js/index.js.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/js/index.js.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -106,6 +106,19 @@
 	UpdateSelectedResults(checkbox);
 }
 
+function SearchInputs_OnKeyPress(event)
+{
+	// IE vs. other browsers again
+	if(window.event)
+		var KeyCode = window.event.keyCode;
+	else
+		var KeyCode = event.which;
+	
+	// Submit the search form in case the user pressed the Return key
+	if(KeyCode == 13)
+		SearchButton_OnClick();
+}
+
 function SearchRevisionInput_OnKeyUp(elem)
 {
 	var val = elem.value.replace(/[^[0-9-]/g, "");
@@ -172,12 +185,23 @@
 	
 	data["startrev"] = inputbox_startrev;
 	data["endrev"] = inputbox_endrev;
+	data["user"] = document.getElementById("search_user").value;
 	data["platform"] = document.getElementById("search_platform").value;
 	
 	data["resultlist"] = 1;
 	data["requesttype"] = REQUESTTYPE_FULLLOAD;
 	
 	SearchCall();
+}
+
+function GetTagData(RootElement, TagName)
+{
+	var Child = RootElement.getElementsByTagName(TagName)[0].firstChild;
+	
+	if(!Child)
+		return "";
+	
+	return Child.data;
 }
 
 function SearchCallback(HttpRequest)
@@ -258,10 +282,11 @@
 		
 		html += '<thead><tr class="head">';
 		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["revision"]); ?><\/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>';
 		html += '<\/tr><\/thead>';
 		html += '<tbody>';
 		
@@ -277,18 +302,20 @@
 			
 			for(var i = 0; i < results.length; i++)
 			{
-				var ResultID = results[i].getElementsByTagName("id")[0].firstChild.data;
-				var ResultDate = results[i].getElementsByTagName("date")[0].firstChild.data;
-				var ResultUser = results[i].getElementsByTagName("user")[0].firstChild.data;
-				var ResultRevision = results[i].getElementsByTagName("revision")[0].firstChild.data;
-				var ResultPlatform = results[i].getElementsByTagName("platform")[0].firstChild.data;
+				var ResultID = GetTagData(results[i], "id");
+				var ResultRevision = GetTagData(results[i], "revision");
+				var ResultDate = GetTagData(results[i], "date");
+				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)">' + ResultRevision + '<\/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 += '<\/tr>';
 
 				oddeven = !oddeven;

Modified: trunk/web/reactos.org/htdocs/testman/lang/de.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/lang/de.inc.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/lang/de.inc.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/lang/de.inc.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -21,12 +21,11 @@
 		"revision" => "Revision",
 		"user" => "Benutzer",
 		"platform" => "Plattform",
+		"comment" => "Kommentar",
 		
 		"search_header" => "Nach Testergebnissen suchen",
-		"search_revision" => "Revision",
-		"search_platform" => "Plattform",
 		"search_button" => "Suchen",
-		"searching" => "Testergebnisse werden gesucht...",
+		"searching" => "Testergebnisse werden gesucht",
 		
 		"foundresults" => "%s Ergebnisse gefunden!",
 		"noresults" => "Keine Suchergebnisse!",
@@ -49,13 +48,13 @@
 		"difference" => "Unterschied zum vorherigen Ergebnis",
 		
 		"testsuite" => "Test Suite",
-		"resulthead" => "Revision %d<br />unter %s<br />von %s<br />am %s",
+		"resulthead" => "Revision %d<br />am %s<br />von %s<br />unter %s",
 		
 		// Result Details page
 		"detail_title" => "Ergebnis-Details",
 		
 		"thisresult" => "Informationen über dieses Ergebnis",
 		"log" => "Log",
-		"associatedtest" => "Information über den zugeordneten Test",
+		"associatedtest" => "Informationen über den zugeordneten Test",
 	);
 ?>

Modified: trunk/web/reactos.org/htdocs/testman/lang/en.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/lang/en.inc.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/lang/en.inc.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/lang/en.inc.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -21,11 +21,9 @@
 		"revision" => "Revision",
 		"user" => "User",
 		"platform" => "Platform",
+		"comment" => "Comment",
 		
 		"search_header" => "Search for Test Results",
-		"search_revision" => "Revision",
-		"rangeinfo" => "You can enter a revision number (e.g. %s) or a revision range (e.g. %s-%s)",
-		"search_platform" => "Platform",
 		"search_button" => "Search",
 		"searching" => "Searching for Test Results",
 		
@@ -50,7 +48,7 @@
 		"difference" => "Difference to the previous result",
 		
 		"testsuite" => "Test Suite",
-		"resulthead" => "Revision %d<br />under %s<br />by %s<br />at %s",
+		"resulthead" => "Revision %d<br />at %s<br />by %s<br />under %s",
 		
 		// Result Details page
 		"detail_title" => "Result Details",

Modified: trunk/web/reactos.org/htdocs/testman/lang/pl.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/lang/pl.inc.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/lang/pl.inc.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/lang/pl.inc.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -5,6 +5,7 @@
   PURPOSE:    Translation
   COPYRIGHT:  Copyright 2008-2009 Colin Finck <colin at reactos.org>
   TRANSLATOR: Maciej Bialas
+              Mariusz Przybylski
   
   charset=utf-8 without BOM
 */
@@ -16,23 +17,21 @@
 		"index_intro" => "Ten interfejs pozwala Tobie znaleźć, zobaczyć i porównać wyniki przeprowadzanych automatycznie testów regresji.",
 		"js_disclaimer" => "Musisz wÅ‚Ä
czyć obsługę JavaScriptu, aby używać tego interfejsu!",
 		
-		"lastresults_header" => "Ostatnich 10 wyników testów",
+		"lastresults_header" => "10 ostatnich wyników testów",
 		"date" => "Data",
-		"revision" => "Wydanie",
+		"revision" => "Rewizja",
 		"user" => "Użytkownik",
 		"platform" => "Platforma",
+		"comment" => "Komentarz",
 		
-		"search_header" => "Szukaj w wynikach testów",
-		"search_revision" => "Wydanie",
-		"rangeinfo" => "Możesz wprowadzić numer wydania (np. %s) lub przedział (np. %s-%s)",
-		"search_platform" => "Platforma",
+		"search_header" => "Szukaj wyników testów",
 		"search_button" => "Szukaj",
 		"searching" => "Trwa szukanie w wynikach testów",
 		
 		"foundresults" => "Znaleziono %s wyników!",
 		"noresults" => "Brak wyników wyszukiwania!",
 		
-		"status" => "<b>%s</b> testów zaznaczonych do porównania",
+		"status" => "<b>%s</b> testów wybranych do porównania",
 		"compare_button" => "Porównaj",
 		
 		"noselection" => "Nie wybrałeś/aś żadnych wyników!",
@@ -45,18 +44,18 @@
 		"legend" => "Legenda",
 		"totaltests" => "Wszystkie testy",
 		"failedtests" => "Nieudane",
-		"todotests" => "Oznaczone jako ToDo",
+		"todotests" => "Oznaczone jako TODO",
 		"skippedtests" => "Pominięte",
 		"difference" => "Różnica względem poprzedniego wyniku",
 		
 		"testsuite" => "Zestaw testów",
-		"resulthead" => "Wydanie %d<br />pod %s<br />przez %s<br /> %s",
+		"resulthead" => "Rewizja %d<br />dnia %s<br />przez %s<br /> na %s",
 		
 		// Result Details page
-		"detail_title" => "Szczegóły wyników",
+		"detail_title" => "Szczegóły wyniku",
 		
-		"thisresult" => "Informacje o tych wynikach",
+		"thisresult" => "Informacje o tym wyniku",
 		"log" => "Dziennik",
-		"associatedtest" => "Informacja o powiÄ
zanych testach",
+		"associatedtest" => "Informacje o powiÄ
zanym teście",
 	);
 ?>

Added: trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php?rev=39743&view=auto
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php (added)
+++ trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -1,0 +1,122 @@
+<?php
+/*
+  PROJECT:    ReactOS Web Test Manager
+  LICENSE:    GNU GPLv2 or any later version as published by the Free Software Foundation
+  PURPOSE:    Aggregator for the Debug Log of ReactOS BuildBot Buildslaves
+  COPYRIGHT:  Copyright 2009 Colin Finck <colin at reactos.org>
+*/
+
+	require_once("../config.inc.php");
+	require_once("utils.inc.php");
+	
+	if(!isset($_GET["username"]) || !isset($_GET["password"]) || !isset($_GET["slavename"]) || !is_numeric($_GET["platform"]) || !is_numeric($_GET["build"]))
+		die("Necessary information not specified!");
+	
+	try
+	{
+		$dbh = new PDO("mysql:host=" . DB_HOST, DB_USER, DB_PASS);
+	}
+	catch(PDOException $e)
+	{
+		// Give no exact error message here, so no server internals are exposed
+		die("Could not establish the DB connection");
+	}
+	
+	$user_id = VerifyLogin($_GET["username"], $_GET["password"]);
+	
+	// Make sure nobody runs this script multiple times for the same build
+	$stmt = $dbh->prepare("SELECT COUNT(*) FROM " . DB_TESTMAN . ".winetest_runs WHERE comment = :comment");
+	$stmt->bindValue(":comment", "Build " . $_GET["build"]);
+	$stmt->execute() or die("SQL failed #1");
+	
+	if($stmt->fetchColumn())
+		die("The script already processed this build before!");
+	
+	// Read the Buildslave test log
+	$fp = @fopen("http://reactos.org:8010/builders/" . $_GET["slavename"] . "/builds/" . $_GET["build"] . "/steps/test/logs/stdio/text", "r");
+	
+	if(!$fp)
+		die("Could not open the test log!");
+	
+	// Get the revision
+	do
+	{
+		$line = fgets($fp);
+	}
+	while(!preg_match("#.+ ReactOS .+ \(Build [0-9]+-r([0-9]+)\)#", $line, $matches) && !feof($fp));
+	
+	$revision = $matches[1];
+	
+	if(!$revision)
+		die("Got no revision");
+	
+	// Create a WineTest object for accessing the database
+	$t = new WineTest();
+	
+
+	// Get the log for each test
+	$line = "";
+	$test_id = 0;
+	
+	while(!feof($fp))
+	{
+		// Find the line with the test information
+		while(substr($line, 0, 27) != "Running Wine Test, Module: " && !feof($fp))
+			$line = fgets($fp);
+		
+		// We might reach end of file here, we're done in this case
+		if(feof($fp))
+			break;
+		
+		// Parse the test line
+		if(!preg_match("#Running Wine Test, Module: (.+), Test: (.+)#", $line, $matches))
+			die("Wine Test line is invalid!");
+		
+		// Get a Suite ID for this combination
+		$suite_id = $t->getSuiteId($matches[1], $matches[2]);
+		
+		// If an error occured, $suite_id will contain the error message
+		if(!is_numeric($suite_id))
+			die($suite_id);
+		
+		// Now get the real log
+		$log = "";
+		
+		do
+		{
+			$line = fgets($fp);
+			
+			// If this test misses the summary line for some reason, check whether we reached the next test already.
+			// If so, already break the loop here, so that this line won't be on the log for this test.
+			if(substr($line, 0, 27) == "Running Wine Test, Module: ")
+				break;
+			
+			$log .= $line;
+		}
+		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)
+		{
+			$test_id = $t->getTestId($revision, "reactos." . $_GET["platform"], "Build " . $_GET["build"]);
+			
+			// If an error occured, $test_id will contain the error message
+			if(!is_numeric($test_id))
+				die($test_id);
+		}
+		
+		// Finally submit the log
+		$return = $t->submit($test_id, $suite_id, $log);
+		
+		// If an error occured, $return will contain the error message
+		if($return != "OK")
+			die($return);
+	}
+	
+	// If we have a Test ID, finish this test run and terminate with the return message from that function
+	// Otherwise we couldn't find any test information in this log
+	if($test_id)
+		die($t->finish($test_id));
+	else
+		die("Found no test information in this log!");
+?>

Propchange: trunk/web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/web/reactos.org/htdocs/testman/webservice/index.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/webservice/index.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/webservice/index.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/webservice/index.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -7,27 +7,11 @@
 */
 
 	require_once("../config.inc.php");
+	require_once("utils.inc.php");
 	
-	// All classes are autoloaded through this magic function
-	function __autoload($class)
-	{
-		require_once("lib/$class.class.php");
-	}
-	
-	// What one of these classes has to look like
-	interface Test
-	{
-		public function GetTestID();
-		public function Submit();
-		public function Finish();
-	}
-	
-	
-	// Entry point
 	if(!isset($_POST["username"]) || !isset($_POST["password"]) || !isset($_POST["testtype"]))
 		die("Necessary information not specified!");
 
-	// Check the login credentials
 	try
 	{
 		$dbh = new PDO("mysql:host=" . DB_HOST, DB_USER, DB_PASS);
@@ -37,23 +21,8 @@
 		// Give no exact error message here, so no server internals are exposed
 		die("Could not establish the DB connection");
 	}
-		
-	$stmt = $dbh->prepare("SELECT user_id FROM " . DB_ROSCMS . ".users WHERE user_name = :username AND user_roscms_password = MD5(:password) AND user_account_enabled = 'yes'");
-	$stmt->bindParam(":username", $_POST["username"]);
-	$stmt->bindParam(":password", $_POST["password"]);
-	$stmt->execute() or die("SQL failed #1");
-	$user_id = (int)$stmt->fetchColumn();
 	
-	if(!$user_id)
-		die("Invalid Login credentials!");
-	
-	// Check if the user is permitted to submit test results
-	$stmt = $dbh->prepare("SELECT COUNT(*) FROM " . DB_TESTMAN . ".permitted_users WHERE user_id = :userid");
-	$stmt->bindParam(":userid", $user_id);
-	$stmt->execute() or die("SQL failed #2");
-	
-	if(!$stmt->fetchColumn())
-		die("User is not permitted to submit test results");
+	$user_id = VerifyLogin($_POST["username"], $_POST["password"]);
 	
 	switch($_POST["testtype"])
 	{
@@ -68,10 +37,10 @@
 	// What shall we do?
 	switch($_POST["action"])
 	{
-		case "gettestid":  die($t->GetTestID());
-		case "getsuiteid": die($t->GetSuiteID());
-		case "submit":     die($t->Submit());
-		case "finish":     die($t->Finish());
+		case "gettestid":  die($t->getTestId($_POST["revision"], $_POST["platform"], $_POST["comment"]));
+		case "getsuiteid": die($t->getSuiteId($_POST["module"], $_POST["test"]));
+		case "submit":     die($t->submit($_POST["testid"], $_POST["suiteid"], $_POST["log"]));
+		case "finish":     die($t->finish($_POST["testid"]));
 		
 		default:
 			die("Invalid action");

Modified: trunk/web/reactos.org/htdocs/testman/webservice/lib/WineTest.class.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/webservice/lib/WineTest.class.php?rev=39743&r1=39742&r2=39743&view=diff
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/webservice/lib/WineTest.class.php [iso-8859-1] (original)
+++ trunk/web/reactos.org/htdocs/testman/webservice/lib/WineTest.class.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -8,35 +8,36 @@
 
 	class WineTest implements Test
 	{
-		public function GetTestID()
+		public function getTestId($revision, $platform, $comment)
 		{
 			global $dbh;
 			global $user_id;
 			
-			if(!isset($_POST["revision"]) || !isset($_POST["platform"]))
+			if(!isset($revision) || !isset($platform))
 				return "Necessary sub-information not specified!";
 			
 			// Add a new Test ID with the given information
-			$stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_runs (user_id, revision, platform) VALUES (:userid, :revision, :platform)");
+			$stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_runs (user_id, revision, platform, comment) VALUES (:userid, :revision, :platform, :comment)");
 			$stmt->bindParam(":userid", $user_id);
-			$stmt->bindParam(":revision", $_POST["revision"]);
-			$stmt->bindParam(":platform", $_POST["platform"]);
+			$stmt->bindParam(":revision", $revision);
+			$stmt->bindParam(":platform", $platform);
+			$stmt->bindParam(":comment", $comment);
 			$stmt->execute() or die("GetTestID(): SQL failed #1");
 			
 			return $dbh->lastInsertId();
 		}
 		
-		public function GetSuiteID()
+		public function getSuiteId($module, $test)
 		{
 			global $dbh;
 			
-			if(!isset($_POST["module"]) || !isset($_POST["test"]))
+			if(!isset($module) || !isset($test))
 				return "Necessary sub-information not specified!";
 			
 			// Determine whether we already have a suite ID for this combination
 			$stmt = $dbh->prepare("SELECT id FROM " . DB_TESTMAN . ".winetest_suites WHERE module = :module AND test = :test");
-			$stmt->bindParam(":module", $_POST["module"]);
-			$stmt->bindParam(":test", $_POST["test"]);
+			$stmt->bindParam(":module", $module);
+			$stmt->bindParam(":test", $test);
 			$stmt->execute() or die("GetSuiteID(): SQL failed #1");
 			$id = $stmt->fetchColumn();
 			
@@ -45,41 +46,48 @@
 			
 			// Add this combination to the table and return the ID for it
 			$stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_suites (module, test) VALUES (:module, :test)");
-			$stmt->bindParam(":module", $_POST["module"]);
-			$stmt->bindParam(":test", $_POST["test"]);
+			$stmt->bindParam(":module", $module);
+			$stmt->bindParam(":test", $test);
 			$stmt->execute() or die("GetSuiteID(): SQL failed #2");
 			
 			return $dbh->lastInsertId();
 		}
 		
-		public function Submit()
+		public function submit($test_id, $suite_id, $log)
 		{
 			global $dbh;
 			global $user_id;
 			
-			if(!isset($_POST["testid"]) || !isset($_POST["suiteid"]) || !isset($_POST["log"]))
+			if(!isset($test_id) || !isset($suite_id) || !isset($log))
 				return "Necessary sub-information not specified!";
 			
 			// Make sure we may add information to the test with this Test ID
 			$stmt = $dbh->prepare("SELECT COUNT(*) FROM " . DB_TESTMAN . ".winetest_runs WHERE id = :testid AND finished = 0 AND user_id = :userid");
-			$stmt->bindParam(":testid", $_POST["testid"]);
+			$stmt->bindParam(":testid", $test_id);
 			$stmt->bindParam(":userid", $user_id);
 			$stmt->execute() or die("Submit(): SQL failed #1");
 			
 			if(!$stmt->fetchColumn())
 				return "No such test or no permissions!";
 			
-			// Validate and parse the log
-			$line = strrchr($_POST["log"], ":");
+			// Parse the log
+			$line = strrchr($log, ":");
 			
-			if(sscanf($line, ": %u tests executed (%u marked as todo, %u %s%u skipped.", $count, $todo, $failures, $ignore, $skipped) != 5)
-				return "Log is invalid!";
+			if(!$line || sscanf($line, ": %u tests executed (%u marked as todo, %u %s%u skipped.", $count, $todo, $failures, $ignore, $skipped) != 5)
+			{
+				// 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;
+				$todo = 0;
+				$failures = 0;
+				$skipped = 0;
+			}
 			
 			// Add the information into the DB
 			$stmt = $dbh->prepare("INSERT INTO " . DB_TESTMAN . ".winetest_results (test_id, suite_id, log, count, todo, failures, skipped) VALUES (:testid, :suiteid, :log, :count, :todo, :failures, :skipped)");
-			$stmt->bindValue(":testid", (int)$_POST["testid"]);
-			$stmt->bindValue(":suiteid", (int)$_POST["suiteid"]);
-			$stmt->bindParam(":log", $_POST["log"]);
+			$stmt->bindValue(":testid", (int)$test_id);
+			$stmt->bindValue(":suiteid", (int)$suite_id);
+			$stmt->bindParam(":log", $log);
 			$stmt->bindParam(":count", $count);
 			$stmt->bindParam(":todo", $todo);
 			$stmt->bindParam(":failures", $failures);
@@ -89,18 +97,18 @@
 			return "OK";
 		}
 		
-		public function Finish()
+		public function finish($test_id)
 		{
 			global $dbh;
 			global $user_id;
 			
-			if(!isset($_POST["testid"]))
+			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");
 			$stmt->bindParam(":userid", $user_id);
-			$stmt->bindParam(":testid", $_POST["testid"]);
+			$stmt->bindParam(":testid", $test_id);
 			$stmt->execute() or die("Finish(): SQL failed #1");
 			
 			if(!$stmt->rowCount())

Added: trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php
URL: http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php?rev=39743&view=auto
==============================================================================
--- trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php (added)
+++ trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php [iso-8859-1] Wed Feb 25 01:24:06 2009
@@ -1,0 +1,48 @@
+<?php
+/*
+  PROJECT:    ReactOS Web Test Manager
+  LICENSE:    GNU GPLv2 or any later version as published by the Free Software Foundation
+  PURPOSE:    Miscellaneous utility functions for the Web Service
+  COPYRIGHT:  Copyright 2009 Colin Finck <colin at reactos.org>
+*/
+	
+	// What one of these classes has to look like
+	interface Test
+	{
+		public function getTestId($revision, $platform, $comment);
+		public function getSuiteId($module, $test);
+		public function submit($test_id, $suite_id, $log);
+		public function finish($test_id);
+	}
+	
+	// All classes are autoloaded through this magic function
+	function __autoload($class)
+	{
+		require_once("lib/$class.class.php");
+	}
+	
+	function VerifyLogin($username, $password)
+	{
+		global $dbh;
+		
+		// Check the login credentials
+		$stmt = $dbh->prepare("SELECT user_id FROM " . DB_ROSCMS . ".users WHERE user_name = :username AND user_roscms_password = MD5(:password) AND user_account_enabled = 'yes'");
+		$stmt->bindParam(":username", $username);
+		$stmt->bindParam(":password", $password);
+		$stmt->execute() or die("SQL failed #1");
+		$user_id = (int)$stmt->fetchColumn();
+		
+		if(!$user_id)
+			die("Invalid Login credentials!");
+		
+		// Check if the user is permitted to submit test results
+		$stmt = $dbh->prepare("SELECT COUNT(*) FROM " . DB_TESTMAN . ".permitted_users WHERE user_id = :userid");
+		$stmt->bindParam(":userid", $user_id);
+		$stmt->execute() or die("SQL failed #2");
+		
+		if(!$stmt->fetchColumn())
+			die("User is not permitted to submit test results");
+		
+		return $user_id;
+	}
+?>

Propchange: trunk/web/reactos.org/htdocs/testman/webservice/utils.inc.php
------------------------------------------------------------------------------
    svn:eol-style = native



More information about the Ros-diffs mailing list