| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import webkitpy.tool.commands.rebaseline | 30 import webkitpy.tool.commands.rebaseline |
| 31 | 31 |
| 32 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer | 32 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer |
| 33 from webkitpy.common.checkout.scm.scm_mock import MockSCM | 33 from webkitpy.common.checkout.scm.scm_mock import MockSCM |
| 34 from webkitpy.common.host_mock import MockHost | 34 from webkitpy.common.host_mock import MockHost |
| 35 from webkitpy.common.net.buildbot.buildbot_mock import MockBuilder | 35 from webkitpy.common.net.buildbot.buildbot_mock import MockBuilder |
| 36 from webkitpy.common.net.layouttestresults import LayoutTestResults | 36 from webkitpy.common.net.layouttestresults import LayoutTestResults |
| 37 from webkitpy.common.system.executive_mock import MockExecutive | 37 from webkitpy.common.system.executive_mock import MockExecutive |
| 38 from webkitpy.common.system.executive_mock import MockExecutive2 | 38 from webkitpy.common.system.executive_mock import MockExecutive2 |
| 39 from webkitpy.common.system.outputcapture import OutputCapture | 39 from webkitpy.common.system.outputcapture import OutputCapture |
| 40 from webkitpy.layout_tests.builders import Builders |
| 40 from webkitpy.tool.commands.rebaseline import * | 41 from webkitpy.tool.commands.rebaseline import * |
| 41 from webkitpy.tool.mocktool import MockTool, MockOptions | 42 from webkitpy.tool.mocktool import MockTool, MockOptions |
| 42 | 43 |
| 43 | 44 |
| 45 class FakeBuilders(Builders): |
| 46 |
| 47 def __init__(self, builders_dict): |
| 48 super(FakeBuilders, self).__init__() |
| 49 self._exact_matches = builders_dict |
| 50 |
| 51 |
| 44 class _BaseTestCase(unittest.TestCase): | 52 class _BaseTestCase(unittest.TestCase): |
| 45 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' | 53 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' |
| 46 WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-t
est-results' | 54 WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-t
est-results' |
| 47 | 55 |
| 48 command_constructor = None | 56 command_constructor = None |
| 49 | 57 |
| 50 def setUp(self): | 58 def setUp(self): |
| 51 self.tool = MockTool() | 59 self.tool = MockTool() |
| 52 self.command = self.command_constructor() # lint warns that command_con
structor might not be set, but this is intentional; pylint: disable=E1102 | 60 self.command = self.command_constructor() # lint warns that command_con
structor might not be set, but this is intentional; pylint: disable=E1102 |
| 53 self.command.bind_to_tool(self.tool) | 61 self.command.bind_to_tool(self.tool) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 def test_copying_overwritten_baseline(self): | 116 def test_copying_overwritten_baseline(self): |
| 109 self.tool.executive = MockExecutive2() | 117 self.tool.executive = MockExecutive2() |
| 110 | 118 |
| 111 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a
nd | 119 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a
nd |
| 112 # not the regular mac10.10 port. Really all of the tests should be using | 120 # not the regular mac10.10 port. Really all of the tests should be using |
| 113 # the test ports. | 121 # the test ports. |
| 114 port = self.tool.port_factory.get('test-mac-mac10.10') | 122 port = self.tool.port_factory.get('test-mac-mac10.10') |
| 115 self._write(port._filesystem.join(port.layout_tests_dir(), | 123 self._write(port._filesystem.join(port.layout_tests_dir(), |
| 116 'platform/test-mac-mac10.10/failures/e
xpected/image-expected.txt'), 'original mac10.11 result') | 124 'platform/test-mac-mac10.10/failures/e
xpected/image-expected.txt'), 'original mac10.11 result') |
| 117 | 125 |
| 118 old_exact_matches = builders._exact_matches | 126 self.tool.builders = FakeBuilders({ |
| 127 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 128 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 129 }) |
| 130 |
| 119 oc = OutputCapture() | 131 oc = OutputCapture() |
| 120 try: | 132 try: |
| 121 builders._exact_matches = { | |
| 122 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | |
| 123 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | |
| 124 } | |
| 125 | |
| 126 options = MockOptions(builder="MOCK Mac10.11", suffixes="txt", verbo
se=True, | 133 options = MockOptions(builder="MOCK Mac10.11", suffixes="txt", verbo
se=True, |
| 127 test="failures/expected/image.html", results_d
irectory=None) | 134 test="failures/expected/image.html", results_d
irectory=None) |
| 128 | 135 |
| 129 oc.capture_output() | 136 oc.capture_output() |
| 130 self.command.execute(options, [], self.tool) | 137 self.command.execute(options, [], self.tool) |
| 131 finally: | 138 finally: |
| 132 out, _, _ = oc.restore_output() | 139 out, _, _ = oc.restore_output() |
| 133 builders._exact_matches = old_exact_matches | |
| 134 | 140 |
| 135 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), | 141 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), |
| 136 'platform
/test-mac-mac10.10/failures/expected/image-expected.txt')), 'original mac10.11 r
esult') | 142 'platform
/test-mac-mac10.10/failures/expected/image-expected.txt')), 'original mac10.11 r
esult') |
| 137 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') | 143 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') |
| 138 | 144 |
| 139 def test_copying_overwritten_baseline_to_multiple_locations(self): | 145 def test_copying_overwritten_baseline_to_multiple_locations(self): |
| 140 self.tool.executive = MockExecutive2() | 146 self.tool.executive = MockExecutive2() |
| 141 | 147 |
| 142 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a
nd | 148 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a
nd |
| 143 # not the regular win port. Really all of the tests should be using the | 149 # not the regular win port. Really all of the tests should be using the |
| 144 # test ports. | 150 # test ports. |
| 145 port = self.tool.port_factory.get('test-win-win7') | 151 port = self.tool.port_factory.get('test-win-win7') |
| 146 self._write(port._filesystem.join(port.layout_tests_dir(), | 152 self._write(port._filesystem.join(port.layout_tests_dir(), |
| 147 'platform/test-win-win7/failures/expec
ted/image-expected.txt'), 'original win7 result') | 153 'platform/test-win-win7/failures/expec
ted/image-expected.txt'), 'original win7 result') |
| 148 | 154 |
| 149 old_exact_matches = builders._exact_matches | 155 self.tool.builders = FakeBuilders({ |
| 156 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 157 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(
["mock-specifier"])}, |
| 158 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": se
t(["mock-specifier"])}, |
| 159 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock
-specifier"])}, |
| 160 }) |
| 150 oc = OutputCapture() | 161 oc = OutputCapture() |
| 151 try: | 162 try: |
| 152 builders._exact_matches = { | |
| 153 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | |
| 154 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers":
set(["mock-specifier"])}, | |
| 155 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers"
: set(["mock-specifier"])}, | |
| 156 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["
mock-specifier"])}, | |
| 157 } | |
| 158 | |
| 159 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, | 163 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, |
| 160 test="failures/expected/image.html", results_d
irectory=None) | 164 test="failures/expected/image.html", results_d
irectory=None) |
| 161 | 165 |
| 162 oc.capture_output() | 166 oc.capture_output() |
| 163 self.command.execute(options, [], self.tool) | 167 self.command.execute(options, [], self.tool) |
| 164 finally: | 168 finally: |
| 165 out, _, _ = oc.restore_output() | 169 out, _, _ = oc.restore_output() |
| 166 builders._exact_matches = old_exact_matches | |
| 167 | 170 |
| 168 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), | 171 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), |
| 169 'platform
/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul
t') | 172 'platform
/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul
t') |
| 170 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 173 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 171 port.layout_tests_dir(), 'platform/test-linux-precise/userscripts/an
other-test-expected.txt'))) | 174 port.layout_tests_dir(), 'platform/test-linux-precise/userscripts/an
other-test-expected.txt'))) |
| 172 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 175 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 173 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano
ther-test-expected.txt'))) | 176 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano
ther-test-expected.txt'))) |
| 174 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') | 177 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') |
| 175 | 178 |
| 176 def test_no_copy_existing_baseline(self): | 179 def test_no_copy_existing_baseline(self): |
| 177 self.tool.executive = MockExecutive2() | 180 self.tool.executive = MockExecutive2() |
| 178 | 181 |
| 179 # FIXME: it's confusing that this is the test- port, and not the regular | 182 # FIXME: it's confusing that this is the test- port, and not the regular |
| 180 # win port. Really all of the tests should be using the test ports. | 183 # win port. Really all of the tests should be using the test ports. |
| 181 port = self.tool.port_factory.get('test-win-win7') | 184 port = self.tool.port_factory.get('test-win-win7') |
| 182 self._write(port._filesystem.join(port.layout_tests_dir(), | 185 self._write(port._filesystem.join(port.layout_tests_dir(), |
| 183 'platform/test-win-win7/failures/expec
ted/image-expected.txt'), 'original win7 result') | 186 'platform/test-win-win7/failures/expec
ted/image-expected.txt'), 'original win7 result') |
| 184 | 187 |
| 185 old_exact_matches = builders._exact_matches | 188 self.tool.builders = FakeBuilders({ |
| 189 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 190 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(
["mock-specifier"])}, |
| 191 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock
-specifier"])}, |
| 192 }) |
| 186 oc = OutputCapture() | 193 oc = OutputCapture() |
| 187 try: | 194 try: |
| 188 builders._exact_matches = { | |
| 189 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | |
| 190 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers":
set(["mock-specifier"])}, | |
| 191 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["
mock-specifier"])}, | |
| 192 } | |
| 193 | |
| 194 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, | 195 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, |
| 195 test="failures/expected/image.html", results_d
irectory=None) | 196 test="failures/expected/image.html", results_d
irectory=None) |
| 196 | 197 |
| 197 oc.capture_output() | 198 oc.capture_output() |
| 198 self.command.execute(options, [], self.tool) | 199 self.command.execute(options, [], self.tool) |
| 199 finally: | 200 finally: |
| 200 out, _, _ = oc.restore_output() | 201 out, _, _ = oc.restore_output() |
| 201 builders._exact_matches = old_exact_matches | |
| 202 | 202 |
| 203 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), | 203 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), |
| 204 'platform
/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul
t') | 204 'platform
/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul
t') |
| 205 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), | 205 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir(), |
| 206 'platform
/test-win-win7/failures/expected/image-expected.txt')), 'original win7 result') | 206 'platform
/test-win-win7/failures/expected/image-expected.txt')), 'original win7 result') |
| 207 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 207 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 208 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano
ther-test-expected.txt'))) | 208 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano
ther-test-expected.txt'))) |
| 209 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') | 209 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') |
| 210 | 210 |
| 211 def test_no_copy_skipped_test(self): | 211 def test_no_copy_skipped_test(self): |
| 212 self.tool.executive = MockExecutive2() | 212 self.tool.executive = MockExecutive2() |
| 213 port = self.tool.port_factory.get('test-win-win7') | 213 port = self.tool.port_factory.get('test-win-win7') |
| 214 fs = self.tool.filesystem | 214 fs = self.tool.filesystem |
| 215 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai
lures/expected/image-expected.txt'), 'original win7 result') | 215 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai
lures/expected/image-expected.txt'), 'original win7 result') |
| 216 expectations_path = fs.join(port.path_to_generic_test_expectations_file(
)) | 216 expectations_path = fs.join(port.path_to_generic_test_expectations_file(
)) |
| 217 self._write(expectations_path, ( | 217 self._write(expectations_path, ( |
| 218 "[ Win ] failures/expected/image.html [ Failure ]\n" | 218 "[ Win ] failures/expected/image.html [ Failure ]\n" |
| 219 "[ Linux ] failures/expected/image.html [ Skip ]\n")) | 219 "[ Linux ] failures/expected/image.html [ Skip ]\n")) |
| 220 old_exact_matches = builders._exact_matches | 220 self.tool.builders = FakeBuilders({ |
| 221 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 222 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(
["mock-specifier"])}, |
| 223 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": se
t(["mock-specifier"])}, |
| 224 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock
-specifier"])}, |
| 225 }) |
| 221 oc = OutputCapture() | 226 oc = OutputCapture() |
| 222 try: | 227 try: |
| 223 builders._exact_matches = { | |
| 224 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | |
| 225 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers":
set(["mock-specifier"])}, | |
| 226 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers"
: set(["mock-specifier"])}, | |
| 227 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["
mock-specifier"])}, | |
| 228 } | |
| 229 | |
| 230 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, | 228 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T
rue, |
| 231 test="failures/expected/image.html", results_d
irectory=None) | 229 test="failures/expected/image.html", results_d
irectory=None) |
| 232 | 230 |
| 233 oc.capture_output() | 231 oc.capture_output() |
| 234 self.command.execute(options, [], self.tool) | 232 self.command.execute(options, [], self.tool) |
| 235 finally: | 233 finally: |
| 236 out, _, _ = oc.restore_output() | 234 out, _, _ = oc.restore_output() |
| 237 builders._exact_matches = old_exact_matches | |
| 238 | 235 |
| 239 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te
st-mac-mac10.10/failures/expected/image-expected.txt'))) | 236 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te
st-mac-mac10.10/failures/expected/image-expected.txt'))) |
| 240 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te
st-linux-trusty/failures/expected/image-expected.txt'))) | 237 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te
st-linux-trusty/failures/expected/image-expected.txt'))) |
| 241 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), | 238 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), |
| 242 'platform/test-linux-precise/failures
/expected/image-expected.txt'))) | 239 'platform/test-linux-precise/failures
/expected/image-expected.txt'))) |
| 243 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t
est-win-win7/failures/expected/image-expected.txt')), | 240 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t
est-win-win7/failures/expected/image-expected.txt')), |
| 244 'original win7 result') | 241 'original win7 result') |
| 245 | 242 |
| 246 | 243 |
| 247 class TestRebaselineTest(_BaseTestCase): | 244 class TestRebaselineTest(_BaseTestCase): |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 312 |
| 316 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): | 313 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): |
| 317 self.tool.executive = MockExecutive2() | 314 self.tool.executive = MockExecutive2() |
| 318 | 315 |
| 319 # FIXME: it's confusing that this is the test- port, and not the regular | 316 # FIXME: it's confusing that this is the test- port, and not the regular |
| 320 # win port. Really all of the tests should be using the test ports. | 317 # win port. Really all of the tests should be using the test ports. |
| 321 port = self.tool.port_factory.get('test-win-win7') | 318 port = self.tool.port_factory.get('test-win-win7') |
| 322 self._write(port._filesystem.join(port.layout_tests_dir(), | 319 self._write(port._filesystem.join(port.layout_tests_dir(), |
| 323 'platform/test-win-win10/failures/expe
cted/image-expected.txt'), 'original win10 result') | 320 'platform/test-win-win10/failures/expe
cted/image-expected.txt'), 'original win10 result') |
| 324 | 321 |
| 325 old_exact_matches = builders._exact_matches | 322 self.tool.builders = FakeBuilders({ |
| 323 "MOCK Win7": {"port_name": "test-win-win7"}, |
| 324 "MOCK Win10": {"port_name": "test-win-win10"}, |
| 325 }) |
| 326 oc = OutputCapture() | 326 oc = OutputCapture() |
| 327 try: | 327 try: |
| 328 builders._exact_matches = { | |
| 329 "MOCK Win7": {"port_name": "test-win-win7"}, | |
| 330 "MOCK Win10": {"port_name": "test-win-win10"}, | |
| 331 } | |
| 332 | |
| 333 options = MockOptions(optimize=True, builder="MOCK Win10", suffixes=
"txt", | 328 options = MockOptions(optimize=True, builder="MOCK Win10", suffixes=
"txt", |
| 334 verbose=True, test="failures/expected/image.ht
ml", results_directory=None) | 329 verbose=True, test="failures/expected/image.ht
ml", results_directory=None) |
| 335 | 330 |
| 336 oc.capture_output() | 331 oc.capture_output() |
| 337 self.command.execute(options, [], self.tool) | 332 self.command.execute(options, [], self.tool) |
| 338 finally: | 333 finally: |
| 339 out, _, _ = oc.restore_output() | 334 out, _, _ = oc.restore_output() |
| 340 builders._exact_matches = old_exact_matches | |
| 341 | 335 |
| 342 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir( | 336 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir( |
| 343 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO
CK Web result, convert 404 to None=True') | 337 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO
CK Web result, convert 404 to None=True') |
| 344 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 338 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 345 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i
mage-expected.txt'))) | 339 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i
mage-expected.txt'))) |
| 346 self.assertMultiLineEqual( | 340 self.assertMultiLineEqual( |
| 347 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image
.html", "builder": "MOCK Win10"}], "delete": []}\n') | 341 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image
.html", "builder": "MOCK Win10"}], "delete": []}\n') |
| 348 | 342 |
| 349 | 343 |
| 350 class TestAbstractParallelRebaselineCommand(_BaseTestCase): | 344 class TestAbstractParallelRebaselineCommand(_BaseTestCase): |
| 351 command_constructor = AbstractParallelRebaselineCommand | 345 command_constructor = AbstractParallelRebaselineCommand |
| 352 | 346 |
| 353 def test_builders_to_fetch_from(self): | 347 def test_builders_to_fetch_from(self): |
| 354 old_exact_matches = builders._exact_matches | 348 self.tool.builders = FakeBuilders({ |
| 355 try: | 349 "MOCK Win10": {"port_name": "test-win-win10"}, |
| 356 builders._exact_matches = { | 350 "MOCK Win7": {"port_name": "test-win-win7"}, |
| 357 "MOCK Win10": {"port_name": "test-win-win10"}, | 351 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"}, |
| 358 "MOCK Win7": {"port_name": "test-win-win7"}, | 352 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"}, |
| 359 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"}, | 353 }) |
| 360 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"}, | |
| 361 } | |
| 362 | 354 |
| 363 builders_to_fetch = self.command._builders_to_fetch_from( | 355 builders_to_fetch = self.command._builders_to_fetch_from( |
| 364 ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK
Win7"]) | 356 ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win
7"]) |
| 365 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"]) | 357 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"]) |
| 366 finally: | |
| 367 builders._exact_matches = old_exact_matches | |
| 368 | 358 |
| 369 | 359 |
| 370 class TestRebaselineJson(_BaseTestCase): | 360 class TestRebaselineJson(_BaseTestCase): |
| 371 command_constructor = RebaselineJson | 361 command_constructor = RebaselineJson |
| 372 | 362 |
| 373 def setUp(self): | 363 def setUp(self): |
| 374 super(TestRebaselineJson, self).setUp() | 364 super(TestRebaselineJson, self).setUp() |
| 375 self.tool.executive = MockExecutive2() | 365 self.tool.executive = MockExecutive2() |
| 376 self.old_exact_matches = builders._exact_matches | 366 self.tool.builders = FakeBuilders({ |
| 377 builders._exact_matches = { | |
| 378 "MOCK builder": {"port_name": "test-mac-mac10.11"}, | 367 "MOCK builder": {"port_name": "test-mac-mac10.11"}, |
| 379 "MOCK builder (Debug)": {"port_name": "test-mac-mac10.11"}, | 368 "MOCK builder (Debug)": {"port_name": "test-mac-mac10.11"}, |
| 380 } | 369 }) |
| 381 | 370 |
| 382 def tearDown(self): | 371 def tearDown(self): |
| 383 builders._exact_matches = self.old_exact_matches | |
| 384 super(TestRebaselineJson, self).tearDown() | 372 super(TestRebaselineJson, self).tearDown() |
| 385 | 373 |
| 386 def test_rebaseline_test_passes_on_all_builders(self): | 374 def test_rebaseline_test_passes_on_all_builders(self): |
| 387 self._setup_mock_builder_data() | 375 self._setup_mock_builder_data() |
| 388 | 376 |
| 389 def builder_data(): | 377 def builder_data(): |
| 390 self.command._builder_data['MOCK builder'] = LayoutTestResults.resul
ts_from_string("""ADD_RESULTS({ | 378 self.command._builder_data['MOCK builder'] = LayoutTestResults.resul
ts_from_string("""ADD_RESULTS({ |
| 391 "tests": { | 379 "tests": { |
| 392 "userscripts": { | 380 "userscripts": { |
| 393 "first-test.html": { | 381 "first-test.html": { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 command_constructor = Rebaseline # AKA webkit-patch rebaseline | 560 command_constructor = Rebaseline # AKA webkit-patch rebaseline |
| 573 | 561 |
| 574 def test_rebaseline(self): | 562 def test_rebaseline(self): |
| 575 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] | 563 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] |
| 576 | 564 |
| 577 self._write("userscripts/first-test.html", "test data") | 565 self._write("userscripts/first-test.html", "test data") |
| 578 | 566 |
| 579 self._zero_out_test_expectations() | 567 self._zero_out_test_expectations() |
| 580 self._setup_mock_builder_data() | 568 self._setup_mock_builder_data() |
| 581 | 569 |
| 582 old_exact_matches = builders._exact_matches | 570 self.tool.builders = FakeBuilders({ |
| 583 try: | 571 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set
(["mock-specifier"])}, |
| 584 builders._exact_matches = { | 572 }) |
| 585 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers":
set(["mock-specifier"])}, | 573 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, |
| 586 } | 574 suffixes="txt,png", verbose=True), ['us
erscripts/first-test.html'], self.tool) |
| 587 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, | |
| 588 suffixes="txt,png", verbose=True),
['userscripts/first-test.html'], self.tool) | |
| 589 finally: | |
| 590 builders._exact_matches = old_exact_matches | |
| 591 | 575 |
| 592 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) | 576 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) |
| 593 self.assertEqual(calls, | 577 self.assertEqual(calls, |
| 594 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f
irst-test.html', '--verbose']], | 578 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f
irst-test.html', '--verbose']], |
| 595 [['python', 'echo', 'rebaseline-test-internal', '--suf
fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes
t.html', '--verbose']]]) | 579 [['python', 'echo', 'rebaseline-test-internal', '--suf
fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes
t.html', '--verbose']]]) |
| 596 | 580 |
| 597 def test_rebaseline_directory(self): | 581 def test_rebaseline_directory(self): |
| 598 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] | 582 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] |
| 599 | 583 |
| 600 self._write("userscripts/first-test.html", "test data") | 584 self._write("userscripts/first-test.html", "test data") |
| 601 self._write("userscripts/second-test.html", "test data") | 585 self._write("userscripts/second-test.html", "test data") |
| 602 | 586 |
| 603 self._setup_mock_builder_data() | 587 self._setup_mock_builder_data() |
| 604 | 588 |
| 605 old_exact_matches = builders._exact_matches | 589 self.tool.builders = FakeBuilders({ |
| 606 try: | 590 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set
(["mock-specifier"])}, |
| 607 builders._exact_matches = { | 591 }) |
| 608 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers":
set(["mock-specifier"])}, | 592 self.command.execute(MockOptions(results_directory=False, optimize=False
, builders=None, |
| 609 } | 593 suffixes="txt,png", verbose=True), ['us
erscripts'], self.tool) |
| 610 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, | |
| 611 suffixes="txt,png", verbose=True),
['userscripts'], self.tool) | |
| 612 finally: | |
| 613 builders._exact_matches = old_exact_matches | |
| 614 | 594 |
| 615 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) | 595 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) |
| 616 self.assertEqual(calls, | 596 self.assertEqual(calls, |
| 617 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f
irst-test.html', '--verbose'], | 597 [[['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f
irst-test.html', '--verbose'], |
| 618 ['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/s
econd-test.html', '--verbose']], | 598 ['python', 'echo', 'copy-existing-baselines-internal'
, '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/s
econd-test.html', '--verbose']], |
| 619 [['python', 'echo', 'rebaseline-test-internal', '--
suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-
test.html', '--verbose'], | 599 [['python', 'echo', 'rebaseline-test-internal', '--
suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-
test.html', '--verbose'], |
| 620 ['python', 'echo', 'rebaseline-test-internal', '--
suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/second
-test.html', '--verbose']]]) | 600 ['python', 'echo', 'rebaseline-test-internal', '--
suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/second
-test.html', '--verbose']]]) |
| 621 | 601 |
| 622 | 602 |
| 623 class MockLineRemovingExecutive(MockExecutive): | 603 class MockLineRemovingExecutive(MockExecutive): |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 self.command.builder_data = builder_data | 670 self.command.builder_data = builder_data |
| 691 | 671 |
| 692 self._write("userscripts/another-test.html", "Dummy test contents") | 672 self._write("userscripts/another-test.html", "Dummy test contents") |
| 693 self._write("userscripts/images.svg", "Dummy test contents") | 673 self._write("userscripts/images.svg", "Dummy test contents") |
| 694 self.command._tests_to_rebaseline = lambda port: { | 674 self.command._tests_to_rebaseline = lambda port: { |
| 695 'userscripts/another-test.html': set(['txt']), | 675 'userscripts/another-test.html': set(['txt']), |
| 696 'userscripts/images.svg': set(['png']), | 676 'userscripts/images.svg': set(['png']), |
| 697 'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']), | 677 'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']), |
| 698 } | 678 } |
| 699 | 679 |
| 700 old_exact_matches = builders._exact_matches | 680 self.tool.builders = FakeBuilders({ |
| 701 try: | 681 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 702 builders._exact_matches = { | 682 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 703 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 683 }) |
| 704 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | 684 self.command.execute(self.options, [], self.tool) |
| 705 } | |
| 706 self.command.execute(self.options, [], self.tool) | |
| 707 finally: | |
| 708 builders._exact_matches = old_exact_matches | |
| 709 | 685 |
| 710 # FIXME: change this to use the test- ports. | 686 # FIXME: change this to use the test- ports. |
| 711 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls
) | 687 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls
) |
| 712 self.assertEqual(self.tool.executive.calls, [ | 688 self.assertEqual(self.tool.executive.calls, [ |
| 713 [ | 689 [ |
| 714 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', | 690 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 715 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another
-test.html'], | 691 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another
-test.html'], |
| 716 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', | 692 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 717 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another
-test.html'], | 693 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another
-test.html'], |
| 718 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'png', | 694 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'png', |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 self.command.builder_data = builder_data | 766 self.command.builder_data = builder_data |
| 791 | 767 |
| 792 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 768 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 793 Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ] | 769 Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ] |
| 794 """) | 770 """) |
| 795 | 771 |
| 796 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 772 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 797 | 773 |
| 798 self.tool.executive = MockLineRemovingExecutive() | 774 self.tool.executive = MockLineRemovingExecutive() |
| 799 | 775 |
| 800 old_exact_matches = builders._exact_matches | 776 self.tool.builders = FakeBuilders({ |
| 801 try: | 777 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 802 builders._exact_matches = { | 778 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 803 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 779 }) |
| 804 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | 780 self.command.execute(self.options, [], self.tool) |
| 805 } | 781 self.assertEqual(self.tool.executive.calls, []) |
| 806 | 782 |
| 807 self.command.execute(self.options, [], self.tool) | 783 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. |
| 808 self.assertEqual(self.tool.executive.calls, []) | 784 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ |
| 809 | |
| 810 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | |
| 811 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | |
| 812 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ] | 785 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ] |
| 813 """) | 786 """) |
| 814 finally: | |
| 815 builders._exact_matches = old_exact_matches | |
| 816 | 787 |
| 817 | 788 |
| 818 class _FakeOptimizer(BaselineOptimizer): | 789 class _FakeOptimizer(BaselineOptimizer): |
| 819 | 790 |
| 820 def read_results_by_directory(self, baseline_name): | 791 def read_results_by_directory(self, baseline_name): |
| 821 if baseline_name.endswith('txt'): | 792 if baseline_name.endswith('txt'): |
| 822 return {'LayoutTests/passes/text.html': '123456'} | 793 return {'LayoutTests/passes/text.html': '123456'} |
| 823 return {} | 794 return {} |
| 824 | 795 |
| 825 | 796 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 837 # instead of one using /mock-checkout and one using /test-checkout. | 808 # instead of one using /mock-checkout and one using /test-checkout. |
| 838 default_port = self.tool.port_factory.get() | 809 default_port = self.tool.port_factory.get() |
| 839 self.tool.port_factory.get = lambda port_name=None: default_port | 810 self.tool.port_factory.get = lambda port_name=None: default_port |
| 840 | 811 |
| 841 def test_modify_scm(self): | 812 def test_modify_scm(self): |
| 842 test_port = self.tool.port_factory.get('test') | 813 test_port = self.tool.port_factory.get('test') |
| 843 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") | 814 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") |
| 844 self._write_test_file(test_port, 'platform/mac/another/test-expected.txt
', "result A") | 815 self._write_test_file(test_port, 'platform/mac/another/test-expected.txt
', "result A") |
| 845 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) | 816 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) |
| 846 | 817 |
| 847 old_exact_matches = builders._exact_matches | 818 self.tool.builders = FakeBuilders({ |
| 848 try: | 819 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifier
s": set(["mock-specifier"])}, |
| 849 builders._exact_matches = { | 820 }) |
| 850 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci
fiers": set(["mock-specifier"])}, | 821 OutputCapture().assert_outputs(self, self.command.execute, args=[ |
| 851 } | 822 MockOptions(suffixes='txt', no_modify_scm=False, platform='test-mac-
mac10.10'), |
| 852 OutputCapture().assert_outputs(self, self.command.execute, args=[ | 823 ['another/test.html'], |
| 853 MockOptions(suffixes='txt', no_modify_scm=False, platform='test-
mac-mac10.10'), | 824 self.tool, |
| 854 ['another/test.html'], | 825 ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n') |
| 855 self.tool, | |
| 856 ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n'
) | |
| 857 finally: | |
| 858 builders._exact_matches = old_exact_matches | |
| 859 | 826 |
| 860 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 827 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 861 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) | 828 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) |
| 862 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 829 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 863 test_port.layout_tests_dir(), 'another/test-expected.txt'))) | 830 test_port.layout_tests_dir(), 'another/test-expected.txt'))) |
| 864 | 831 |
| 865 def test_no_modify_scm(self): | 832 def test_no_modify_scm(self): |
| 866 test_port = self.tool.port_factory.get('test') | 833 test_port = self.tool.port_factory.get('test') |
| 867 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") | 834 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") |
| 868 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.txt', "result A") | 835 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.txt', "result A") |
| 869 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) | 836 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) |
| 870 | 837 |
| 871 old_exact_matches = builders._exact_matches | 838 self.tool.builders = FakeBuilders({ |
| 872 try: | 839 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifier
s": set(["mock-specifier"])}, |
| 873 builders._exact_matches = { | 840 }) |
| 874 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci
fiers": set(["mock-specifier"])}, | 841 OutputCapture().assert_outputs(self, self.command.execute, args=[ |
| 875 } | 842 MockOptions(suffixes='txt', no_modify_scm=True, platform='test-mac-m
ac10.10'), |
| 876 OutputCapture().assert_outputs(self, self.command.execute, args=[ | 843 ['another/test.html'], |
| 877 MockOptions(suffixes='txt', no_modify_scm=True, platform='test-m
ac-mac10.10'), | 844 self.tool, |
| 878 ['another/test.html'], | 845 ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/mock-ch
eckout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expecte
d.txt"]}\n') |
| 879 self.tool, | |
| 880 ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/moc
k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp
ected.txt"]}\n') | |
| 881 finally: | |
| 882 builders._exact_matches = old_exact_matches | |
| 883 | 846 |
| 884 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 847 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 885 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) | 848 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) |
| 886 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 849 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 887 test_port.layout_tests_dir(), 'another/test-expected.txt'))) | 850 test_port.layout_tests_dir(), 'another/test-expected.txt'))) |
| 888 | 851 |
| 889 def test_optimize_all_suffixes_by_default(self): | 852 def test_optimize_all_suffixes_by_default(self): |
| 890 test_port = self.tool.port_factory.get('test') | 853 test_port = self.tool.port_factory.get('test') |
| 891 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") | 854 self._write_test_file(test_port, 'another/test.html', "Dummy test conten
ts") |
| 892 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.txt', "result A") | 855 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.txt', "result A") |
| 893 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.png', "result A png") | 856 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp
ected.png', "result A png") |
| 894 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) | 857 self._write_test_file(test_port, 'another/test-expected.txt', "result A"
) |
| 895 self._write_test_file(test_port, 'another/test-expected.png', "result A
png") | 858 self._write_test_file(test_port, 'another/test-expected.png', "result A
png") |
| 896 | 859 |
| 897 old_exact_matches = builders._exact_matches | 860 self.tool.builders = FakeBuilders({ |
| 861 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifier
s": set(["mock-specifier"])}, |
| 862 }) |
| 898 try: | 863 try: |
| 899 builders._exact_matches = { | |
| 900 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci
fiers": set(["mock-specifier"])}, | |
| 901 } | |
| 902 oc = OutputCapture() | 864 oc = OutputCapture() |
| 903 oc.capture_output() | 865 oc.capture_output() |
| 904 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s
cm=True, platform='test-mac-mac10.10'), | 866 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s
cm=True, platform='test-mac-mac10.10'), |
| 905 ['another/test.html'], | 867 ['another/test.html'], |
| 906 self.tool) | 868 self.tool) |
| 907 finally: | 869 finally: |
| 908 out, err, logs = oc.restore_output() | 870 out, err, logs = oc.restore_output() |
| 909 builders._exact_matches = old_exact_matches | |
| 910 | 871 |
| 911 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/moc
k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp
ected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10
/another/test-expected.png"]}\n') | 872 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/moc
k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp
ected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10
/another/test-expected.png"]}\n') |
| 912 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 873 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 913 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) | 874 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx
t'))) |
| 914 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 875 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 915 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn
g'))) | 876 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn
g'))) |
| 916 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 877 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 917 test_port.layout_tests_dir(), 'another/test-expected.txt'))) | 878 test_port.layout_tests_dir(), 'another/test-expected.txt'))) |
| 918 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( | 879 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( |
| 919 test_port.layout_tests_dir(), 'another/test-expected.png'))) | 880 test_port.layout_tests_dir(), 'another/test-expected.png'))) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 optimize=True, verbose=False, results_directory=False, auth_refresh_
token_json=auth_refresh_token_json, | 932 optimize=True, verbose=False, results_directory=False, auth_refresh_
token_json=auth_refresh_token_json, |
| 972 commit_author=commit_author, dry_run=dry_run), | 933 commit_author=commit_author, dry_run=dry_run), |
| 973 [], self.tool) | 934 [], self.tool) |
| 974 | 935 |
| 975 def setUp(self): | 936 def setUp(self): |
| 976 super(TestAutoRebaseline, self).setUp() | 937 super(TestAutoRebaseline, self).setUp() |
| 977 self.command.latest_revision_processed_on_all_bots = lambda: 9000 | 938 self.command.latest_revision_processed_on_all_bots = lambda: 9000 |
| 978 self.command.bot_revision_data = lambda: [{"builder": "Mock builder", "r
evision": "9000"}] | 939 self.command.bot_revision_data = lambda: [{"builder": "Mock builder", "r
evision": "9000"}] |
| 979 | 940 |
| 980 def test_release_builders(self): | 941 def test_release_builders(self): |
| 981 old_exact_matches = builders._exact_matches | 942 self.tool.builders = FakeBuilders({ |
| 982 try: | 943 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 983 builders._exact_matches = { | 944 "MOCK Mac10.11 Debug": {"port_name": "test-mac-mac10.11", "specifier
s": set(["mock-specifier"])}, |
| 984 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 945 "MOCK Mac10.11 ASAN": {"port_name": "test-mac-mac10.11", "specifiers
": set(["mock-specifier"])}, |
| 985 "MOCK Mac10.11 Debug": {"port_name": "test-mac-mac10.11", "speci
fiers": set(["mock-specifier"])}, | 946 }) |
| 986 "MOCK Mac10.11 ASAN": {"port_name": "test-mac-mac10.11", "specif
iers": set(["mock-specifier"])}, | 947 self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10']) |
| 987 } | |
| 988 self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10']
) | |
| 989 finally: | |
| 990 builders._exact_matches = old_exact_matches | |
| 991 | 948 |
| 992 def test_tests_to_rebaseline(self): | 949 def test_tests_to_rebaseline(self): |
| 993 def blame(path): | 950 def blame(path): |
| 994 return """ | 951 return """ |
| 995 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] | 952 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] |
| 996 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org@
bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-06-14 20:18:46 +0000 11) crbug.com/
24182 [ Debug ] path/to/norebaseline-email-with-hash.html [ Failure ] | 953 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org@
bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-06-14 20:18:46 +0000 11) crbug.com/
24182 [ Debug ] path/to/norebaseline-email-with-hash.html [ Failure ] |
| 997 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) path/to/rebaseline-without-bug-number.
html [ NeedsRebaseline ] | 954 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) path/to/rebaseline-without-bug-number.
html [ NeedsRebaseline ] |
| 998 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-wi
th-modifiers.html [ NeedsRebaseline ] | 955 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-wi
th-modifiers.html [ NeedsRebaseline ] |
| 999 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaselin
e-without-modifiers.html [ NeedsRebaseline ] | 956 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaselin
e-without-modifiers.html [ NeedsRebaseline ] |
| 1000 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org@
bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com/
24182 path/to/rebaseline-new-revision.html [ NeedsRebaseline ] | 957 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org@
bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com/
24182 path/to/rebaseline-new-revision.html [ NeedsRebaseline ] |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] | 1078 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] |
| 1122 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] | 1079 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] |
| 1123 """) | 1080 """) |
| 1124 | 1081 |
| 1125 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1082 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1126 self._write_test_file(test_port, 'fast/dom/prototype-strawberry.html', "
Dummy test contents") | 1083 self._write_test_file(test_port, 'fast/dom/prototype-strawberry.html', "
Dummy test contents") |
| 1127 self._write_test_file(test_port, 'fast/dom/prototype-chocolate.html', "D
ummy test contents") | 1084 self._write_test_file(test_port, 'fast/dom/prototype-chocolate.html', "D
ummy test contents") |
| 1128 | 1085 |
| 1129 self.tool.executive = MockLineRemovingExecutive() | 1086 self.tool.executive = MockLineRemovingExecutive() |
| 1130 | 1087 |
| 1131 old_exact_matches = builders._exact_matches | 1088 self.tool.builders = FakeBuilders({ |
| 1132 try: | 1089 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 1133 builders._exact_matches = { | 1090 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 1134 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 1091 }) |
| 1135 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | |
| 1136 } | |
| 1137 | 1092 |
| 1138 self.command.tree_status = lambda: 'closed' | 1093 self.command.tree_status = lambda: 'closed' |
| 1139 self._execute_command_with_mock_options() | 1094 self._execute_command_with_mock_options() |
| 1140 self.assertEqual(self.tool.executive.calls, []) | 1095 self.assertEqual(self.tool.executive.calls, []) |
| 1141 | 1096 |
| 1142 self.command.tree_status = lambda: 'open' | 1097 self.command.tree_status = lambda: 'open' |
| 1143 self.tool.executive.calls = [] | 1098 self.tool.executive.calls = [] |
| 1144 self._execute_command_with_mock_options() | 1099 self._execute_command_with_mock_options() |
| 1145 | 1100 |
| 1146 self.assertEqual(self.tool.executive.calls, [ | 1101 self.assertEqual(self.tool.executive.calls, [ |
| 1147 [ | 1102 [ |
| 1148 ['python', 'echo', 'copy-existing-baselines-internal', '--su
ffixes', 'txt,png', | 1103 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt,png', |
| 1149 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot
ype-chocolate.html'], | 1104 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-
chocolate.html'], |
| 1150 ['python', 'echo', 'copy-existing-baselines-internal', '--su
ffixes', 'png', | 1105 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'png', |
| 1151 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot
ype-strawberry.html'], | 1106 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-
strawberry.html'], |
| 1152 ['python', 'echo', 'copy-existing-baselines-internal', '--su
ffixes', 'txt', | 1107 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 1153 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot
ype-taco.html'], | 1108 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-
taco.html'], |
| 1154 ['python', 'echo', 'copy-existing-baselines-internal', '--su
ffixes', 'txt', | 1109 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 1155 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot
ype-taco.html'], | 1110 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-
taco.html'], |
| 1156 ], | 1111 ], |
| 1157 [ | 1112 [ |
| 1158 ['python', 'echo', 'rebaseline-test-internal', '--suffixes',
'txt,png', | 1113 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t,png', |
| 1159 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot
ype-chocolate.html'], | 1114 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-
chocolate.html'], |
| 1160 ['python', 'echo', 'rebaseline-test-internal', '--suffixes',
'png', '--builder', | 1115 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn
g', '--builder', |
| 1161 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberr
y.html'], | 1116 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.ht
ml'], |
| 1162 ['python', 'echo', 'rebaseline-test-internal', '--suffixes',
'txt', | 1117 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
| 1163 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot
ype-taco.html'], | 1118 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-
taco.html'], |
| 1164 ['python', 'echo', 'rebaseline-test-internal', '--suffixes',
'txt', | 1119 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
| 1165 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot
ype-taco.html'], | 1120 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-
taco.html'], |
| 1166 ], | 1121 ], |
| 1167 [ | 1122 [ |
| 1168 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', | 1123 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', |
| 1169 '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.h
tml'], | 1124 '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.html'
], |
| 1170 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', | 1125 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', |
| 1171 '--suffixes', 'png', 'fast/dom/prototype-strawberry.html
'], | 1126 '--suffixes', 'png', 'fast/dom/prototype-strawberry.html'], |
| 1172 ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
'--suffixes', 'txt', 'fast/dom/prototype-taco.html'], | 1127 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--s
uffixes', 'txt', 'fast/dom/prototype-taco.html'], |
| 1173 ], | 1128 ], |
| 1174 ['git', 'cl', 'upload', '-f'], | 1129 ['git', 'cl', 'upload', '-f'], |
| 1175 ['git', 'pull'], | 1130 ['git', 'pull'], |
| 1176 ['git', 'cl', 'land', '-f', '-v'], | 1131 ['git', 'cl', 'land', '-f', '-v'], |
| 1177 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1132 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldi
ssue'], |
| 1178 ]) | 1133 ]) |
| 1179 | 1134 |
| 1180 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | 1135 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. |
| 1181 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1136 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ |
| 1182 crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Rebaseline ] | 1137 crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Rebaseline ] |
| 1183 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1138 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1184 crbug.com/24182 [ Linux Win ] fast/dom/prototype-chocolate.html [ NeedsRebaselin
e ] | 1139 crbug.com/24182 [ Linux Win ] fast/dom/prototype-chocolate.html [ NeedsRebaselin
e ] |
| 1185 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] | 1140 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] |
| 1186 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] | 1141 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] |
| 1187 """) | 1142 """) |
| 1188 finally: | |
| 1189 builders._exact_matches = old_exact_matches | |
| 1190 | 1143 |
| 1191 def test_execute_git_cl_hangs(self): | 1144 def test_execute_git_cl_hangs(self): |
| 1192 def blame(path): | 1145 def blame(path): |
| 1193 return """ | 1146 return """ |
| 1194 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 1147 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 1195 """ | 1148 """ |
| 1196 self.tool.scm().blame = blame | 1149 self.tool.scm().blame = blame |
| 1197 | 1150 |
| 1198 test_port = self._setup_test_port() | 1151 test_port = self._setup_test_port() |
| 1199 | 1152 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1218 return self.command._builder_data | 1171 return self.command._builder_data |
| 1219 | 1172 |
| 1220 self.command.builder_data = builder_data | 1173 self.command.builder_data = builder_data |
| 1221 | 1174 |
| 1222 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 1175 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 1223 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1176 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1224 """) | 1177 """) |
| 1225 | 1178 |
| 1226 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1179 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1227 | 1180 |
| 1228 old_exact_matches = builders._exact_matches | 1181 self.tool.builders = FakeBuilders({ |
| 1229 try: | 1182 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 1230 builders._exact_matches = { | 1183 }) |
| 1231 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | |
| 1232 } | |
| 1233 | 1184 |
| 1234 self.command.SECONDS_BEFORE_GIVING_UP = 0 | 1185 self.command.SECONDS_BEFORE_GIVING_UP = 0 |
| 1235 self.command.tree_status = lambda: 'open' | 1186 self.command.tree_status = lambda: 'open' |
| 1236 self.tool.executive = MockExecutive() | 1187 self.tool.executive = MockExecutive() |
| 1237 self.tool.executive.calls = [] | 1188 self.tool.executive.calls = [] |
| 1238 self._execute_command_with_mock_options() | 1189 self._execute_command_with_mock_options() |
| 1239 | 1190 |
| 1240 self.assertEqual(self.tool.executive.calls, [ | 1191 self.assertEqual(self.tool.executive.calls, [ |
| 1241 [ | 1192 [ |
| 1242 ['python', 'echo', 'copy-existing-baselines-internal', '--su
ffixes', 'txt', | 1193 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 1243 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot
ype-taco.html'], | 1194 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-
taco.html'], |
| 1244 ], | 1195 ], |
| 1245 [ | 1196 [ |
| 1246 ['python', 'echo', 'rebaseline-test-internal', '--suffixes',
'txt', | 1197 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
| 1247 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot
ype-taco.html'], | 1198 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-
taco.html'], |
| 1248 ], | 1199 ], |
| 1249 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--
suffixes', 'txt', 'fast/dom/prototype-taco.html']], | 1200 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suff
ixes', 'txt', 'fast/dom/prototype-taco.html']], |
| 1250 ['git', 'cl', 'upload', '-f'], | 1201 ['git', 'cl', 'upload', '-f'], |
| 1251 ]) | 1202 ]) |
| 1252 finally: | |
| 1253 builders._exact_matches = old_exact_matches | |
| 1254 | 1203 |
| 1255 def test_execute_test_passes_everywhere(self): | 1204 def test_execute_test_passes_everywhere(self): |
| 1256 def blame(path): | 1205 def blame(path): |
| 1257 return """ | 1206 return """ |
| 1258 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 1207 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 1259 """ | 1208 """ |
| 1260 self.tool.scm().blame = blame | 1209 self.tool.scm().blame = blame |
| 1261 | 1210 |
| 1262 test_port = self._setup_test_port() | 1211 test_port = self._setup_test_port() |
| 1263 | 1212 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1282 self.command.builder_data = builder_data | 1231 self.command.builder_data = builder_data |
| 1283 | 1232 |
| 1284 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 1233 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 1285 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1234 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1286 """) | 1235 """) |
| 1287 | 1236 |
| 1288 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1237 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1289 | 1238 |
| 1290 self.tool.executive = MockLineRemovingExecutive() | 1239 self.tool.executive = MockLineRemovingExecutive() |
| 1291 | 1240 |
| 1292 old_exact_matches = builders._exact_matches | 1241 self.tool.builders = FakeBuilders({ |
| 1293 try: | 1242 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 1294 builders._exact_matches = { | 1243 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 1295 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 1244 }) |
| 1296 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | |
| 1297 } | |
| 1298 | 1245 |
| 1299 self.command.tree_status = lambda: 'open' | 1246 self.command.tree_status = lambda: 'open' |
| 1300 self._execute_command_with_mock_options() | 1247 self._execute_command_with_mock_options() |
| 1301 self.assertEqual(self.tool.executive.calls, [ | 1248 self.assertEqual(self.tool.executive.calls, [ |
| 1302 ['git', 'cl', 'upload', '-f'], | 1249 ['git', 'cl', 'upload', '-f'], |
| 1303 ['git', 'pull'], | 1250 ['git', 'pull'], |
| 1304 ['git', 'cl', 'land', '-f', '-v'], | 1251 ['git', 'cl', 'land', '-f', '-v'], |
| 1305 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1252 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldi
ssue'], |
| 1306 ]) | 1253 ]) |
| 1307 | 1254 |
| 1308 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | 1255 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. |
| 1309 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1256 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ |
| 1310 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1257 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1311 """) | 1258 """) |
| 1312 finally: | |
| 1313 builders._exact_matches = old_exact_matches | |
| 1314 | 1259 |
| 1315 def test_execute_use_alternate_rebaseline_branch(self): | 1260 def test_execute_use_alternate_rebaseline_branch(self): |
| 1316 def blame(path): | 1261 def blame(path): |
| 1317 return """ | 1262 return """ |
| 1318 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 1263 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 1319 """ | 1264 """ |
| 1320 self.tool.scm().blame = blame | 1265 self.tool.scm().blame = blame |
| 1321 | 1266 |
| 1322 test_port = self._setup_test_port() | 1267 test_port = self._setup_test_port() |
| 1323 | 1268 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1342 self.command.builder_data = builder_data | 1287 self.command.builder_data = builder_data |
| 1343 | 1288 |
| 1344 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 1289 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 1345 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1290 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1346 """) | 1291 """) |
| 1347 | 1292 |
| 1348 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1293 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1349 | 1294 |
| 1350 self.tool.executive = MockLineRemovingExecutive() | 1295 self.tool.executive = MockLineRemovingExecutive() |
| 1351 | 1296 |
| 1352 old_exact_matches = builders._exact_matches | 1297 self.tool.builders = FakeBuilders({ |
| 1298 "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-
specifier"])}, |
| 1299 }) |
| 1353 old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_
ref | 1300 old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_
ref |
| 1354 try: | 1301 try: |
| 1355 builders._exact_matches = { | |
| 1356 "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["m
ock-specifier"])}, | |
| 1357 } | |
| 1358 | |
| 1359 self.command.tree_status = lambda: 'open' | 1302 self.command.tree_status = lambda: 'open' |
| 1360 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x
: 'auto-rebaseline-temporary-branch' | 1303 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x
: 'auto-rebaseline-temporary-branch' |
| 1361 self._execute_command_with_mock_options() | 1304 self._execute_command_with_mock_options() |
| 1362 self.assertEqual(self.tool.executive.calls, [ | 1305 self.assertEqual(self.tool.executive.calls, [ |
| 1363 ['git', 'cl', 'upload', '-f'], | 1306 ['git', 'cl', 'upload', '-f'], |
| 1364 ['git', 'pull'], | 1307 ['git', 'pull'], |
| 1365 ['git', 'cl', 'land', '-f', '-v'], | 1308 ['git', 'cl', 'land', '-f', '-v'], |
| 1366 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r
ietveldissue'], | 1309 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r
ietveldissue'], |
| 1367 ]) | 1310 ]) |
| 1368 | 1311 |
| 1369 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1312 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
| 1370 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1313 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1371 """) | 1314 """) |
| 1372 finally: | 1315 finally: |
| 1373 builders._exact_matches = old_exact_matches | |
| 1374 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran
ch_name | 1316 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran
ch_name |
| 1375 | 1317 |
| 1376 def test_execute_stuck_on_alternate_rebaseline_branch(self): | 1318 def test_execute_stuck_on_alternate_rebaseline_branch(self): |
| 1377 def blame(path): | 1319 def blame(path): |
| 1378 return """ | 1320 return """ |
| 1379 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 1321 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 1380 """ | 1322 """ |
| 1381 self.tool.scm().blame = blame | 1323 self.tool.scm().blame = blame |
| 1382 | 1324 |
| 1383 test_port = self._setup_test_port() | 1325 test_port = self._setup_test_port() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1403 self.command.builder_data = builder_data | 1345 self.command.builder_data = builder_data |
| 1404 | 1346 |
| 1405 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 1347 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 1406 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1348 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1407 """) | 1349 """) |
| 1408 | 1350 |
| 1409 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1351 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1410 | 1352 |
| 1411 self.tool.executive = MockLineRemovingExecutive() | 1353 self.tool.executive = MockLineRemovingExecutive() |
| 1412 | 1354 |
| 1413 old_exact_matches = builders._exact_matches | 1355 self.tool.builders = FakeBuilders({ |
| 1356 "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-
specifier"])}, |
| 1357 }) |
| 1358 |
| 1414 old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_
ref | 1359 old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_
ref |
| 1415 try: | 1360 try: |
| 1416 builders._exact_matches = { | |
| 1417 "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["m
ock-specifier"])}, | |
| 1418 } | |
| 1419 | |
| 1420 self.command.tree_status = lambda: 'open' | 1361 self.command.tree_status = lambda: 'open' |
| 1421 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x
: 'auto-rebaseline-alt-temporary-branch' | 1362 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x
: 'auto-rebaseline-alt-temporary-branch' |
| 1422 self._execute_command_with_mock_options() | 1363 self._execute_command_with_mock_options() |
| 1423 self.assertEqual(self.tool.executive.calls, [ | 1364 self.assertEqual(self.tool.executive.calls, [ |
| 1424 ['git', 'cl', 'upload', '-f'], | 1365 ['git', 'cl', 'upload', '-f'], |
| 1425 ['git', 'pull'], | 1366 ['git', 'pull'], |
| 1426 ['git', 'cl', 'land', '-f', '-v'], | 1367 ['git', 'cl', 'land', '-f', '-v'], |
| 1427 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1368 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
| 1428 ]) | 1369 ]) |
| 1429 | 1370 |
| 1430 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1371 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
| 1431 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1372 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1432 """) | 1373 """) |
| 1433 finally: | 1374 finally: |
| 1434 builders._exact_matches = old_exact_matches | |
| 1435 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran
ch_name | 1375 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran
ch_name |
| 1436 | 1376 |
| 1437 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j
son=None, commit_author=None, dry_run=False): | 1377 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j
son=None, commit_author=None, dry_run=False): |
| 1438 def blame(path): | 1378 def blame(path): |
| 1439 return """ | 1379 return """ |
| 1440 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 1380 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 1441 """ | 1381 """ |
| 1442 self.tool.scm().blame = blame | 1382 self.tool.scm().blame = blame |
| 1443 | 1383 |
| 1444 test_port = self._setup_test_port() | 1384 test_port = self._setup_test_port() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1464 self.command.builder_data = builder_data | 1404 self.command.builder_data = builder_data |
| 1465 | 1405 |
| 1466 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 1406 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 1467 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1407 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1468 """) | 1408 """) |
| 1469 | 1409 |
| 1470 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 1410 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 1471 | 1411 |
| 1472 self.tool.executive = MockLineRemovingExecutive() | 1412 self.tool.executive = MockLineRemovingExecutive() |
| 1473 | 1413 |
| 1474 old_exact_matches = builders._exact_matches | 1414 self.tool.builders = FakeBuilders({ |
| 1475 try: | 1415 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 1476 builders._exact_matches = { | 1416 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 1477 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers"
: set(["mock-specifier"])}, | 1417 }) |
| 1478 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers"
: set(["mock-specifier"])}, | |
| 1479 } | |
| 1480 | 1418 |
| 1481 self.command.tree_status = lambda: 'open' | 1419 self.command.tree_status = lambda: 'open' |
| 1482 self._execute_command_with_mock_options(auth_refresh_token_json=auth
_refresh_token_json, | 1420 self._execute_command_with_mock_options(auth_refresh_token_json=auth_ref
resh_token_json, |
| 1483 commit_author=commit_author,
dry_run=dry_run) | 1421 commit_author=commit_author, dry
_run=dry_run) |
| 1484 self.assertEqual(self.tool.executive.calls, expected_executive_calls
) | 1422 self.assertEqual(self.tool.executive.calls, expected_executive_calls) |
| 1485 | 1423 |
| 1486 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | 1424 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. |
| 1487 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1425 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ |
| 1488 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1426 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1489 """) | 1427 """) |
| 1490 finally: | |
| 1491 builders._exact_matches = old_exact_matches | |
| 1492 | 1428 |
| 1493 def test_execute_with_rietveld_auth_refresh_token(self): | 1429 def test_execute_with_rietveld_auth_refresh_token(self): |
| 1494 RIETVELD_REFRESH_TOKEN = '/creds/refresh_tokens/test_rietveld_token' | 1430 RIETVELD_REFRESH_TOKEN = '/creds/refresh_tokens/test_rietveld_token' |
| 1495 self._basic_execute_test( | 1431 self._basic_execute_test( |
| 1496 [ | 1432 [ |
| 1497 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], | 1433 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], |
| 1498 ['git', 'pull'], | 1434 ['git', 'pull'], |
| 1499 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], | 1435 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], |
| 1500 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1436 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
| 1501 ], | 1437 ], |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 oc.capture_output() | 1483 oc.capture_output() |
| 1548 self.command._do_one_rebaseline() | 1484 self.command._do_one_rebaseline() |
| 1549 out, _, _ = oc.restore_output() | 1485 out, _, _ = oc.restore_output() |
| 1550 | 1486 |
| 1551 self.assertEqual(out, 'MOCK STDOUT\n') | 1487 self.assertEqual(out, 'MOCK STDOUT\n') |
| 1552 self.assertEqual(self.tool.executive.calls, [ | 1488 self.assertEqual(self.tool.executive.calls, [ |
| 1553 ['git', 'pull'], | 1489 ['git', 'pull'], |
| 1554 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline', '--verbose'], | 1490 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline', '--verbose'], |
| 1555 ]) | 1491 ]) |
| 1556 self.assertEqual(self._logs, ['MOCK STDOUT']) | 1492 self.assertEqual(self._logs, ['MOCK STDOUT']) |
| OLD | NEW |