[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 14:05:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3efa6259f455f704b92af7eeeaf9a81561fbd33c
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 4 06:22:13 2010 +0000

    2010-10-03  Simon Fraser  <simon.fraser at apple.com>
    
            Make sure to enter all tests when creating the database
            for the first time.
    
            When migrating to a new version of the suite, be sure to
            sync up the database and testinfo.data by removing old
            tests, and inserting new ones.
    
            * CSSTestSuiteHarness/harness/harness.js:
            (TestSuite.prototype.openDatabase.creation):
            (TestSuite.prototype.databaseCreated):
            (TestSuite.prototype.populateDatabaseFromTestInfoData):
            (TestSuite.prototype.insertTest):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69001 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/CSSTestSuiteHarness/harness/harness.js b/WebKitTools/CSSTestSuiteHarness/harness/harness.js
index aa5176d..845d6ec 100644
--- a/WebKitTools/CSSTestSuiteHarness/harness/harness.js
+++ b/WebKitTools/CSSTestSuiteHarness/harness/harness.js
@@ -1456,11 +1456,10 @@ TestSuite.prototype.openDatabase = function()
   var _self = this;
   this.db = window.openDatabase('css21testsuite', '', 'CSS 2.1 test suite results', 10 * 1024 * 1024);
 
-  // Migration handling. we assume migration will happen whenever the suite version changes,
+  // Migration handling. We assume migration will happen whenever the suite version changes,
   // so that we can check for new or obsoleted tests.
   function creation(tx) {
-    window.console.log('creating table');
-    tx.executeSql('CREATE TABLE tests (test PRIMARY KEY UNIQUE, ref, title, flags, links, assertion, hstatus, hcomment, xstatus, xcomment)', null, null, errorHandler);
+    _self.databaseCreated(tx);
   }
 
   function migration1_0To1_1(tx) {
@@ -1492,19 +1491,18 @@ TestSuite.prototype.openDatabase = function()
   this.databaseReady();
 }
 
-TestSuite.prototype.databaseCreated = function(db)
+TestSuite.prototype.databaseCreated = function(tx)
 {
+  window.console.log('databaseCreated');
   this.populatingDatabase = true;
 
+  // hstatus: HTML4 result
+  // xstatus: XHTML1 result
   var _self = this;
-  this.db.transaction(function (tx) {
-    // hstatus: HTML4 result
-    // xstatus: XHTML1 result
-    tx.executeSql('CREATE TABLE tests (test PRIMARY KEY UNIQUE, ref, title, flags, links, assertion, hstatus, hcomment, xstatus, xcomment)', null,
-      function(tx, results) {
-        _self.populateDatabaseFromTestInfoData();
-      }, errorHandler);
-  });
+  tx.executeSql('CREATE TABLE tests (test PRIMARY KEY UNIQUE, ref, title, flags, links, assertion, hstatus, hcomment, xstatus, xcomment)', null,
+    function(tx, results) {
+      _self.populateDatabaseFromTestInfoData();
+    }, errorHandler);
 }
 
 TestSuite.prototype.databaseReady = function()
@@ -1574,39 +1572,74 @@ TestSuite.prototype.populateDatabaseFromTestInfoData = function()
     return;
   }
   
+  window.console.log('populateDatabaseFromTestInfoData')
   var _self = this;
   this.db.transaction(function (tx) {
     for (var testID in _self.tests) {
-      var currTest = _self.tests[testID];
-      tx.executeSql('INSERT INTO tests (test, ref, title, flags, links, assertion) VALUES (?, ?, ?, ?, ?, ?)', [currTest.id, currTest.reference, currTest.title, currTest.flags, currTest.links, currTest.assertion], null, errorHandler);
+      var test = _self.tests[testID];
+      // Version 1.0, so no 'seen' column.
+      tx.executeSql('INSERT INTO tests (test, ref, title, flags, links, assertion) VALUES (?, ?, ?, ?, ?, ?)',
+        [test.id, test.reference, test.title, test.flags, test.links, test.assertion], null, errorHandler);
     }
-
     _self.populatingDatabase = false;
   });
 
 }
 
