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

ojan at chromium.org ojan at chromium.org
Wed Dec 22 15:12:08 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5e4d832015d7ffe0250331c1104fd353684d0d86
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 28 23:19:58 2010 +0000

    2010-10-28  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Tony Chang.
    
            [chromium] add a result-small.json file for the test dashboard
            https://bugs.webkit.org/show_bug.cgi?id=48547
    
            Output both a results.json file and a results-small.json file.
            The dashboard will load results-small.json by default so it loads faster.
    
            * TestResultServer/model/jsonresults.py:
            * TestResultServer/model/jsonresults_unittest.py:
            Added a bunch of sys.path hackery. Unforunately, this uses hardcoded
            paths. That obviously needs to be fixed, but at least this way it
            clearly documents what paths are necessary.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70822 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 255d48b..061af7a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-28  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [chromium] add a result-small.json file for the test dashboard
+        https://bugs.webkit.org/show_bug.cgi?id=48547
+
+        Output both a results.json file and a results-small.json file.
+        The dashboard will load results-small.json by default so it loads faster.
+
+        * TestResultServer/model/jsonresults.py:
+        * TestResultServer/model/jsonresults_unittest.py:
+        Added a bunch of sys.path hackery. Unforunately, this uses hardcoded
+        paths. That obviously needs to be fixed, but at least this way it
+        clearly documents what paths are necessary.
+
 2010-10-28  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKitTools/TestResultServer/model/jsonresults.py b/WebKitTools/TestResultServer/model/jsonresults.py
index 879cf78..97b277a 100755
--- a/WebKitTools/TestResultServer/model/jsonresults.py
+++ b/WebKitTools/TestResultServer/model/jsonresults.py
@@ -33,6 +33,7 @@ import logging
 from model.testfile import TestFile
 
 JSON_RESULTS_FILE = "results.json"
+JSON_RESULTS_FILE_SMALL = "results-small.json"
 JSON_RESULTS_PREFIX = "ADD_RESULTS("
 JSON_RESULTS_SUFFIX = ");"
 JSON_RESULTS_VERSION_KEY = "version"
@@ -45,6 +46,7 @@ JSON_RESULTS_NO_DATA = "N"
 JSON_RESULTS_MIN_TIME = 1
 JSON_RESULTS_VERSION = 3
 JSON_RESULTS_MAX_BUILDS = 1500
+JSON_RESULTS_MAX_BUILDS_SMALL = 200
 
 
 class JsonResults(object):
@@ -106,7 +108,7 @@ class JsonResults(object):
             return None
 
     @classmethod
-    def _merge_json(cls, aggregated_json, incremental_json):
+    def _merge_json(cls, aggregated_json, incremental_json, num_runs):
         """Merge incremental json into aggregated json results.
 
         Args:
@@ -120,19 +122,19 @@ class JsonResults(object):
 
         # Merge non tests property data.
         # Tests properties are merged in _merge_tests.
-        if not cls._merge_non_test_data(aggregated_json, incremental_json):
+        if not cls._merge_non_test_data(aggregated_json, incremental_json, num_runs):
             return False
 
         # Merge tests results and times
         incremental_tests = incremental_json[JSON_RESULTS_TESTS]
         if incremental_tests:
             aggregated_tests = aggregated_json[JSON_RESULTS_TESTS]
-            cls._merge_tests(aggregated_tests, incremental_tests)
+            cls._merge_tests(aggregated_tests, incremental_tests, num_runs)
 
         return True
 
     @classmethod
-    def _merge_non_test_data(cls, aggregated_json, incremental_json):
+    def _merge_non_test_data(cls, aggregated_json, incremental_json, num_runs):
         """Merge incremental non tests property data into aggregated json results.
 
         Args:
@@ -173,13 +175,13 @@ class JsonResults(object):
                 return False
 
             # Merge this build into aggreagated results.
