Title: [87080] trunk/Tools
Revision
87080
Author
[email protected]
Date
2011-05-23 10:56:03 -0700 (Mon, 23 May 2011)

Log Message

2011-05-23  Sheriff Bot  <[email protected]>

        Unreviewed, rolling out r87078.
        http://trac.webkit.org/changeset/87078
        https://bugs.webkit.org/show_bug.cgi?id=61294

        Patch contains errors and seems likely to break a bunch of
        bots (Requested by abarth on #webkit).

        * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (87079 => 87080)


--- trunk/Tools/ChangeLog	2011-05-23 17:47:46 UTC (rev 87079)
+++ trunk/Tools/ChangeLog	2011-05-23 17:56:03 UTC (rev 87080)
@@ -1,3 +1,16 @@
+2011-05-23  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r87078.
+        http://trac.webkit.org/changeset/87078
+        https://bugs.webkit.org/show_bug.cgi?id=61294
+
+        Patch contains errors and seems likely to break a bunch of
+        bots (Requested by abarth on #webkit).
+
+        * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py:
+
 2011-05-23  Alice Boxhall  <[email protected]>
 
         Reviewed by Ojan Vafai.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py (87079 => 87080)


--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py	2011-05-23 17:47:46 UTC (rev 87079)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py	2011-05-23 17:56:03 UTC (rev 87080)
@@ -130,6 +130,30 @@
         return self._get_modifier_char(test_name)
 
     # override
+    def _convert_json_to_current_version(self, results_json):
+        archive_version = None
+        if self.VERSION_KEY in results_json:
+            archive_version = results_json[self.VERSION_KEY]
+
+        super(JSONLayoutResultsGenerator,
+              self)._convert_json_to_current_version(results_json)
+
+        # version 2->3
+        if archive_version == 2:
+            for results_for_builder in results_json.itervalues():
+                try:
+                    test_results = results_for_builder[self.TESTS]
+                except:
+                    continue
+
+            for test in test_results:
+                # Make sure all paths are relative
+                test_path = self._get_path_relative_to_layout_test_root(test)
+                if test_path != test:
+                    test_results[test_path] = test_results[test]
+                    del test_results[test]
+
+    # override
     def _insert_failure_summaries(self, results_for_builder):
         summary = self._result_summary
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py (87079 => 87080)


--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py	2011-05-23 17:47:46 UTC (rev 87079)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py	2011-05-23 17:56:03 UTC (rev 87080)
@@ -67,49 +67,6 @@
     json_string = _JSON_PREFIX + json_data + _JSON_SUFFIX
     filesystem.write_text_file(file_path, json_string)
 
-
-def convert_trie_to_flat_paths(trie, prefix=None):
-    """Flattens a trie directory structure into a flat structure.
-
-    Args:
-        trie: trie structure.
-        prefix: aleady-computed path to prepend to the eventual path, if any.
-
-    Returns:
-        The flattened directory structure.
-    """
-    result = {}
-    for name, data in trie.iteritems():
-        if prefix:
-            fullname = prefix + "/" + name
-        else:
-            fullname = name
-
-        if not isinstance(data, dict) or not len(data) or "results" in data:
-            result[fullname] = data
-        else:
-            result.update(convert_trie_to_flat_paths(data, fullname))
-
-    return result
-
-
-def add_path_to_trie(path, value, trie):
-    """Inserts a single flat path key and value into a trie structure.
-
-    Args:
-        path: the path to parse.
-        value: the data value to insert into the trie.
-        trie: the trie into which to insert the path and value.
-    """
-    if not "/" in path:
-        trie[path] = value
-        return
-
-    directory, slash, rest = path.partition("/")
-    if not directory in trie:
-        trie[directory] = {}
-    add_path_to_trie(rest, value, trie[directory])
-
 def test_timings_trie(port, individual_test_timings):
     """Breaks a filename into chunks by directory and puts the test time as a value in the lowest part, e.g.
     foo/bar/baz.html: 1ms
@@ -131,8 +88,16 @@
             # FIXME: Handle this better. Non-layout tests shouldn't be relativized.
             test = test_result.filename
 
-        add_path_to_trie(test, int(1000 * test_result.test_run_time), trie)
+        parts = test.split('/')
+        current_map = trie
+        for i, part in enumerate(parts):
+            if i == (len(parts) - 1):
+                current_map[part] = int(1000 * test_result.test_run_time)
+                break
 
+            if part not in current_map:
+                current_map[part] = {}
+            current_map = current_map[part]
     return trie
 
 # FIXME: We already have a TestResult class in test_results.py
@@ -188,7 +153,7 @@
                         TestResult.FAILS: FAIL_RESULT,
                         TestResult.FLAKY: FLAKY_RESULT}
 
-    VERSION = 4
+    VERSION = 3
     VERSION_KEY = "version"
     RESULTS = "results"
     TIMES = "times"
@@ -306,8 +271,7 @@
         # Update the all failing tests with result type and time.
         tests = results_for_builder[self.TESTS]
         all_failing_tests = self._get_failed_test_names()
-        all_failing_tests.update(convert_trie_to_flat_paths(tests))
-
+        all_failing_tests.update(tests.iterkeys())
         for test in all_failing_tests:
             self._insert_test_time_and_result(test, tests)
 
@@ -548,7 +512,6 @@
             int(time.time()),
             self.TIME)
 
-
     def _insert_test_time_and_result(self, test_name, tests):
         """ Insert a test item with its results to the given tests dictionary.
 
@@ -559,15 +522,10 @@
         result = self._get_result_char(test_name)
         time = self._get_test_timing(test_name)
 
-        thisTest = tests
-        for segment in test_name.split("/"):
-            if segment not in thisTest:
-                thisTest[segment] = {}
-            thisTest = thisTest[segment]
+        if test_name not in tests:
+            tests[test_name] = self._create_results_and_times_json()
 
-        if not len(thisTest):
-            self._populate_results_and_times_json(thisTest)
-
+        thisTest = tests[test_name]
         if self.RESULTS in thisTest:
             self._insert_item_run_length_encoded(result, thisTest[self.RESULTS])
         else:
@@ -582,32 +540,14 @@
         """If the JSON does not match the current version, converts it to the
         current version and adds in the new version number.
         """
-        if self.VERSION_KEY in results_json:
-            archive_version = results_json[self.VERSION_KEY]
-            if archive_version == self.VERSION:
-                return
-        else:
-            archive_version = 3
+        if (self.VERSION_KEY in results_json and
+            results_json[self.VERSION_KEY] == self.VERSION):
+            return
 
-        # version 3->4
-        if archive_version == 3:
-            num_results = len(results_json.values())
-            for builder, results in results_json.iteritems():
-                if not self.TESTS in results:
-                    continue
-
-                test_results = results[self.TESTS]
-                test_results_trie = {}
-                for test in test_results.iterkeys():
-                    test_path = self._get_path_relative_to_layout_test_root(test)
-                    single_test_result = test_results[test]
-                    add_path_to_trie(test_path, single_test_result, test_results_trie)
-
-                results[self.TESTS] = test_results_trie
-
         results_json[self.VERSION_KEY] = self.VERSION
 
-    def _populate_results_and_times_json(self, results_and_times):
+    def _create_results_and_times_json(self):
+        results_and_times = {}
         results_and_times[self.RESULTS] = []
         results_and_times[self.TIMES] = []
         return results_and_times

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py (87079 => 87080)


--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py	2011-05-23 17:47:46 UTC (rev 87079)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py	2011-05-23 17:56:03 UTC (rev 87080)
@@ -156,7 +156,8 @@
         if failed_count_map:
             tests = buildinfo[JRG.TESTS]
             for test_name in failed_count_map.iterkeys():
-                test = self._find_test_in_trie(test_name, tests)
+                self.assertTrue(test_name in tests)
+                test = tests[test_name]
 
                 failed = 0
                 for result in test[JRG.RESULTS]:
@@ -173,14 +174,6 @@
         if fixable_count:
             self.assertEqual(sum(buildinfo[JRG.FIXABLE_COUNT]), fixable_count)
 
-    def _find_test_in_trie(self, path, trie):
-        sub_trie = trie
-        nodes = path.split("/")
-        for node in nodes:
-            self.assertTrue(node in sub_trie)
-            sub_trie = sub_trie[node]
-        return sub_trie
-
     def test_json_generation(self):
         self._test_json_generation([], [])
         self._test_json_generation(['A1', 'B1'], [])
@@ -204,10 +197,6 @@
             ['FLAKY_B', 'DISABLED_C', 'FAILS_D'],
             ['A', 'FLAKY_E'])
 
-    def test_hierarchical_json_generation(self):
-        # FIXME(aboxhall): re-work tests to be more comprehensible and comprehensive.
-        self._test_json_generation(['foo/A'], ['foo/B', 'bar/C'])
-
     def test_test_timings_trie(self):
         test_port = test.TestPort()
         individual_test_timings = []
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to