+TestSuite.prototype.insertTest = function(tx, test)
+{
+  tx.executeSql('INSERT INTO tests (test, ref, title, flags, links, assertion, seen) VALUES (?, ?, ?, ?, ?, ?, ?)',
+    [test.id, test.reference, test.title, test.flags, test.links, test.assertion, 'TRUE'], null, errorHandler);
+}
+
 // Deal with removed/renamed tests in a new version of the suite.
 // self.tests is canonical; the database may contain stale entries.
 TestSuite.prototype.syncDatabaseWithTestInfoData = function()
 {
   if (!this.testInfoLoaded) {
-    window.console.log('Tring to sync database before testinfo.data has been loaded');
+    window.console.log('Trying to sync database before testinfo.data has been loaded');
     return;
   }
+
+  // Make an object with all tests that we'll use to track new tests.
+  var testsToInsert = {};
+  for (var testId in this.tests) {
+    var currTest = this.tests[testId];
+    testsToInsert[currTest.id] = currTest;
+  }
   
   var _self = this;
   this.db.transaction(function (tx) {
+    // Find tests that are not in the database yet.
+    // (Wasn't able to get INSERT ... IF NOT working.)
+    tx.executeSql('SELECT * FROM tests', [], function(tx, results) {
+      var len = results.rows.length;
+      for (var i = 0; i < len; ++i) {
+        var item = results.rows.item(i);
+        delete testsToInsert[item.test];
+      }
+    }, errorHandler);
+  });
+
+  this.db.transaction(function (tx) {
+    for (var testId in testsToInsert) {
+      var currTest = testsToInsert[testId];
+      window.console.log(currTest.id + ' is new; inserting');
+      _self.insertTest(tx, currTest);
+    }
+  });
+    
+  this.db.transaction(function (tx) {
     for (var testID in _self.tests)
       tx.executeSql('UPDATE tests SET seen=\"TRUE\" WHERE test=?\n', [testID], null, errorHandler);
 
-      tx.executeSql('SELECT * FROM tests WHERE seen=\"FALSE\"', [], function(tx, results) {
-        var len = results.rows.length;
-        for (var i = 0; i < len; ++i) {
-          var item = results.rows.item(i);
-          window.console.log('Test ' + item.test + ' was in the database but is no longer in the suite; deleting.');
-        }
-      }, errorHandler);
+    tx.executeSql('SELECT * FROM tests WHERE seen=\"FALSE\"', [], function(tx, results) {
+      var len = results.rows.length;
+      for (var i = 0; i < len; ++i) {
+        var item = results.rows.item(i);
+        window.console.log('Test ' + item.test + ' was in the database but is no longer in the suite; deleting.');
+      }
+    }, errorHandler);
 
     // Delete rows for disappeared tests.
     tx.executeSql('DELETE FROM tests WHERE seen=\"FALSE\"', [], function(tx, results) {
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2ca1b91..cce8962 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,20 @@
 2010-10-03  Simon Fraser  <simon.fraser at apple.com>
 
+        Make sure to enter all tests when creating the database
+        for the first time.
+        
+        When migrating to a new version of the suite, be sure to
+        sync up the database and testinfo.data by removing old
+        tests, and inserting new ones.
+
+        * CSSTestSuiteHarness/harness/harness.js:
+        (TestSuite.prototype.openDatabase.creation):
+        (TestSuite.prototype.databaseCreated):
+        (TestSuite.prototype.populateDatabaseFromTestInfoData):
+        (TestSuite.prototype.insertTest):
+
+2010-10-03  Simon Fraser  <simon.fraser at apple.com>
+
         More work on treating HTML4 and XHTML1 independently; when 
         changing the format, rebuild the test list, and update the 
         numbers in the chapter popup.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list