-            cls._merge_one_build(aggregated_json, incremental_json, index)
+            cls._merge_one_build(aggregated_json, incremental_json, index, num_runs)
 
         return True
 
     @classmethod
     def _merge_one_build(cls, aggregated_json, incremental_json,
-                         incremental_index):
+                         incremental_index, num_runs):
         """Merge one build of incremental json into aggregated json results.
 
         Args:
@@ -198,12 +200,12 @@ class JsonResults(object):
                 aggregated_json[key].insert(
                     0, incremental_json[key][incremental_index])
                 aggregated_json[key] = \
-                    aggregated_json[key][:JSON_RESULTS_MAX_BUILDS]
+                    aggregated_json[key][:num_runs]
             else:
                 aggregated_json[key] = incremental_json[key]
 
     @classmethod
-    def _merge_tests(cls, aggregated_json, incremental_json):
+    def _merge_tests(cls, aggregated_json, incremental_json, num_runs):
         """Merge "tests" properties:results, times.
 
         Args:
@@ -225,15 +227,15 @@ class JsonResults(object):
                     times = [[1, 0]]
 
                 cls._insert_item_run_length_encoded(
-                    results, aggregated_test[JSON_RESULTS_RESULTS])
+                    results, aggregated_test[JSON_RESULTS_RESULTS], num_runs)
                 cls._insert_item_run_length_encoded(
-                    times, aggregated_test[JSON_RESULTS_TIMES])
+                    times, aggregated_test[JSON_RESULTS_TIMES], num_runs)
                 cls._normalize_results_json(test_name, aggregated_json)
             else:
                 aggregated_json[test_name] = incremental_json[test_name]
 
     @classmethod
-    def _insert_item_run_length_encoded(cls, incremental_item, aggregated_item):
+    def _insert_item_run_length_encoded(cls, incremental_item, aggregated_item, num_runs):
         """Inserts the incremental run-length encoded results into the aggregated
            run-length encoded results.
 
@@ -245,7 +247,7 @@ class JsonResults(object):
         for item in incremental_item:
             if len(aggregated_item) and item[1] == aggregated_item[0][1]:
                 aggregated_item[0][0] = min(
-                    aggregated_item[0][0] + item[0], JSON_RESULTS_MAX_BUILDS)
+                    aggregated_item[0][0] + item[0], num_runs)
             else:
                 aggregated_item.insert(0, item)
 
@@ -340,7 +342,7 @@ class JsonResults(object):
         return True
 
     @classmethod
-    def merge(cls, builder, aggregated, incremental, sort_keys=False):
+    def merge(cls, builder, aggregated, incremental, num_runs, sort_keys=False):
         """Merge incremental json file data with aggregated json file data.
 
         Args:
@@ -378,9 +380,7 @@ class JsonResults(object):
 
         logging.info("Merging json results...")
         try:
-            if not cls._merge_json(
-                aggregated_json[builder],
-                incremental_json[builder]):
+            if not cls._merge_json(aggregated_json[builder], incremental_json[builder], num_runs):
                 return None
         except Exception, err:
             logging.error("Failed to merge json results: %s", str(err))
@@ -393,45 +393,46 @@ class JsonResults(object):
     @classmethod
     def update(cls, master, builder, test_type, incremental):
         """Update datastore json file data by merging it with incremental json
-           file.
+           file. Writes the large file and a small file. The small file just stores
+           fewer runs.
 
         Args:
+            master: master name.
             builder: builder name.
             test_type: type of test results.
             incremental: incremental json file data to merge.
 
         Returns:
-            TestFile object if update succeeds or
+            Large TestFile object if update succeeds or
             None on failure.
         """
+        small_file = cls.update_file(master, builder, test_type, incremental, JSON_RESULTS_FILE_SMALL, JSON_RESULTS_MAX_BUILDS_SMALL)
+        large_file = cls.update_file(master, builder, test_type, incremental, JSON_RESULTS_FILE, JSON_RESULTS_MAX_BUILDS)
 
