Title: [92669] trunk/Tools
Revision
92669
Author
[email protected]
Date
2011-08-09 01:38:45 -0700 (Tue, 09 Aug 2011)

Log Message

BaselineOptimizer created the wrong baseline for fast/js/regexp-overflow.html
https://bugs.webkit.org/show_bug.cgi?id=65891

Reviewed by Eric Seidel.

The problem was that platform/chromium contained a bogus expectation
file that needed to be removed, but by the time we got around to
removing it, we'd already moved the correct baseline into its place.
After this patch, we copy the gold results into memory before
reshuffling things on disk (and we delete bad things before adding good
things).

* Scripts/webkitpy/common/checkout/baselineoptimizer.py:
* Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (92668 => 92669)


--- trunk/Tools/ChangeLog	2011-08-09 08:34:02 UTC (rev 92668)
+++ trunk/Tools/ChangeLog	2011-08-09 08:38:45 UTC (rev 92669)
@@ -1,3 +1,20 @@
+2011-08-09  Adam Barth  <[email protected]>
+
+        BaselineOptimizer created the wrong baseline for fast/js/regexp-overflow.html
+        https://bugs.webkit.org/show_bug.cgi?id=65891
+
+        Reviewed by Eric Seidel.
+
+        The problem was that platform/chromium contained a bogus expectation
+        file that needed to be removed, but by the time we got around to
+        removing it, we'd already moved the correct baseline into its place.
+        After this patch, we copy the gold results into memory before
+        reshuffling things on disk (and we delete bad things before adding good
+        things).
+
+        * Scripts/webkitpy/common/checkout/baselineoptimizer.py:
+        * Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py:
+
 2011-08-08  Adam Barth  <[email protected]>
 
         Chromium Windows bots can't figure out what SVN revision they're running

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py (92668 => 92669)


--- trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py	2011-08-09 08:34:02 UTC (rev 92668)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py	2011-08-09 08:38:45 UTC (rev 92669)
@@ -132,24 +132,24 @@
         return results_by_directory, new_results_by_directory
 
     def _move_baselines(self, baseline_name, results_by_directory, new_results_by_directory):
-        source_directory_for_result = {}
+        data_for_result = {}
         for directory, result in results_by_directory.items():
-            source_directory_for_result[result] = directory
+            if not result in data_for_result:
+                source = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
+                data_for_result[result] = self._filesystem.read_binary_file(source)
 
+        for directory, result in results_by_directory.items():
+            if new_results_by_directory.get(directory) != result:
+                file_name = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
+                self._scm.delete(file_name)
+
         for directory, result in new_results_by_directory.items():
             if results_by_directory.get(directory) != result:
-                source = self._filesystem.join(self._scm.checkout_root, source_directory_for_result[result], baseline_name)
                 destination = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
                 self._filesystem.maybe_make_directory(self._filesystem.split(destination)[0])
-                self._filesystem.copyfile(source, destination)
+                self._filesystem.write_binary_file(destination, data_for_result[result])
                 self._scm.add(destination)
 
-        for directory, result in results_by_directory.items():
-            if new_results_by_directory.get(directory) != result:
-                file_name = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
-                self._scm.delete(file_name)
-                # FIXME: Check for empty directories and remove them as well.
-
     def optimize(self, baseline_name):
         results_by_directory, new_results_by_directory = self._find_optimal_result_placement(baseline_name)
         if self._results_by_port_name(results_by_directory) != self._results_by_port_name(new_results_by_directory):

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py (92668 => 92669)


--- trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py	2011-08-09 08:34:02 UTC (rev 92668)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py	2011-08-09 08:38:45 UTC (rev 92669)
@@ -50,6 +50,21 @@
         _, new_results_by_directory = baseline_optimizer._find_optimal_result_placement('mock-baseline.png')
         self.assertEqual(new_results_by_directory, expected_new_results_by_directory)
 
+    def test_move_baselines(self):
+        fs = MockFileSystem()
+        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt', 'result A')
+        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-mac/another/test-expected.txt', 'result A')
+        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt', 'result B')
+        baseline_optimizer = BaselineOptimizer(MockSCM(), fs)
+        baseline_optimizer._move_baselines('another/test-expected.txt', {
+            'LayoutTests/platform/chromium-win': 'aaa',
+            'LayoutTests/platform/chromium-mac': 'aaa',
+            'LayoutTests/platform/chromium': 'bbb',
+        }, {
+            'LayoutTests/platform/chromium': 'aaa',
+        })
+        self.assertEqual(fs.read_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt'), 'result A')
+
     def test_chromium_linux_redundant_with_win(self):
         self._assertOptimization({
             'LayoutTests/platform/chromium-win': '462d03b9c025db1b0392d7453310dbee5f9a9e74',
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to