| Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
|
| index 64f128706704a0c2ac1239da1bc064f5c934311a..5d3da065714bf0e57e4777caf562d9b36c21b4f9 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
|
| @@ -109,150 +109,120 @@ class TestCopyExistingBaselinesInternal(BaseTestCase):
|
| def setUp(self):
|
| super(TestCopyExistingBaselinesInternal, self).setUp()
|
|
|
| - def test_copying_overwritten_baseline(self):
|
| - self.tool.executive = MockExecutive2()
|
| + def options(self, **kwargs):
|
| + options_dict = {
|
| + 'results_directory': None,
|
| + 'suffixes': 'txt',
|
| + 'verbose': False,
|
| + }
|
| + options_dict.update(kwargs)
|
| + return optparse.Values(options_dict)
|
|
|
| - port = self.tool.port_factory.get('test-mac-mac10.10')
|
| + def test_copy_baseline_mac(self):
|
| + port = self.tool.port_factory.get('test-mac-mac10.11')
|
| self._write(
|
| port.host.filesystem.join(
|
| port.layout_tests_dir(),
|
| - 'platform/test-mac-mac10.10/failures/expected/image-expected.txt'),
|
| + 'platform/test-mac-mac10.11/failures/expected/image-expected.txt'),
|
| 'original mac10.11 result')
|
| + self.assertFalse(self.tool.filesystem.exists(
|
| + self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-mac-mac10.10/failures/expected/image-expected.txt')))
|
|
|
| - oc = OutputCapture()
|
| - try:
|
| - options = optparse.Values({
|
| - 'builder': "MOCK Mac10.11",
|
| - 'suffixes': 'txt',
|
| - 'verbose': True,
|
| - 'test': "failures/expected/image.html",
|
| - 'results_directory': None
|
| - })
|
| - oc.capture_output()
|
| - self.command.execute(options, [], self.tool)
|
| - finally:
|
| - out, _, _ = oc.restore_output()
|
| + self.command.execute(self.options(builder='MOCK Mac10.11', test='failures/expected/image.html'), [], self.tool)
|
|
|
| - self.assertMultiLineEqual(
|
| + # The Mac 10.11 baseline is copied over to the Mac 10.10 directory,
|
| + # because Mac10.10 is the "immediate predecessor" in the fallback tree.
|
| + # That means that normally for Mac10.10 if there's no Mac10.10-specific
|
| + # baseline, then we fall back to the Mac10.11 baseline.
|
| + # The idea is, if in the next step we download new baselines for Mac10.11
|
| + # but not Mac10.10, then mac10.10 will still have the correct baseline.
|
| + self.assertEqual(
|
| + self._read(self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-mac-mac10.11/failures/expected/image-expected.txt')),
|
| + 'original mac10.11 result')
|
| + self.assertEqual(
|
| self._read(self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| 'platform/test-mac-mac10.10/failures/expected/image-expected.txt')),
|
| 'original mac10.11 result')
|
| - self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete": []}\n')
|
| -
|
| - def test_copying_overwritten_baseline_to_multiple_locations(self):
|
| - self.tool.executive = MockExecutive2()
|
|
|
| + def test_copy_baseline_win7_to_linux_trusty(self):
|
| port = self.tool.port_factory.get('test-win-win7')
|
| self._write(
|
| - port.host.filesystem.join(port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt'),
|
| + self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-win-win7/failures/expected/image-expected.txt'),
|
| 'original win7 result')
|
| + self.assertFalse(self.tool.filesystem.exists(
|
| + self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-linux-trusty/failures/expected/image-expected.txt')))
|
|
|
| - oc = OutputCapture()
|
| - try:
|
| - options = optparse.Values({
|
| - 'builder': "MOCK Win7",
|
| - 'suffixes': "txt",
|
| - 'verbose': True,
|
| - 'test': "failures/expected/image.html",
|
| - 'results_directory': None
|
| - })
|
| - oc.capture_output()
|
| - self.command.execute(options, [], self.tool)
|
| - finally:
|
| - out, _, _ = oc.restore_output()
|
| + self.command.execute(self.options(builder='MOCK Win7', test='failures/expected/image.html'), [], self.tool)
|
|
|
| - self.assertMultiLineEqual(
|
| + # The Mac Win7 baseline is copied over to the Linux Trusty directory,
|
| + # because Linux Trusty is the baseline fallback "immediate predecessor" of Win7.
|
| + self.assertEqual(
|
| + self._read(self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-win-win7/failures/expected/image-expected.txt')),
|
| + 'original win7 result')
|
| + self.assertEqual(
|
| self._read(self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| 'platform/test-linux-trusty/failures/expected/image-expected.txt')),
|
| 'original win7 result')
|
| - self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
|
| - port.layout_tests_dir(), 'platform/test-linux-precise/userscripts/another-test-expected.txt')))
|
| - self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
|
| - port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/another-test-expected.txt')))
|
| - self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete": []}\n')
|
|
|
| def test_no_copy_existing_baseline(self):
|
| - self.tool.executive = MockExecutive2()
|
| -
|
| port = self.tool.port_factory.get('test-win-win7')
|
| self._write(
|
| - port.host.filesystem.join(
|
| + self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| 'platform/test-win-win7/failures/expected/image-expected.txt'),
|
| 'original win7 result')
|
| + self._write(
|
| + self.tool.filesystem.join(
|
| + port.layout_tests_dir(),
|
| + 'platform/test-linux-trusty/failures/expected/image-expected.txt'),
|
| + 'original linux trusty result')
|
|
|
| - oc = OutputCapture()
|
| - try:
|
| - options = optparse.Values({
|
| - 'builder': "MOCK Win7",
|
| - 'suffixes': "txt",
|
| - 'verbose': True,
|
| - 'test': "failures/expected/image.html",
|
| - 'results_directory': None
|
| - })
|
| - oc.capture_output()
|
| - self.command.execute(options, [], self.tool)
|
| - finally:
|
| - out, _, _ = oc.restore_output()
|
| + self.command.execute(self.options(builder='MOCK Win7', test='failures/expected/image.html'), [], self.tool)
|
|
|
| - self.assertMultiLineEqual(
|
| + # Since a baseline existed already for Linux Trusty, the Win7 baseline is not copied over.
|
| + self.assertEqual(
|
| self._read(self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| - 'platform/test-linux-trusty/failures/expected/image-expected.txt')),
|
| + 'platform/test-win-win7/failures/expected/image-expected.txt')),
|
| 'original win7 result')
|
| - self.assertMultiLineEqual(
|
| + self.assertEqual(
|
| self._read(self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| - 'platform/test-win-win7/failures/expected/image-expected.txt')),
|
| - 'original win7 result')
|
| - self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
|
| - port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/another-test-expected.txt')))
|
| - self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete": []}\n')
|
| + 'platform/test-linux-trusty/failures/expected/image-expected.txt')),
|
| + 'original linux trusty result')
|
|
|
| def test_no_copy_skipped_test(self):
|
| - self.tool.executive = MockExecutive2()
|
| port = self.tool.port_factory.get('test-win-win7')
|
| - fs = self.tool.filesystem
|
| self._write(
|
| - fs.join(
|
| + self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| 'platform/test-win-win7/failures/expected/image-expected.txt'),
|
| 'original win7 result')
|
| - expectations_path = fs.join(port.path_to_generic_test_expectations_file())
|
| self._write(
|
| - expectations_path,
|
| + port.path_to_generic_test_expectations_file(),
|
| ("[ Win ] failures/expected/image.html [ Failure ]\n"
|
| "[ Linux ] failures/expected/image.html [ Skip ]\n"))
|
| - oc = OutputCapture()
|
| - try:
|
| - options = optparse.Values({
|
| - 'builder': "MOCK Win7",
|
| - 'suffixes': "txt", 'verbose': True,
|
| - 'test': "failures/expected/image.html",
|
| - 'results_directory': None
|
| - })
|
| - oc.capture_output()
|
| - self.command.execute(options, [], self.tool)
|
| - finally:
|
| - oc.restore_output()
|
|
|
| + self.command.execute(self.options(builder='MOCK Win7', test='failures/expected/image.html'), [], self.tool)
|
| +
|
| + # The Win7 baseline is not copied over to the Linux Trusty directory
|
| + # because the test is skipped on linux.
|
| self.assertFalse(
|
| - fs.exists(fs.join(
|
| - port.layout_tests_dir(),
|
| - 'platform/test-mac-mac10.10/failures/expected/image-expected.txt')))
|
| - self.assertFalse(
|
| - fs.exists(fs.join(
|
| + self.tool.filesystem.exists(self.tool.filesystem.join(
|
| port.layout_tests_dir(),
|
| 'platform/test-linux-trusty/failures/expected/image-expected.txt')))
|
| - self.assertFalse(
|
| - fs.exists(fs.join(
|
| - port.layout_tests_dir(),
|
| - 'platform/test-linux-precise/failures/expected/image-expected.txt')))
|
| - self.assertEqual(
|
| - self._read(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')),
|
| - 'original win7 result')
|
|
|
|
|
| class TestRebaselineTest(BaseTestCase):
|
|
|