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

kinuko at chromium.org kinuko at chromium.org
Wed Dec 22 18:27:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2e71eb4c54f19c8ebf568f647a02079081573b2b
Author: kinuko at chromium.org <kinuko at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 11 03:25:05 2010 +0000

    2010-12-10  Kinuko Yasuda  <kinuko at chromium.org>
    
            Reviewed by Eric Seidel.
    
            [Chromium] Remove old JSONResultsGenerator script that existed for backward-compatibility
            https://bugs.webkit.org/show_bug.cgi?id=50796
    
            Also updating the test code to use JSONResultsGeneratorBase and
            to improve test coverage for incremental cases.
    
            * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
            * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73833 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 30681d3..1b78636 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-12-10  Kinuko Yasuda  <kinuko at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        [Chromium] Remove old JSONResultsGenerator script that existed for backward-compatibility
+        https://bugs.webkit.org/show_bug.cgi?id=50796
+
+        Also updating the test code to use JSONResultsGeneratorBase and
+        to improve test coverage for incremental cases.
+
+        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py:
+
 2010-12-10  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
index 331e330..54d129b 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
@@ -295,13 +295,13 @@ class JSONResultsGeneratorBase(object):
         for the given test_name.
         """
         if test_name not in self._test_results_map:
-            return JSONResultsGenerator.NO_DATA_RESULT
+            return self.__class__.NO_DATA_RESULT
 
         test_result = self._test_results_map[test_name]
         if test_result.modifier in self.MODIFIER_TO_CHAR.keys():
             return self.MODIFIER_TO_CHAR[test_result.modifier]
 
-        return JSONResultsGenerator.PASS_RESULT
+        return self.__class__.PASS_RESULT
 
     def _get_result_char(self, test_name):
         """Returns a single char (e.g. SKIP_RESULT, FAIL_RESULT,
@@ -309,16 +309,16 @@ class JSONResultsGeneratorBase(object):
         for the given test_name.
         """
         if test_name not in self._test_results_map:
-            return JSONResultsGenerator.NO_DATA_RESULT
+            return self.__class__.NO_DATA_RESULT
 
         test_result = self._test_results_map[test_name]
         if test_result.modifier == TestResult.DISABLED:
-            return JSONResultsGenerator.SKIP_RESULT
+            return self.__class__.SKIP_RESULT
 
         if test_result.failed:
-            return JSONResultsGenerator.FAIL_RESULT
+            return self.__class__.FAIL_RESULT
 
-        return JSONResultsGenerator.PASS_RESULT
+        return self.__class__.PASS_RESULT
 
     # FIXME: Callers should use scm.py instead.
     # FIXME: Identify and fix the run-time errors that were observed on Windows
@@ -593,69 +593,6 @@ class JSONResultsGeneratorBase(object):
         return len(results) == 1 and results[0][1] == type
 
 
-# A wrapper class for JSONResultsGeneratorBase.
-# Note: There's a script outside the WebKit codebase calling this script.
-# FIXME: Please keep the interface until the other script is cleaned up.
-# (http://src.chromium.org/viewvc/chrome/trunk/src/webkit/tools/layout_tests/webkitpy/layout_tests/test_output_xml_to_json.py?view=markup)
+# Left here not to break anything.
 class JSONResultsGenerator(JSONResultsGeneratorBase):
-    # The flag is for backward compatibility.
-    output_json_in_init = True
-
-    def __init__(self, port, builder_name, build_name, build_number,
-        results_file_base_path, builder_base_url,
-        test_timings, failures, passed_tests, skipped_tests, all_tests,
-        test_results_server=None, test_type=None, master_name=None):
-        """Generates a JSON results file.
-
-        Args
-          builder_name: the builder name (e.g. Webkit).
-          build_name: the build name (e.g. webkit-rel).
-          build_number: the build number.
-          results_file_base_path: Absolute path to the directory containing the
-              results json file.
-          builder_base_url: the URL where we have the archived test results.
-          test_timings: Map of test name to a test_run-time.
-          failures: Map of test name to a failure type (of test_expectations).
-          passed_tests: A set containing all the passed tests.
-          skipped_tests: A set containing all the skipped tests.
-          all_tests: List of all the tests that were run.  This should not
-              include skipped tests.
-          test_results_server: server that hosts test results json.
-          test_type: the test type.
-          master_name: the name of the buildbot master.
-        """
-
-        self._test_type = test_type
-        self._results_directory = results_file_base_path
-
-        # Create a map of (name, TestResult).
-        test_results_map = dict()
-        get = test_results_map.get
-        for (test, time) in test_timings.iteritems():
-            test_results_map[test] = TestResult(test, elapsed_time=time)
-        for test in failures.iterkeys():
-            test_results_map[test] = test_result = get(test, TestResult(test))
-            test_result.failed = True
-        for test in skipped_tests:
-            test_results_map[test] = test_result = get(test, TestResult(test))
-        for test in passed_tests:
-            test_results_map[test] = test_result = get(test, TestResult(test))
-            test_result.failed = False
-        for test in all_tests:
-            if test not in test_results_map:
-                test_results_map[test] = TestResult(test)
-
-        # Generate the JSON with incremental flag enabled.
-        # (This should also output the full result for now.)
-        super(JSONResultsGenerator, self).__init__(
-            builder_name, build_name, build_number,
-            results_file_base_path, builder_base_url, test_results_map,
-            svn_repositories=port.test_repository_paths(),
-            generate_incremental_results=True,
-            test_results_server=test_results_server,
-            test_type=test_type,
-            master_name=master_name)
-
-        if self.__class__.output_json_in_init:
-            self.generate_json_output()
-            self.upload_json_files([self.INCREMENTAL_RESULTS_FILENAME])
+    pass
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
index d6275ee..dad549a 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
@@ -36,25 +36,26 @@ import tempfile
 
 from webkitpy.layout_tests.layout_package import json_results_generator
 from webkitpy.layout_tests.layout_package import test_expectations
-from webkitpy.layout_tests import port
 
 
 class JSONGeneratorTest(unittest.TestCase):
     def setUp(self):
-        json_results_generator.JSONResultsGenerator.output_json_in_init = False
         self.builder_name = 'DUMMY_BUILDER_NAME'
         self.build_name = 'DUMMY_BUILD_NAME'
         self.build_number = 'DUMMY_BUILDER_NUMBER'
+
+        # For archived results.
         self._json = None
         self._num_runs = 0
         self._tests_set = set([])
         self._test_timings = {}
-        self._failed_tests = set([])
+        self._failed_count_map = {}
 
-        self._PASS_tests = set([])
-        self._DISABLED_tests = set([])
-        self._FLAKY_tests = set([])
-        self._FAILS_tests = set([])
+        self._PASS_count = 0
+        self._DISABLED_count = 0
+        self._FLAKY_count = 0
+        self._FAILS_count = 0
+        self._fixable_count = 0
 
     def _test_json_generation(self, passed_tests_list, failed_tests_list):
         tests_set = set(passed_tests_list) | set(failed_tests_list)
@@ -67,8 +68,8 @@ class JSONGeneratorTest(unittest.TestCase):
                            if t.startswith('FAILS_')])
         PASS_tests = tests_set - (DISABLED_tests | FLAKY_tests | FAILS_tests)
 
-        passed_tests = set(passed_tests_list) - DISABLED_tests
-        failed_tests = set(failed_tests_list)
+        failed_tests = set(failed_tests_list) - DISABLED_tests
+        failed_count_map = dict([(t, 1) for t in failed_tests])
 
         test_timings = {}
         i = 0
@@ -76,30 +77,30 @@ class JSONGeneratorTest(unittest.TestCase):
             test_timings[test] = float(self._num_runs * 100 + i)
             i += 1
 
-        # For backward compatibility.
-        reason = test_expectations.TEXT
-        failed_tests_dict = dict([(name, reason) for name in failed_tests])
+        test_results_map = dict()
+        for test in tests_set:
+            test_results_map[test] = json_results_generator.TestResult(test,
+                failed=(test in failed_tests),
+                elapsed_time=test_timings[test])
 
-        port_obj = port.get(None)
-        generator = json_results_generator.JSONResultsGenerator(port_obj,
+        generator = json_results_generator.JSONResultsGeneratorBase(
             self.builder_name, self.build_name, self.build_number,
             '',
             None,   # don't fetch past json results archive
-            test_timings,
-            failed_tests_dict,
-            passed_tests,
-            (),
-            tests_set)
+            test_results_map)
+
+        failed_count_map = dict([(t, 1) for t in failed_tests])
 
         # Test incremental json results
         incremental_json = generator.get_json(incremental=True)
         self._verify_json_results(
             tests_set,
             test_timings,
-            failed_tests,
-            PASS_tests,
-            DISABLED_tests,
-            FLAKY_tests,
+            failed_count_map,
+            len(PASS_tests),
+            len(DISABLED_tests),
+            len(FLAKY_tests),
+            len(DISABLED_tests | failed_tests),
             incremental_json,
             1)
 
@@ -110,25 +111,32 @@ class JSONGeneratorTest(unittest.TestCase):
         self._num_runs += 1
         self._tests_set |= tests_set
         self._test_timings.update(test_timings)
-        self._failed_tests.update(failed_tests)
-        self._PASS_tests |= PASS_tests
-        self._DISABLED_tests |= DISABLED_tests
-        self._FLAKY_tests |= FLAKY_tests
+        self._PASS_count += len(PASS_tests)
+        self._DISABLED_count += len(DISABLED_tests)
+        self._FLAKY_count += len(FLAKY_tests)
+        self._fixable_count += len(DISABLED_tests | failed_tests)
+
+        get = self._failed_count_map.get
+        for test in failed_count_map.iterkeys():
+            self._failed_count_map[test] = get(test, 0) + 1
+
         self._verify_json_results(
             self._tests_set,
             self._test_timings,
-            self._failed_tests,
-            self._PASS_tests,
-            self._DISABLED_tests,
-            self._FLAKY_tests,
+            self._failed_count_map,
+            self._PASS_count,
+            self._DISABLED_count,
+            self._FLAKY_count,
+            self._fixable_count,
             self._json,
             self._num_runs)
 
-    def _verify_json_results(self, tests_set, test_timings, failed_tests,
-                             PASS_tests, DISABLED_tests, FLAKY_tests,
+    def _verify_json_results(self, tests_set, test_timings, failed_count_map,
+                             PASS_count, DISABLED_count, FLAKY_count,
+                             fixable_count,
                              json, num_runs):
         # Aliasing to a short name for better access to its constants.
-        JRG = json_results_generator.JSONResultsGenerator
+        JRG = json_results_generator.JSONResultsGeneratorBase
 
         self.assertTrue(JRG.VERSION_KEY in json)
         self.assertTrue(self.builder_name in json)
@@ -139,7 +147,7 @@ class JSONGeneratorTest(unittest.TestCase):
         self.assertEqual(len(buildinfo[JRG.BUILD_NUMBERS]), num_runs)
         self.assertEqual(buildinfo[JRG.BUILD_NUMBERS][0], self.build_number)
 
-        if tests_set or DISABLED_tests:
+        if tests_set or DISABLED_count:
             fixable = {}
             for fixable_items in buildinfo[JRG.FIXABLE]:
                 for (type, count) in fixable_items.iteritems():
@@ -148,34 +156,33 @@ class JSONGeneratorTest(unittest.TestCase):
                     else:
                         fixable[type] = count
 
-            if PASS_tests:
-                self.assertEqual(fixable[JRG.PASS_RESULT], len(PASS_tests))
+            if PASS_count:
+                self.assertEqual(fixable[JRG.PASS_RESULT], PASS_count)
             else:
                 self.assertTrue(JRG.PASS_RESULT not in fixable or
                                 fixable[JRG.PASS_RESULT] == 0)
-            if DISABLED_tests:
-                self.assertEqual(fixable[JRG.SKIP_RESULT], len(DISABLED_tests))
+            if DISABLED_count:
+                self.assertEqual(fixable[JRG.SKIP_RESULT], DISABLED_count)
             else:
                 self.assertTrue(JRG.SKIP_RESULT not in fixable or
                                 fixable[JRG.SKIP_RESULT] == 0)
-            if FLAKY_tests:
-                self.assertEqual(fixable[JRG.FLAKY_RESULT], len(FLAKY_tests))
+            if FLAKY_count:
+                self.assertEqual(fixable[JRG.FLAKY_RESULT], FLAKY_count)
             else:
                 self.assertTrue(JRG.FLAKY_RESULT not in fixable or
                                 fixable[JRG.FLAKY_RESULT] == 0)
 
-        if failed_tests:
+        if failed_count_map:
             tests = buildinfo[JRG.TESTS]
-            for test_name in failed_tests:
+            for test_name in failed_count_map.iterkeys():
                 self.assertTrue(test_name in tests)
                 test = tests[test_name]
 
                 failed = 0
                 for result in test[JRG.RESULTS]:
                     if result[1] == JRG.FAIL_RESULT:
-                        failed = result[0]
-
-                self.assertEqual(1, failed)
+                        failed += result[0]
+                self.assertEqual(failed_count_map[test_name], failed)
 
                 timing_count = 0
                 for timings in test[JRG.TIMES]:
@@ -183,8 +190,7 @@ class JSONGeneratorTest(unittest.TestCase):
                         timing_count = timings[0]
                 self.assertEqual(1, timing_count)
 
-        fixable_count = len(DISABLED_tests | failed_tests)
-        if DISABLED_tests or failed_tests:
+        if fixable_count:
             self.assertEqual(sum(buildinfo[JRG.FIXABLE_COUNT]), fixable_count)
 
     def test_json_generation(self):
@@ -197,9 +203,18 @@ class JSONGeneratorTest(unittest.TestCase):
         self._test_json_generation(
             ['A6', 'B6', 'FAILS_C6', 'DISABLED_E6', 'DISABLED_F6'],
             ['FAILS_D6'])
+
+        # Generate JSON with the same test sets. (Both incremental results and
+        # archived results must be updated appropriately.)
+        self._test_json_generation(
+            ['A', 'FLAKY_B', 'DISABLED_C'],
+            ['FAILS_D', 'FLAKY_E'])
+        self._test_json_generation(
+            ['A', 'DISABLED_C', 'FLAKY_E'],
+            ['FLAKY_B', 'FAILS_D'])
         self._test_json_generation(
-            ['A7', 'FLAKY_B7', 'DISABLED_C7'],
-            ['FAILS_D7', 'FLAKY_D8'])
+            ['FLAKY_B', 'DISABLED_C', 'FAILS_D'],
+            ['A', 'FLAKY_E'])
 
 if __name__ == '__main__':
     unittest.main()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list