Author: cfinck
Date: Thu Apr 16 03:47:13 2009
New Revision: 373

URL: http://svn.reactos.org/svn/reactos?rev=373&view=rev
Log:
- Separate the logs into an extra table "winetest_logs" to lower the memory 
requirements for JOINs with "winetest_results" by several magnitudes
  Fixes testman's slowness on our testing web server.
- Escape the log with htmlspecialchars() in detail.php (fixes showing KDBG 
frames)

Modified:
    branches/danny-web/resources/testman/testman.sql
    branches/danny-web/www/www.reactos.org/testman/detail.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/testman.sql?rev=373&r1=372&r2=373&view=diff
==============================================================================
--- branches/danny-web/resources/testman/testman.sql [iso-8859-1] (original)
+++ branches/danny-web/resources/testman/testman.sql [iso-8859-1] Thu Apr 16 
03:47:13 2009
@@ -5,11 +5,16 @@
   PRIMARY KEY  (`user_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
 
+CREATE TABLE `winetest_logs` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `log` longtext collate latin1_general_ci NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+
 CREATE TABLE `winetest_results` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `test_id` int(10) unsigned NOT NULL,
   `suite_id` int(10) unsigned NOT NULL,
-  `log` longtext collate latin1_general_ci NOT NULL,
   `count` int(10) NOT NULL COMMENT 'Number of all executed tests',
   `todo` int(10) unsigned NOT NULL COMMENT 'Tests marked as TODO',
   `failures` int(10) unsigned NOT NULL COMMENT 'Number of failed tests',

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/testman/detail.php?rev=373&r1=372&r2=373&view=diff
==============================================================================
--- 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 
Apr 16 03:47:13 2009
@@ -52,8 +52,9 @@
        
        // 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, a.name, r.comment " .
+               "SELECT l.log, e.count, e.todo, 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 
" .
                "JOIN " . DB_TESTMAN . ".winetest_runs r ON e.test_id = r.id " .
                "JOIN " . DB_ROSCMS . ".roscms_accounts a ON r.user_id = a.id " 
.
@@ -91,7 +92,7 @@
        </tr>
        <tr class="odd" onmouseover="Row_OnMouseOver(this)" 
onmouseout="Row_OnMouseOut(this)">
                <td class="info"><?php echo $testman_langres["log"]; ?>:</td>
-               <td><pre><?php echo $row["log"]; ?></pre></td>
+               <td><pre><?php echo htmlspecialchars($row["log"]); ?></pre></td>
        </tr>
 </table><br />
 

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/testman/webservice/lib/WineTest.class.php?rev=373&r1=372&r2=373&view=diff
==============================================================================
--- 
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 Apr 16 03:47:13 2009
@@ -84,15 +84,19 @@
                        }
                        
                        // 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 = $dbh->prepare("INSERT INTO " . DB_TESTMAN . 
".winetest_results (test_id, suite_id, count, todo, failures, skipped) VALUES 
(:testid, :suiteid, :count, :todo, :failures, :skipped)");
                        $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);
                        $stmt->bindParam(":skipped", $skipped);
                        $stmt->execute() or die("Submit(): SQL failed #2");
+                       
+                       $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");
                        
                        return "OK";
                }

Reply via email to