⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 101299 in webkit


Ignore:
Timestamp:
Nov 28, 2011, 4:13:10 PM (15 years ago)
Author:
ojan@chromium.org
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):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r101285 r101299  
     12011-11-28  Ojan Vafai  <ojan@chromium.org>
     2
     3        Some of the results.json files have results/times entries at the directory level
     4        https://bugs.webkit.org/show_bug.cgi?id=73261
     5
     6        Reviewed by Tony Chang.
     7
     8        This is just a bug that got introduced in a temporary push of the results server.
     9        This patch repairs the broken files. After all the bots have cycled, we can simplify
     10        this code to just assert that results/times are not at the directory level.
     11
     12        Also, when catching exceptions, log the full stacktrace.
     13
     14        * TestResultServer/model/jsonresults.py:
     15        (_is_directory):
     16        (JsonResults._load_json):
     17        (JsonResults._merge_tests):
     18        (JsonResults.merge):
     19        * TestResultServer/model/jsonresults_unittest.py:
     20        (JsonResultsTest.test_merge_directory_hierarchy_extra_results_and_times):
     21
    1222011-11-28  Tony Chang  <tony@chromium.org>
    223
  • trunk/Tools/TestResultServer/model/jsonresults.py

    r101280 r101299  
    3030from django.utils import simplejson
    3131import logging
     32import sys
     33import traceback
    3234
    3335from model.testfile import TestFile
     
    8082
    8183
     84def _is_directory(subtree):
     85    # FIXME: Some data got corrupted and has results/times at the directory level.
     86    # Once the data is fixed, this should assert that the directory level does not have
     87    # results or times and just return "JSON_RESULTS_RESULTS not in subtree".
     88    if JSON_RESULTS_RESULTS not in subtree:
     89        return True
     90
     91    for key in subtree:
     92        if key not in (JSON_RESULTS_RESULTS, JSON_RESULTS_TIMES):
     93            del subtree[JSON_RESULTS_RESULTS]
     94            del subtree[JSON_RESULTS_TIMES]
     95            return True
     96
     97    return False
     98
     99
    82100class JsonResults(object):
    83101    @classmethod
     
    101119        try:
    102120            return simplejson.loads(json_results_str)
    103         except Exception, err:
     121        except:
    104122            logging.debug(json_results_str)
    105             logging.error("Failed to load json results: %s", str(err))
     123            logging.error("Failed to load json results: %s", traceback.print_exception(*sys.exc_info()))
    106124            return None
    107125
     
    143161    @classmethod
    144162    def _merge_tests(cls, aggregated_json, incremental_json, num_runs):
     163        # FIXME: Some data got corrupted and has results/times at the directory level.
     164        # Once the data is fixe, this should assert that the directory level does not have
     165        # results or times and just return "JSON_RESULTS_RESULTS not in subtree".
     166        if JSON_RESULTS_RESULTS in aggregated_json:
     167            del aggregated_json[JSON_RESULTS_RESULTS]
     168        if JSON_RESULTS_TIMES in aggregated_json:
     169            del aggregated_json[JSON_RESULTS_TIMES]
     170
    145171        all_tests = set(aggregated_json.iterkeys())
    146172        if incremental_json:
     
    153179
    154180            incremental_sub_result = incremental_json[test_name] if incremental_json and test_name in incremental_json else None
    155             if JSON_RESULTS_RESULTS not in aggregated_json[test_name]:
     181            if _is_directory(aggregated_json[test_name]):
    156182                cls._merge_tests(aggregated_json[test_name], incremental_sub_result, num_runs)
    157183                continue
     
    276302        try:
    277303            cls._merge_json(aggregated_json[builder], incremental_json[builder], num_runs)
    278         except Exception, err:
    279             logging.error("Failed to merge json results: %s", str(err))
     304        except:
     305            logging.error("Failed to merge json results: %s", traceback.print_exception(*sys.exc_info()))
    280306            return None
    281307
  • trunk/Tools/TestResultServer/model/jsonresults_unittest.py

    r101280 r101299  
    575575             "version": 4})
    576576
     577    # FIXME: Some data got corrupted and has results and times at the directory level.
     578    # Once we've purged this from all the data, we should throw an error on this case.
     579    def test_merge_directory_hierarchy_extra_results_and_times(self):
     580        self._test_merge(
     581            # Aggregated results
     582            {"builds": ["2", "1"],
     583             "tests": {"baz": {
     584                            "003.html": {
     585                                "results": [[25,"F"]],
     586                                "times": [[25,0]]}},
     587                        "results": [[25,"F"]],
     588                        "times": [[25,0]]}},
     589             # Incremental results
     590             {"builds": ["3"],
     591             "tests": {"baz": {
     592                            "003.html": {
     593                                "results": [[1,"F"]],
     594                                "times": [[1,0]]}}}},
     595             # Expected results
     596             {"builds": ["3", "2", "1"],
     597             "tests": {"baz": {
     598                            "003.html": {
     599                                "results": [[26,"F"]],
     600                                "times": [[26,0]]}}},
     601              "version": 4})
     602
    577603    def test_merge_build_directory_hierarchy(self):
    578604        self._test_merge(
Note: See TracChangeset for help on using the changeset viewer.