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

victorw at chromium.org victorw at chromium.org
Wed Dec 22 12:15:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d29e85a59e79a7d06ac88b3c7f3f54fedc51abdb
Author: victorw at chromium.org <victorw at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 17 22:46:32 2010 +0000

    2010-08-17  Victor Wang  <victorw at chromium.org>
    
            Reviewed by Ojan Vafai.
    
            Add support to the test results server for downloading json that
            contains test list only.
    
            This is for json results generator to generate incremental json
            results so that it includes results not only for tests failed in
            current run, but also tests failed before.
    
            Also set the results type to "N" (no data) instead of "P" (pass)
            if test results cannot be found in incremental json file.
    
            https://bugs.webkit.org/show_bug.cgi?id=44117
    
            * TestResultServer/handlers/testfilehandler.py:
            * TestResultServer/model/jsonresults.py:
            * TestResultServer/model/jsonresults_unittest.py:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65567 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2bf4eb8..4a30149 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-17  Victor Wang  <victorw at chromium.org>
+
+        Reviewed by Ojan Vafai.
+
+        Add support to the test results server for downloading json that
+        contains test list only.
+
+        This is for json results generator to generate incremental json
+        results so that it includes results not only for tests failed in
+        current run, but also tests failed before.
+
+        Also set the results type to "N" (no data) instead of "P" (pass)
+        if test results cannot be found in incremental json file.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44117
+
+        * TestResultServer/handlers/testfilehandler.py:
+        * TestResultServer/model/jsonresults.py:
+        * TestResultServer/model/jsonresults_unittest.py:
+
 2010-08-17  Adam Roben  <aroben at apple.com>
 
         Use the right path style
diff --git a/WebKitTools/TestResultServer/handlers/testfilehandler.py b/WebKitTools/TestResultServer/handlers/testfilehandler.py
index 97953e7..4d1320f 100644
--- a/WebKitTools/TestResultServer/handlers/testfilehandler.py
+++ b/WebKitTools/TestResultServer/handlers/testfilehandler.py
@@ -43,6 +43,7 @@ PARAM_NAME = "name"
 PARAM_KEY = "key"
 PARAM_TEST_TYPE = "testtype"
 PARAM_INCREMENTAL = "incremental"
+PARAM_TEST_LIST_JSON = "testlistjson"
 
 
 class DeleteFile(webapp.RequestHandler):
@@ -109,16 +110,31 @@ class GetFile(webapp.RequestHandler):
         if not files:
             logging.info("File not found, builder: %s, test_type: %s, name: %s.",
                          builder, test_type, name)
-            return
+            return None
+
+        return files[0].data
+
+    def _get_test_list_json(self, builder, test_type):
+        """Return json file with test name list only, do not include test
+           results and other non-test-data .
 
-        self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
-        self.response.out.write(files[0].data)
+        Args:
+            builder: builder name.
+            test_type: type of test results.
+        """
+
+        json = self._get_file_content(builder, test_type, "results.json")
+        if not json:
+            return None
+
+        return JsonResults.get_test_list(builder, json)
 
     def get(self):
         builder = self.request.get(PARAM_BUILDER)
         test_type = self.request.get(PARAM_TEST_TYPE)
         name = self.request.get(PARAM_NAME)
         dir = self.request.get(PARAM_DIR)
