Changeset 92669 in webkit


Ignore:
Timestamp:
Aug 9, 2011 1:38:45 AM (13 years ago)
Author:
abarth@webkit.org
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:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r92660 r92669  
     12011-08-09  Adam Barth  <abarth@webkit.org>
     2
     3        BaselineOptimizer created the wrong baseline for fast/js/regexp-overflow.html
     4        https://bugs.webkit.org/show_bug.cgi?id=65891
     5
     6        Reviewed by Eric Seidel.
     7
     8        The problem was that platform/chromium contained a bogus expectation
     9        file that needed to be removed, but by the time we got around to
     10        removing it, we'd already moved the correct baseline into its place.
     11        After this patch, we copy the gold results into memory before
     12        reshuffling things on disk (and we delete bad things before adding good
     13        things).
     14
     15        * Scripts/webkitpy/common/checkout/baselineoptimizer.py:
     16        * Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py:
     17
    1182011-08-08  Adam Barth  <abarth@webkit.org>
    219
  • trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py

    r92562 r92669  
    133133
    134134    def _move_baselines(self, baseline_name, results_by_directory, new_results_by_directory):
    135         source_directory_for_result = {}
     135        data_for_result = {}
    136136        for directory, result in results_by_directory.items():
    137             source_directory_for_result[result] = directory
    138 
    139         for directory, result in new_results_by_directory.items():
    140             if results_by_directory.get(directory) != result:
    141                 source = self._filesystem.join(self._scm.checkout_root, source_directory_for_result[result], baseline_name)
    142                 destination = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
    143                 self._filesystem.maybe_make_directory(self._filesystem.split(destination)[0])
    144                 self._filesystem.copyfile(source, destination)
    145                 self._scm.add(destination)
     137            if not result in data_for_result:
     138                source = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
     139                data_for_result[result] = self._filesystem.read_binary_file(source)
    146140
    147141        for directory, result in results_by_directory.items():
     
    149143                file_name = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
    150144                self._scm.delete(file_name)
    151                 # FIXME: Check for empty directories and remove them as well.
     145
     146        for directory, result in new_results_by_directory.items():
     147            if results_by_directory.get(directory) != result:
     148                destination = self._filesystem.join(self._scm.checkout_root, directory, baseline_name)
     149                self._filesystem.maybe_make_directory(self._filesystem.split(destination)[0])
     150                self._filesystem.write_binary_file(destination, data_for_result[result])
     151                self._scm.add(destination)
    152152
    153153    def optimize(self, baseline_name):
  • trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py

    r92562 r92669  
    5050        _, new_results_by_directory = baseline_optimizer._find_optimal_result_placement('mock-baseline.png')
    5151        self.assertEqual(new_results_by_directory, expected_new_results_by_directory)
     52
     53    def test_move_baselines(self):
     54        fs = MockFileSystem()
     55        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt', 'result A')
     56        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-mac/another/test-expected.txt', 'result A')
     57        fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt', 'result B')
     58        baseline_optimizer = BaselineOptimizer(MockSCM(), fs)
     59        baseline_optimizer._move_baselines('another/test-expected.txt', {
     60            'LayoutTests/platform/chromium-win': 'aaa',
     61            'LayoutTests/platform/chromium-mac': 'aaa',
     62            'LayoutTests/platform/chromium': 'bbb',
     63        }, {
     64            'LayoutTests/platform/chromium': 'aaa',
     65        })
     66        self.assertEqual(fs.read_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt'), 'result A')
    5267
    5368    def test_chromium_linux_redundant_with_win(self):
Note: See TracChangeset for help on using the changeset viewer.