Changeset 86252 in webkit


Ignore:
Timestamp:
May 11, 2011 12:12:20 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-11 Alice Boxhall <aboxhall@chromium.org>

Reviewed by Ojan Vafai.

Modify jsonresults_unittest.py to use a dict format for its test data, and modify jsonresults.py to flatten hierarchical directory structures in input JSON.
https://bugs.webkit.org/show_bug.cgi?id=60521

First steps towards making the results JSON all hierarchical.

  • TestResultServer/model/jsonresults.py:
  • TestResultServer/model/jsonresults_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r86246 r86252  
     12011-05-11  Alice Boxhall  <aboxhall@chromium.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Modify jsonresults_unittest.py to use a dict format for its test data, and modify jsonresults.py to flatten hierarchical directory structures in input JSON.
     6        https://bugs.webkit.org/show_bug.cgi?id=60521
     7
     8        First steps towards making the results JSON all hierarchical.
     9
     10        * TestResultServer/model/jsonresults.py:
     11        * TestResultServer/model/jsonresults_unittest.py:
     12
    1132011-05-11  Kevin Ollivier  <kevino@theolliviers.com>
    214
  • trunk/Tools/TestResultServer/model/jsonresults.py

    r75234 r86252  
    4646JSON_RESULTS_MIN_TIME = 1
    4747JSON_RESULTS_VERSION = 3
     48JSON_RESULTS_HIERARCHICAL_VERSION = 4
    4849JSON_RESULTS_MAX_BUILDS = 750
    4950JSON_RESULTS_MAX_BUILDS_SMALL = 200
     
    320321
    321322    @classmethod
     323    def _flatten_json_tests(cls, json, prefix=None):
     324        """Flattens a trie directory structure in tests into a flat structure.
     325
     326        Args:
     327            json: json tests structure.
     328            prefix: aleady-computed path to append to the eventual test name, if any.
     329
     330        Returns:
     331            The flattened json tests structure.
     332        """
     333        result = {}
     334        for name, test in json.iteritems():
     335            if prefix:
     336                fullname = prefix + "/" + name
     337            else:
     338                fullname = name
     339
     340            if "results" in test:
     341                result[fullname] = test
     342            else:
     343                result.update(cls._flatten_json_tests(test, fullname))
     344
     345        return result
     346
     347    @classmethod
    322348    def _check_json(cls, builder, json):
    323349        """Check whether the given json is valid.
     350        Converts partially-supported json to supported version json.
    324351
    325352        Args:
    326353            builder: builder name this json is for.
    327             json: json object to check.
     354            json: json object to check and convert if necessary.
    328355
    329356        Returns:
     
    333360
    334361        version = json[JSON_RESULTS_VERSION_KEY]
    335         if version > JSON_RESULTS_VERSION:
     362        if version > JSON_RESULTS_HIERARCHICAL_VERSION:
    336363            logging.error("Results JSON version '%s' is not supported.",
    337364                version)
     
    346373            logging.error("Missing build number in json results.")
    347374            return False
     375
     376        # FIXME(aboxhall): Once the dashboard can read hierarchical JSON, both
     377        # incremental and aggregated JSON can be hierarchical, with no need to
     378        # flatten here.
     379        if version == JSON_RESULTS_HIERARCHICAL_VERSION:
     380            flattened_tests = cls._flatten_json_tests(results_for_builder[JSON_RESULTS_TESTS])
     381            json[builder][JSON_RESULTS_TESTS] = flattened_tests
     382            json[JSON_RESULTS_VERSION_KEY] = JSON_RESULTS_VERSION
    348383
    349384        return True
  • trunk/Tools/TestResultServer/model/jsonresults_unittest.py

    r86063 r86252  
    3232except ImportError:
    3333    print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
     34    raise
    3435
    3536import unittest
     
    4950    '"wontfixCounts":[[TESTDATA_COUNTS]]'
    5051    '},'
    51     '"version":3'
     52    '"version":[VERSION]'
    5253    '}')
    5354
     
    6364    '"Z":[TESTDATA]}')
    6465
     66JSON_RESULTS_DIRECTORY_TEMPLATE = '"[TESTDATA_DIRECTORY]":{[TESTDATA_DATA]}'
     67
    6568JSON_RESULTS_TESTS_TEMPLATE = (
    6669    '"[TESTDATA_TEST_NAME]":{'
     
    8386            return JSON_RESULTS_PREFIX + JSON_RESULTS_SUFFIX
    8487
    85         (builds, tests) = test_data
     88        builds = test_data["builds"]
     89        tests = test_data["tests"]
    8690        if not builds or not tests:
    8791            return JSON_RESULTS_PREFIX + JSON_RESULTS_SUFFIX
     
    108112        json = json.replace("[TESTDATA_TIMES]", ",".join(times))
    109113
     114        if "version" in test_data:
     115            json = json.replace("[VERSION]", str(test_data["version"]))
     116        else:
     117            json = json.replace("[VERSION]", "3")
     118
    110119        json_tests = []
    111         for test in tests:
    112             t = JSON_RESULTS_TESTS_TEMPLATE.replace("[TESTDATA_TEST_NAME]", test[0])
    113             t = t.replace("[TESTDATA_TEST_RESULTS]", test[1])
    114             t = t.replace("[TESTDATA_TEST_TIMES]", test[2])
    115             json_tests.append(t)
     120        for (name, test) in sorted(tests.iteritems()):
     121            json_tests.append(self._parse_tests_dict(name, test))
    116122
    117123        json = json.replace("[TESTDATA_TESTS]", ",".join(json_tests))
    118124
    119125        return JSON_RESULTS_PREFIX + json + JSON_RESULTS_SUFFIX
     126
     127    def _parse_tests_dict(self, name, test):
     128        if "results" in test:
     129            test_results = JSON_RESULTS_TESTS_TEMPLATE.replace("[TESTDATA_TEST_NAME]", name)
     130            test_results = test_results.replace("[TESTDATA_TEST_RESULTS]", test["results"])
     131            test_results = test_results.replace("[TESTDATA_TEST_TIMES]", test["times"])
     132            return test_results
     133
     134        test_results = JSON_RESULTS_DIRECTORY_TEMPLATE.replace("[TESTDATA_DIRECTORY]", name)
     135        testdata = []
     136        for (child_name, child_test) in sorted(test.iteritems()):
     137            testdata.append(self._parse_tests_dict(child_name, child_test))
     138        test_results = test_results.replace("[TESTDATA_DATA]", ",".join(testdata))
     139        return test_results
    120140
    121141    def _test_merge(self, aggregated_data, incremental_data, expected_data, max_builds=jsonresults.JSON_RESULTS_MAX_BUILDS):
     
    152172        self._test_merge(
    153173            # Aggregated results
    154             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
     174            {"builds": ["2", "1"],
     175             "tests": {"001.html": {
     176                           "results": "[200,\"F\"]",
     177                           "times": "[200,0]"}}},
    155178            # Incremental results
    156179            None,
     
    163186        self._test_merge(
    164187            # Aggregated results
    165             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    166             # Incremental results
    167             ([], []),
     188            {"builds": ["2", "1"],
     189             "tests": {"001.html": {
     190                           "results": "[200,\"F\"]",
     191                           "times": "[200,0]"}}},
     192            # Incremental results
     193            {"builds": [],
     194             "tests": {}},
    168195            # Expected no merge happens.
    169196            None)
     
    176203            None,
    177204            # Incremental results
    178             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    179             # Expected results
    180             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]))
     205
     206            {"builds": ["2", "1"],
     207             "tests": {"001.html": {
     208                           "results": "[200,\"F\"]",
     209                           "times": "[200,0]"}}},
     210            # Expected result
     211            {"builds": ["2", "1"],
     212             "tests": {"001.html": {
     213                           "results": "[200,\"F\"]",
     214                           "times": "[200,0]"}}})
    181215
    182216    def test_merge_incremental_single_test_single_run_same_result(self):
     
    187221        self._test_merge(
    188222            # Aggregated results
    189             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    190             # Incremental results
    191             (["3"], [["001.html", "[1,\"F\"]", "[1,0]"]]),
    192             # Expected results
    193             (["3", "2", "1"], [["001.html", "[201,\"F\"]", "[201,0]"]]))
     223            {"builds": ["2", "1"],
     224             "tests": {"001.html": {
     225                           "results": "[200,\"F\"]",
     226                           "times": "[200,0]"}}},
     227            # Incremental results
     228            {"builds": ["3"],
     229             "tests": {"001.html": {
     230                           "results": "[1,\"F\"]",
     231                           "times": "[1,0]"}}},
     232            # Expected results
     233            {"builds": ["3", "2", "1"],
     234             "tests": {"001.html": {
     235                           "results": "[201,\"F\"]",
     236                           "times": "[201,0]"}}})
    194237
    195238    def test_merge_single_test_single_run_different_result(self):
     
    199242        self._test_merge(
    200243            # Aggregated results
    201             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    202             # Incremental results
    203             (["3"], [["001.html", "[1, \"I\"]", "[1,1]"]]),
    204             # Expected results
    205             (["3", "2", "1"], [["001.html", "[1,\"I\"],[200,\"F\"]", "[1,1],[200,0]"]]))
     244            {"builds": ["2", "1"],
     245             "tests": {"001.html": {
     246                           "results": "[200,\"F\"]",
     247                           "times": "[200,0]"}}},
     248            # Incremental results
     249            {"builds": ["3"],
     250             "tests": {"001.html": {
     251                           "results": "[1, \"I\"]",
     252                           "times": "[1,1]"}}},
     253            # Expected results
     254            {"builds": ["3", "2", "1"],
     255             "tests": {"001.html": {
     256                           "results": "[1,\"I\"],[200,\"F\"]",
     257                           "times": "[1,1],[200,0]"}}})
    206258
    207259    def test_merge_single_test_single_run_result_changed(self):
     
    210262        self._test_merge(
    211263            # Aggregated results
    212             (["2", "1"], [["001.html", "[200,\"F\"],[10,\"I\"]", "[200,0],[10,1]"]]),
    213             # Incremental results
    214             (["3"], [["001.html", "[1,\"I\"]", "[1,1]"]]),
    215             # Expected results
    216             (["3", "2", "1"], [["001.html", "[1,\"I\"],[200,\"F\"],[10,\"I\"]", "[1,1],[200,0],[10,1]"]]))
     264            {"builds": ["2", "1"],
     265             "tests": {"001.html": {
     266                           "results": "[200,\"F\"],[10,\"I\"]",
     267                           "times": "[200,0],[10,1]"}}},
     268            # Incremental results
     269            {"builds": ["3"],
     270             "tests": {"001.html": {
     271                           "results": "[1,\"I\"]",
     272                           "times": "[1,1]"}}},
     273            # Expected results
     274            {"builds": ["3", "2", "1"],
     275             "tests": {"001.html": {
     276                           "results": "[1,\"I\"],[200,\"F\"],[10,\"I\"]",
     277                           "times": "[1,1],[200,0],[10,1]"}}})
    217278
    218279    def test_merge_multiple_tests_single_run(self):
     
    220281        self._test_merge(
    221282            # Aggregated results
    222             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"], ["002.html", "[100,\"I\"]", "[100,1]"]]),
    223             # Incremental results
    224             (["3"], [["001.html", "[1,\"F\"]", "[1,0]"], ["002.html", "[1,\"I\"]", "[1,1]"]]),
    225             # Expected results
    226             (["3", "2", "1"], [["001.html", "[201,\"F\"]", "[201,0]"], ["002.html", "[101,\"I\"]", "[101,1]"]]))
     283            {"builds": ["2", "1"],
     284             "tests": {"001.html": {
     285                           "results": "[200,\"F\"]",
     286                           "times": "[200,0]"},
     287                       "002.html": {
     288                           "results": "[100,\"I\"]",
     289                           "times": "[100,1]"}}},
     290            # Incremental results
     291            {"builds": ["3"],
     292             "tests": {"001.html": {
     293                           "results": "[1,\"F\"]",
     294                           "times": "[1,0]"},
     295                       "002.html": {
     296                           "results": "[1,\"I\"]",
     297                           "times": "[1,1]"}}},
     298            # Expected results
     299            {"builds": ["3", "2", "1"],
     300             "tests": {"001.html": {
     301                           "results": "[201,\"F\"]",
     302                           "times": "[201,0]"},
     303                       "002.html": {
     304                           "results": "[101,\"I\"]",
     305                           "times": "[101,1]"}}})
    227306
    228307    def test_merge_multiple_tests_single_run_one_no_result(self):
    229308        self._test_merge(
    230309            # Aggregated results
    231             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"], ["002.html", "[100,\"I\"]", "[100,1]"]]),
    232             # Incremental results
    233             (["3"], [["002.html", "[1,\"I\"]", "[1,1]"]]),
    234             # Expected results
    235             (["3", "2", "1"], [["001.html", "[1,\"N\"],[200,\"F\"]", "[201,0]"], ["002.html", "[101,\"I\"]", "[101,1]"]]))
     310            {"builds": ["2", "1"],
     311             "tests": {"001.html": {
     312                           "results": "[200,\"F\"]",
     313                           "times": "[200,0]"},
     314                       "002.html": {
     315                           "results": "[100,\"I\"]",
     316                           "times": "[100,1]"}}},
     317            # Incremental results
     318            {"builds": ["3"],
     319             "tests": {"002.html": {
     320                           "results": "[1,\"I\"]",
     321                           "times": "[1,1]"}}},
     322            # Expected results
     323            {"builds": ["3", "2", "1"],
     324             "tests": {"001.html": {
     325                           "results": "[1,\"N\"],[200,\"F\"]",
     326                           "times": "[201,0]"},
     327                       "002.html": {
     328                           "results": "[101,\"I\"]",
     329                           "times": "[101,1]"}}})
    236330
    237331    def test_merge_single_test_multiple_runs(self):
    238332        self._test_merge(
    239333            # Aggregated results
    240             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    241             # Incremental results
    242             (["4", "3"], [["001.html", "[2, \"I\"]", "[2,2]"]]),
    243             # Expected results
    244             (["4", "3", "2", "1"], [["001.html", "[2,\"I\"],[200,\"F\"]", "[2,2],[200,0]"]]))
     334            {"builds": ["2", "1"],
     335             "tests": {"001.html": {
     336                           "results": "[200,\"F\"]",
     337                           "times": "[200,0]"}}},
     338            # Incremental results
     339            {"builds": ["4", "3"],
     340             "tests": {"001.html": {
     341                           "results": "[2, \"I\"]",
     342                           "times": "[2,2]"}}},
     343            # Expected results
     344            {"builds": ["4", "3", "2", "1"],
     345             "tests": {"001.html": {
     346                           "results": "[2,\"I\"],[200,\"F\"]",
     347                           "times": "[2,2],[200,0]"}}})
    245348
    246349    def test_merge_multiple_tests_multiple_runs(self):
    247350        self._test_merge(
    248351            # Aggregated results
    249             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"], ["002.html", "[10,\"Z\"]", "[10,0]"]]),
    250             # Incremental results
    251             (["4", "3"], [["001.html", "[2, \"I\"]", "[2,2]"], ["002.html", "[1,\"C\"]", "[1,1]"]]),
    252             # Expected results
    253             (["4", "3", "2", "1"], [["001.html", "[2,\"I\"],[200,\"F\"]", "[2,2],[200,0]"], ["002.html", "[1,\"C\"],[10,\"Z\"]", "[1,1],[10,0]"]]))
     352            {"builds": ["2", "1"],
     353             "tests": {"001.html": {
     354                           "results": "[200,\"F\"]",
     355                           "times": "[200,0]"},
     356                       "002.html": {
     357                           "results": "[10,\"Z\"]",
     358                           "times": "[10,0]"}}},
     359            # Incremental results
     360            {"builds": ["4", "3"],
     361             "tests": {"001.html": {
     362                           "results": "[2, \"I\"]",
     363                           "times": "[2,2]"},
     364                       "002.html": {
     365                           "results": "[1,\"C\"]",
     366                           "times": "[1,1]"}}},
     367            # Expected results
     368            {"builds": ["4", "3", "2", "1"],
     369             "tests": {"001.html": {
     370                           "results": "[2,\"I\"],[200,\"F\"]",
     371                           "times": "[2,2],[200,0]"},
     372                       "002.html": {
     373                           "results": "[1,\"C\"],[10,\"Z\"]",
     374                           "times": "[1,1],[10,0]"}}})
    254375
    255376    def test_merge_incremental_result_older_build(self):
     
    259380        self._test_merge(
    260381            # Aggregated results
    261             (["3", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    262             # Incremental results
    263             (["2"], [["001.html", "[1, \"F\"]", "[1,0]"]]),
     382            {"builds": ["3", "1"],
     383             "tests": {"001.html": {
     384                           "results": "[200,\"F\"]",
     385                           "times": "[200,0]"}}},
     386            # Incremental results
     387            {"builds": ["2"],
     388             "tests": {"001.html": {
     389                           "results": "[1, \"F\"]",
     390                           "times": "[1,0]"}}},
    264391            # Expected no merge happens.
    265392            None)
     
    271398        self._test_merge(
    272399            # Aggregated results
    273             (["2", "1"], [["001.html", "[200,\"F\"]", "[200,0]"]]),
    274             # Incremental results
    275             (["3", "2"], [["001.html", "[2, \"F\"]", "[2,0]"]]),
     400            {"builds": ["2", "1"],
     401             "tests": {"001.html": {
     402                           "results": "[200,\"F\"]",
     403                           "times": "[200,0]"}}},
     404            # Incremental results
     405            {"builds": ["3", "2"],
     406             "tests": {"001.html": {
     407                           "results": "[2, \"F\"]",
     408                           "times": "[2,0]"}}},
    276409            # Expected no merge happens.
    277410            None)
     
    281414        self._test_merge(
    282415            # Aggregated results
    283             (["2", "1"], [["001.html", "[200,\"N\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
    284             # Incremental results
    285             (["3"], [["001.html", "[1,\"N\"]", "[1,0]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
    286             # Expected results
    287             (["3", "2", "1"], [["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
     416            {"builds": ["2", "1"],
     417             "tests": {"001.html": {
     418                           "results": "[200,\"N\"]",
     419                           "times": "[200,0]"},
     420                       "002.html": {
     421                           "results": "[10,\"F\"]",
     422                           "times": "[10,0]"}}},
     423            # Incremental results
     424            {"builds": ["3"],
     425             "tests": {"001.html": {
     426                           "results": "[1,\"N\"]",
     427                           "times": "[1,0]"},
     428                       "002.html": {
     429                           "results": "[1,\"P\"]",
     430                           "times": "[1,0]"}}},
     431            # Expected results
     432            {"builds": ["3", "2", "1"],
     433             "tests": {"002.html": {
     434                           "results": "[1,\"P\"],[10,\"F\"]",
     435                           "times": "[11,0]"}}})
    288436
    289437    def test_merge_remove_test_with_all_pass(self):
     
    291439        self._test_merge(
    292440            # Aggregated results
    293             (["2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
    294             # Incremental results
    295             (["3"], [["001.html", "[1,\"P\"]", "[1,0]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
    296             # Expected results
    297             (["3", "2", "1"], [["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
     441            {"builds": ["2", "1"],
     442             "tests": {"001.html": {
     443                           "results": "[200,\"P\"]",
     444                           "times": "[200,0]"},
     445                       "002.html": {
     446                           "results": "[10,\"F\"]",
     447                           "times": "[10,0]"}}},
     448            # Incremental results
     449            {"builds": ["3"],
     450             "tests": {"001.html": {
     451                           "results": "[1,\"P\"]",
     452                           "times": "[1,0]"},
     453                       "002.html": {
     454                           "results": "[1,\"P\"]",
     455                           "times": "[1,0]"}}},
     456            # Expected results
     457            {"builds": ["3", "2", "1"],
     458             "tests": {"002.html": {
     459                           "results": "[1,\"P\"],[10,\"F\"]",
     460                           "times": "[11,0]"}}})
    298461
    299462    def test_merge_keep_test_with_all_pass_but_slow_time(self):
     
    301464        self._test_merge(
    302465            # Aggregated results
    303             (["2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
    304             # Incremental results
    305             (["3"], [["001.html", "[1,\"P\"]", "[1,1]"], ["002.html", "[1,\"P\"]", "[1,0]"]]),
    306             # Expected results
    307             (["3", "2", "1"], [["001.html", "[201,\"P\"]", "[1,1],[200,0]"], ["002.html", "[1,\"P\"],[10,\"F\"]", "[11,0]"]]))
     466            {"builds": ["2", "1"],
     467             "tests": {"001.html": {
     468                           "results": "[200,\"P\"]",
     469                           "times": "[200,0]"},
     470                       "002.html": {
     471                           "results": "[10,\"F\"]",
     472                           "times": "[10,0]"}}},
     473            # Incremental results
     474            {"builds": ["3"],
     475             "tests": {"001.html": {
     476                           "results": "[1,\"P\"]",
     477                           "times": "[1,1]"},
     478                       "002.html": {
     479                           "results": "[1,\"P\"]",
     480                           "times": "[1,0]"}}},
     481            # Expected results
     482            {"builds": ["3", "2", "1"],
     483             "tests": {"001.html": {
     484                           "results": "[201,\"P\"]",
     485                           "times": "[1,1],[200,0]"},
     486                       "002.html": {
     487                           "results": "[1,\"P\"],[10,\"F\"]",
     488                           "times": "[11,0]"}}})
    308489
    309490    def test_merge_prune_extra_results(self):
     
    313494        self._test_merge(
    314495            # Aggregated results
    315             (["2", "1"], [["001.html", "[" + max_builds + ",\"F\"],[1,\"I\"]", "[" + max_builds + ",0],[1,1]"]]),
    316             # Incremental results
    317             (["3"], [["001.html", "[1,\"T\"]", "[1,1]"]]),
    318             # Expected results
    319             (["3", "2", "1"], [["001.html", "[1,\"T\"],[" + max_builds + ",\"F\"]", "[1,1],[" + max_builds + ",0]"]]))
     496            {"builds": ["2", "1"],
     497             "tests": {"001.html": {
     498                           "results": "[" + max_builds + ",\"F\"],[1,\"I\"]",
     499                           "times": "[" + max_builds + ",0],[1,1]"}}},
     500            # Incremental results
     501            {"builds": ["3"],
     502             "tests": {"001.html": {
     503                           "results": "[1,\"T\"]",
     504                           "times": "[1,1]"}}},
     505            # Expected results
     506            {"builds": ["3", "2", "1"],
     507             "tests": {"001.html": {
     508                           "results": "[1,\"T\"],[" + max_builds + ",\"F\"]",
     509                           "times": "[1,1],[" + max_builds + ",0]"}}})
    320510
    321511    def test_merge_prune_extra_results_small(self):
     
    325515        self._test_merge(
    326516            # Aggregated results
    327             (["2", "1"], [["001.html", "[" + max_builds + ",\"F\"],[1,\"I\"]", "[" + max_builds + ",0],[1,1]"]]),
    328             # Incremental results
    329             (["3"], [["001.html", "[1,\"T\"]", "[1,1]"]]),
    330             # Expected results
    331             (["3", "2", "1"], [["001.html", "[1,\"T\"],[" + max_builds + ",\"F\"]", "[1,1],[" + max_builds + ",0]"]]),
     517            {"builds": ["2", "1"],
     518             "tests": {"001.html": {
     519                           "results": "[" + max_builds + ",\"F\"],[1,\"I\"]",
     520                           "times": "[" + max_builds + ",0],[1,1]"}}},
     521            # Incremental results
     522            {"builds": ["3"],
     523             "tests": {"001.html": {
     524                           "results": "[1,\"T\"]",
     525                           "times": "[1,1]"}}},
     526            # Expected results
     527            {"builds": ["3", "2", "1"],
     528             "tests": {"001.html": {
     529                           "results": "[1,\"T\"],[" + max_builds + ",\"F\"]",
     530                           "times": "[1,1],[" + max_builds + ",0]"}}},
    332531            int(max_builds))
    333532
     
    338537        self._test_merge(
    339538            # Aggregated results
    340             (["2", "1"], [["001.html", "[" + max_builds + ",\"F\"],[1,\"N\"]", "[" + max_builds + ",0],[1,1]"]]),
    341             # Incremental results
    342             (["3"], [["001.html", "[1,\"F\"]", "[1,0]"]]),
    343             # Expected results
    344             (["3", "2", "1"], [["001.html", "[" + max_builds + ",\"F\"]", "[" + max_builds + ",0]"]]),
     539            {"builds": ["2", "1"],
     540             "tests": {"001.html": {
     541                           "results": "[" + max_builds + ",\"F\"],[1,\"N\"]",
     542                           "times": "[" + max_builds + ",0],[1,1]"}}},
     543            # Incremental results
     544            {"builds": ["3"],
     545             "tests": {"001.html": {
     546                           "results": "[1,\"F\"]",
     547                           "times": "[1,0]"}}},
     548            # Expected results
     549            {"builds": ["3", "2", "1"],
     550             "tests": {"001.html": {
     551                           "results": "[" + max_builds + ",\"F\"]",
     552                           "times": "[" + max_builds + ",0]"}}},
    345553            int(max_builds))
     554
     555    def test_merge_build_directory_hierarchy(self):
     556        self._test_merge(
     557            # Aggregated results
     558            {"builds": ["2", "1"],
     559             "tests": {"foo/001.html": {
     560                           "results": "[50,\"F\"]",
     561                           "times": "[50,0]"},
     562                       "foo/002.html": {
     563                           "results": "[100,\"I\"]",
     564                           "times": "[100,0]"}}},
     565            # Incremental results
     566            {"builds": ["3"],
     567             "tests": {"foo": {
     568                           "001.html": {
     569                               "results": "[1,\"F\"]",
     570                               "times": "[1,0]"},
     571                           "002.html": {
     572                               "results": "[1,\"I\"]",
     573                               "times": "[1,0]"}}},
     574             "version": 4},
     575            # Expected results
     576            {"builds": ["3", "2", "1"],
     577             "tests": {"foo/001.html": {
     578                           "results": "[51,\"F\"]",
     579                           "times": "[51,0]"},
     580                       "foo/002.html": {
     581                           "results": "[101,\"I\"]",
     582                           "times": "[101,0]"}},
     583             "version": 3})
     584
     585    # FIXME(aboxhall): Add some tests for xhtml/svg test results.
    346586
    347587    def test_get_test_name_list(self):
     
    350590        self._test_get_test_list(
    351591            # Input results
    352             (["3", "2", "1"], [["001.html", "[200,\"P\"]", "[200,0]"], ["002.html", "[10,\"F\"]", "[10,0]"]]),
     592            {"builds": ["3", "2", "1"],
     593             "tests": {"001.html": {
     594                           "results": "[200,\"P\"]",
     595                           "times": "[200,0]"},
     596                       "002.html": {
     597                           "results": "[10,\"F\"]",
     598                           "times": "[10,0]"}}},
    353599            # Expected results
    354600            ["001.html", "002.html"])
Note: See TracChangeset for help on using the changeset viewer.