Title: [101299] trunk/Tools
Revision
101299
Author
[email protected]
Date
2011-11-28 16:13:10 -0800 (Mon, 28 Nov 2011)

Log Message

Some of the results.json files have results/times entries at the directory level
https://bugs.webkit.org/show_bug.cgi?id=73261

Reviewed by Tony Chang.

This is just a bug that got introduced in a temporary push of the results server.
This patch repairs the broken files. After all the bots have cycled, we can simplify
this code to just assert that results/times are not at the directory level.

Also, when catching exceptions, log the full stacktrace.

* TestResultServer/model/jsonresults.py:
(_is_directory):
(JsonResults._load_json):
(JsonResults._merge_tests):
(JsonResults.merge):
* TestResultServer/model/jsonresults_unittest.py:
(JsonResultsTest.test_merge_directory_hierarchy_extra_results_and_times):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (101298 => 101299)


--- trunk/Tools/ChangeLog	2011-11-28 23:51:51 UTC (rev 101298)
+++ trunk/Tools/ChangeLog	2011-11-29 00:13:10 UTC (rev 101299)
@@ -1,3 +1,24 @@
+2011-11-28  Ojan Vafai  <[email protected]>
+
+        Some of the results.json files have results/times entries at the directory level
+        https://bugs.webkit.org/show_bug.cgi?id=73261
+
+        Reviewed by Tony Chang.
+
+        This is just a bug that got introduced in a temporary push of the results server.
+        This patch repairs the broken files. After all the bots have cycled, we can simplify
+        this code to just assert that results/times are not at the directory level.
+
+        Also, when catching exceptions, log the full stacktrace.
+
+        * TestResultServer/model/jsonresults.py:
+        (_is_directory):
+        (JsonResults._load_json):
+        (JsonResults._merge_tests):
+        (JsonResults.merge):
+        * TestResultServer/model/jsonresults_unittest.py:
+        (JsonResultsTest.test_merge_directory_hierarchy_extra_results_and_times):
+
 2011-11-28  Tony Chang  <[email protected]>
 
         ews bots should pass --force to update-webkit-chromium

Modified: trunk/Tools/TestResultServer/model/jsonresults.py (101298 => 101299)


--- trunk/Tools/TestResultServer/model/jsonresults.py	2011-11-28 23:51:51 UTC (rev 101298)
+++ trunk/Tools/TestResultServer/model/jsonresults.py	2011-11-29 00:13:10 UTC (rev 101299)
@@ -29,6 +29,8 @@
 from datetime import datetime
 from django.utils import simplejson
 import logging
+import sys
+import traceback
 
 from model.testfile import TestFile
 
@@ -79,6 +81,22 @@
     return trie
 
 
+def _is_directory(subtree):
+    # FIXME: Some data got corrupted and has results/times at the directory level.
+    # Once the data is fixed, this should assert that the directory level does not have
+    # results or times and just return "JSON_RESULTS_RESULTS not in subtree".
+    if JSON_RESULTS_RESULTS not in subtree:
+        return True
+
+    for key in subtree:
+        if key not in (JSON_RESULTS_RESULTS, JSON_RESULTS_TIMES):
+            del subtree[JSON_RESULTS_RESULTS]
+            del subtree[JSON_RESULTS_TIMES]
+            return True
+
+    return False
+
+
 class JsonResults(object):
     @classmethod
     def _strip_prefix_suffix(cls, data):
@@ -100,9 +118,9 @@
 
         try:
             return simplejson.loads(json_results_str)
-        except Exception, err:
+        except:
             logging.debug(json_results_str)
-            logging.error("Failed to load json results: %s", str(err))
+            logging.error("Failed to load json results: %s", traceback.print_exception(*sys.exc_info()))
             return None
 
     @classmethod
@@ -142,6 +160,14 @@
 
     @classmethod
     def _merge_tests(cls, aggregated_json, incremental_json, num_runs):
+        # FIXME: Some data got corrupted and has results/times at the directory level.
+        # Once the data is fixe, this should assert that the directory level does not have
+        # results or times and just return "JSON_RESULTS_RESULTS not in subtree".
+        if JSON_RESULTS_RESULTS in aggregated_json:
+            del aggregated_json[JSON_RESULTS_RESULTS]
+        if JSON_RESULTS_TIMES in aggregated_json:
+            del aggregated_json[JSON_RESULTS_TIMES]
+
         all_tests = set(aggregated_json.iterkeys())
         if incremental_json:
             all_tests |= set(incremental_json.iterkeys())
@@ -152,7 +178,7 @@
                 continue
 
             incremental_sub_result = incremental_json[test_name] if incremental_json and test_name in incremental_json else None
-            if JSON_RESULTS_RESULTS not in aggregated_json[test_name]:
+            if _is_directory(aggregated_json[test_name]):
                 cls._merge_tests(aggregated_json[test_name], incremental_sub_result, num_runs)
                 continue
 
@@ -275,8 +301,8 @@
         logging.info("Merging json results...")
         try:
             cls._merge_json(aggregated_json[builder], incremental_json[builder], num_runs)
-        except Exception, err:
-            logging.error("Failed to merge json results: %s", str(err))
+        except:
+            logging.error("Failed to merge json results: %s", traceback.print_exception(*sys.exc_info()))
             return None
 
         aggregated_json[JSON_RESULTS_VERSION_KEY] = JSON_RESULTS_HIERARCHICAL_VERSION

Modified: trunk/Tools/TestResultServer/model/jsonresults_unittest.py (101298 => 101299)


--- trunk/Tools/TestResultServer/model/jsonresults_unittest.py	2011-11-28 23:51:51 UTC (rev 101298)
+++ trunk/Tools/TestResultServer/model/jsonresults_unittest.py	2011-11-29 00:13:10 UTC (rev 101299)
@@ -574,6 +574,32 @@
                                "times": [[101,0]]}}},
              "version": 4})
 
+    # FIXME: Some data got corrupted and has results and times at the directory level.
+    # Once we've purged this from all the data, we should throw an error on this case.
+    def test_merge_directory_hierarchy_extra_results_and_times(self):
+        self._test_merge(
+            # Aggregated results
+            {"builds": ["2", "1"],
+             "tests": {"baz": {
+                            "003.html": {
+                                "results": [[25,"F"]],
+                                "times": [[25,0]]}},
+                        "results": [[25,"F"]],
+                        "times": [[25,0]]}},
+             # Incremental results
+             {"builds": ["3"],
+             "tests": {"baz": {
+                            "003.html": {
+                                "results": [[1,"F"]],
+                                "times": [[1,0]]}}}},
+             # Expected results
+             {"builds": ["3", "2", "1"],
+             "tests": {"baz": {
+                            "003.html": {
+                                "results": [[26,"F"]],
+                                "times": [[26,0]]}}},
+              "version": 4})
+
     def test_merge_build_directory_hierarchy(self):
         self._test_merge(
             # Aggregated results
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to