+        test_list_json = self.request.get(PARAM_TEST_LIST_JSON)
 
         logging.debug(
             "Getting files, builder: %s, test_type: %s, name: %s.",
@@ -129,8 +145,15 @@ class GetFile(webapp.RequestHandler):
         # file content.
         if dir or not builder or not name:
             return self._get_file_list(builder, test_type, name)
+
+        if name == "results.json" and test_list_json:
+            json = self._get_test_list_json(builder, test_type)
         else:
-            return self._get_file_content(builder, test_type, name)
+            json = self._get_file_content(builder, test_type, name)
+
+        if json:
+            self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
+            self.response.out.write(json)
 
 
 class Upload(webapp.RequestHandler):
diff --git a/WebKitTools/TestResultServer/model/jsonresults.py b/WebKitTools/TestResultServer/model/jsonresults.py
index a0f25a9..e5eb7f7 100755
--- a/WebKitTools/TestResultServer/model/jsonresults.py
+++ b/WebKitTools/TestResultServer/model/jsonresults.py
@@ -221,7 +221,7 @@ class JsonResults(object):
                     results = incremental_test[JSON_RESULTS_RESULTS]
                     times = incremental_test[JSON_RESULTS_TIMES]
                 else:
-                    results = [[1, JSON_RESULTS_PASS]]
+                    results = [[1, JSON_RESULTS_NO_DATA]]
                     times = [[1, 0]]
 
                 cls._insert_item_run_length_encoded(
@@ -424,3 +424,33 @@ class JsonResults(object):
             return None
 
         return file
+
+    @classmethod
+    def get_test_list(cls, builder, json_file_data):
+        """Get list of test names from aggregated json file data.
+
+        Args:
+            json_file_data: json file data that has all test-data and
+                            non-test-data.
+
+        Returns:
+            json file with test name list only. The json format is the same
+            as the one saved in datastore, but all non-test-data and test detail
+            results are removed.
+        """
+
+        logging.debug("Loading test results json...")
+        json = cls._load_json(json_file_data)
+        if not json:
+            return None
+
+        logging.debug("Checking test results json...")
+        if not cls._check_json(builder, json):
+            return None
+
+        test_list_json = {}
+        tests = json[builder][JSON_RESULTS_TESTS]
+        test_list_json[builder] = {
+            "tests": dict.fromkeys(tests, {})}
+
+        return cls._generate_file_data(test_list_json)
diff --git a/WebKitTools/TestResultServer/model/jsonresults_unittest.py b/WebKitTools/TestResultServer/model/jsonresults_unittest.py
index 940eebb..15b659b 100755
--- a/WebKitTools/TestResultServer/model/jsonresults_unittest.py
+++ b/WebKitTools/TestResultServer/model/jsonresults_unittest.py
@@ -66,6 +66,9 @@ JSON_RESULTS_TESTS_TEMPLATE = (
 JSON_RESULTS_PREFIX = "ADD_RESULTS("
 JSON_RESULTS_SUFFIX = ");"
 
+JSON_RESULTS_TEST_LIST_TEMPLATE = (
+    '{"Webkit":{"tests":{[TESTDATA_TESTS]}}}')
+
 
 class JsonResultsTest(unittest.TestCase):
     def setUp(self):
@@ -123,6 +126,21 @@ class JsonResultsTest(unittest.TestCase):
         else:
             self.assertFalse(merged_results)
 
+    def _test_get_test_list(self, input_data, expected_data):
+        input_results = self._make_test_json(input_data)
+
+        json_tests = []
+        for test in expected_data:
+            json_tests.append("\"" + test + "\":{}")
+
+        expected_results = JSON_RESULTS_PREFIX + \
+            JSON_RESULTS_TEST_LIST_TEMPLATE.replace(
+                "[TESTDATA_TESTS]", ",".join(json_tests)) + \
+            JSON_RESULTS_SUFFIX
+
+        actual_results = JsonResults.get_test_list(self._builder, input_results)
+        self.assertEquals(actual_results, expected_results)
+
     def test(self):
         # Empty incremental results json.
         # Nothing to merge.
@@ -207,7 +225,7 @@ class JsonResultsTest(unittest.TestCase):
             # Incremental results
             (["3"], [["002.html", "[1,\"I\"]", "[1,1]"]]),
             # Expected results
-            (["3", "2", "1"], [["001.html", "[1,\"P\"],[200,\"F\"]", "[201,0]"], ["002.html", "[101,\"I\"]", "[101,1]"]]))
+            (["3", "2", "1"], [["001.html", "[1,\"N\"],[200,\"F\"]", "[201,0]"], ["002.html", "[101,\"I\"]", "[101,1]"]]))
 
         # Single test for multiple runs.
         self._test_merge(
@@ -258,23 +276,23 @@ class JsonResultsTest(unittest.TestCase):
             # Expected results
             (["3", "2", "1"], [["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
 
-        # Remove test where all run pass and max running time <= 1 seconds
+        # Remove test where all run pass and max running time < 1 seconds
         self._test_merge(
             # Aggregated results
             (["2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
             # Incremental results
-            (["3"], [["001.html", "[1,\"P\"]", "[1,1]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
+            (["3"], [["001.html", "[1,\"P\"]", "[1,0]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
             # Expected results
             (["3", "2", "1"], [["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
 
-        # Do not remove test where all run pass but max running time > 1 seconds
+        # Do not remove test where all run pass but max running time >= 1 seconds
         self._test_merge(
             # Aggregated results
             (["2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
             # Incremental results
-            (["3"], [["001.html", "[1,\"P\"]", "[1,2]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
+            (["3"], [["001.html", "[1,\"P\"]", "[1,1]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
             # Expected results
-            (["3", "2", "1"], [["001.html", "[201,\"P\"]", "[1,2],[200,0]"], ["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
+            (["3", "2", "1"], [["001.html", "[201,\"P\"]", "[1,1],[200,0]"], ["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
 
         # Remove items from test results and times that exceeds the max number
         # of builds to track.
@@ -287,5 +305,13 @@ class JsonResultsTest(unittest.TestCase):
             # Expected results
             (["3", "2", "1"], [["001.html", "[1,\"T\"],[" + max_builds + ",\"F\"]", "[1,1],[" + max_builds + ",0]"]]))
 
+        # Get test name list only. Don't include non-test-list data and
+        # of test result details.
+        self._test_get_test_list(
+            # Input results
+            (["3", "2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
+            # Expected results
+            ["001.html", "002.html"])
+
 if __name__ == '__main__':
     unittest.main()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list