-        files = TestFile.get_files(master, builder, test_type, JSON_RESULTS_FILE)
+        if small_file and large_file:
+            return large_file
+        return None
+
+    @classmethod
+    def update_file(cls, master, builder, test_type, incremental, filename, num_runs):
+        files = TestFile.get_files(master, builder, test_type, filename)
         if files:
             file = files[0]
-
-            # FIXME: This is here to fill in the missing master/test_type for the already uploaded
-            # results files, which all are layout_tests from the chromium master.
-            # Remove this once all the builders upload with the master/test_type field set.
-            if not file.master:
-                file.master = "chromium"
-            if not file.test_type:
-                file.test_type = "layout-tests"
-
-            new_results = cls.merge(builder, file.data, incremental)
+            new_results = cls.merge(builder, file.data, incremental, num_runs)
         else:
             # Use the incremental data if there is no aggregated file to merge.
-            file = TestFile()
+            file = TestFile()            
             file.master = master
             file.builder = builder
             file.test_type = test_type
-            file.name = JSON_RESULTS_FILE
+            file.name = filename
             new_results = incremental
             logging.info("No existing json results, incremental json is saved.")
 
-        if not new_results:
-            return None
-
-        if not file.save(new_results):
+        if not new_results or not file.save(new_results):
+            logging.info(
+                "Update failed, master: %s, builder: %s, test_type: %s, name: %s." %
+                (master, builder, test_type, filename))
             return None
 
         return file
diff --git a/WebKitTools/TestResultServer/model/jsonresults_unittest.py b/WebKitTools/TestResultServer/model/jsonresults_unittest.py
index 15b659b..c70b90c 100755
--- a/WebKitTools/TestResultServer/model/jsonresults_unittest.py
+++ b/WebKitTools/TestResultServer/model/jsonresults_unittest.py
@@ -26,10 +26,14 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import jsonresults
+try:
+    import jsonresults
+    from jsonresults import JsonResults
+except ImportError:
+    print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
+
 import unittest
 
-from jsonresults import JsonResults
 
 JSON_RESULTS_TEMPLATE = (
     '{"Webkit":{'
@@ -118,7 +122,8 @@ class JsonResultsTest(unittest.TestCase):
         aggregated_results = self._make_test_json(aggregated_data)
         incremental_results = self._make_test_json(incremental_data)
         merged_results = JsonResults.merge(self._builder,
-            aggregated_results, incremental_results, sort_keys=True)
+            aggregated_results, incremental_results, jsonresults.JSON_RESULTS_MAX_BUILDS,
+            sort_keys=True)
 
         if expected_data:
             expected_results = self._make_test_json(expected_data)
diff --git a/WebKitTools/TestResultServer/model/testfile.py b/WebKitTools/TestResultServer/model/testfile.py
index 9d57023..e600c99 100644
--- a/WebKitTools/TestResultServer/model/testfile.py
+++ b/WebKitTools/TestResultServer/model/testfile.py
@@ -104,15 +104,6 @@ class TestFile(DataStoreFile):
             return cls.add_file(master, builder, test_type, name, data)
 
         file = files[0]
-
-        # FIXME: This is here to fill in the missing master/test_type for the already uploaded
-        # results files, which all are layout_tests from the chromium master.
-        # Remove this once all the builders upload with the master/test_type field set.
-        if not file.master:
-            file.master = "chromium"
-        if not file.test_type:
-            file.test_type = "layout-tests"
-
         if not file.save(data):
             return None
 
diff --git a/WebKitTools/TestResultServer/templates/uploadform.html b/WebKitTools/TestResultServer/templates/uploadform.html
index 7427c85..9974a24 100644
--- a/WebKitTools/TestResultServer/templates/uploadform.html
+++ b/WebKitTools/TestResultServer/templates/uploadform.html
@@ -11,7 +11,7 @@
     <table>
     <tr>
         <td class=label><label>Master:</label></td>
-        <td><input class=inputtext type="text" name="master" placeholder="chromium"/></td>
+        <td><input class=inputtext type="text" name="master" placeholder="Chromium"/></td>
     </tr>
     <tr>
         <td class=label><label>Builder:</label></td>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list