| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import optparse | 5 import optparse |
| 6 | 6 |
| 7 from webkitpy.common.net.buildbot import Build | 7 from webkitpy.common.net.buildbot import Build |
| 8 from webkitpy.common.net.layout_test_results import LayoutTestResults | 8 from webkitpy.common.net.layout_test_results import LayoutTestResults |
| 9 from webkitpy.common.system.executive_mock import MockExecutive | 9 from webkitpy.common.system.executive_mock import MockExecutive |
| 10 from webkitpy.layout_tests.builder_list import BuilderList | 10 from webkitpy.layout_tests.builder_list import BuilderList |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 super(TestAutoRebaseline, self).setUp() | 37 super(TestAutoRebaseline, self).setUp() |
| 38 self.tool.builders = BuilderList({ | 38 self.tool.builders = BuilderList({ |
| 39 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, | 39 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, |
| 40 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": ["
Mac10.11", "Release"]}, | 40 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": ["
Mac10.11", "Release"]}, |
| 41 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": ["
Precise", "Release"]}, | 41 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": ["
Precise", "Release"]}, |
| 42 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Tr
usty", "Release"]}, | 42 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": ["Tr
usty", "Release"]}, |
| 43 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, | 43 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, |
| 44 "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Wi
n7", "Debug"]}, | 44 "MOCK Win7 (dbg)": {"port_name": "test-win-win7", "specifiers": ["Wi
n7", "Debug"]}, |
| 45 }) | 45 }) |
| 46 self.command.latest_revision_processed_on_all_bots = lambda: 9000 | 46 self.command.latest_revision_processed_on_all_bots = lambda: 9000 |
| 47 self.command.bot_revision_data = lambda scm: [{"builder": "MOCK Win7", "
revision": "9000"}] | 47 self.command.bot_revision_data = lambda git: [{"builder": "MOCK Win7", "
revision": "9000"}] |
| 48 | 48 |
| 49 def test_release_builders(self): | 49 def test_release_builders(self): |
| 50 # Testing private method - pylint: disable=protected-access | 50 # Testing private method - pylint: disable=protected-access |
| 51 self.tool.builders = BuilderList({ | 51 self.tool.builders = BuilderList({ |
| 52 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, | 52 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": ["
Mac10.10", "Release"]}, |
| 53 "MOCK Mac10.11 (dbg)": {"port_name": "test-mac-mac10.11", "specifier
s": ["Mac10.11", "Debug"]}, | 53 "MOCK Mac10.11 (dbg)": {"port_name": "test-mac-mac10.11", "specifier
s": ["Mac10.11", "Debug"]}, |
| 54 }) | 54 }) |
| 55 self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10']) | 55 self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10']) |
| 56 | 56 |
| 57 def test_tests_to_rebaseline(self): | 57 def test_tests_to_rebaseline(self): |
| 58 def blame(_): | 58 def blame(_): |
| 59 return """ | 59 return """ |
| 60 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] | 60 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] |
| 61 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 ] | 61 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 ] |
| 62 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 ] | 62 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 ] |
| 63 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 ] | 63 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 ] |
| 64 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 ] | 64 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 ] |
| 65 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 ] | 65 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 ] |
| 66 624caaaaaa path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots
.html [ NeedsRebaseline ] | 66 624caaaaaa path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots
.html [ NeedsRebaseline ] |
| 67 0000000000 path/to/TestExpectations (<foo@chromium.org@@bbb929
c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com
/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] | 67 0000000000 path/to/TestExpectations (<foo@chromium.org@@bbb929
c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com
/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] |
| 68 """ | 68 """ |
| 69 self.tool.scm().blame = blame | 69 self.tool.git().blame = blame |
| 70 | 70 |
| 71 min_revision = 9000 | 71 min_revision = 9000 |
| 72 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( | 72 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( |
| 73 set(['path/to/rebaseline-without-bug-number.html', | 73 set(['path/to/rebaseline-without-bug-number.html', |
| 74 'path/to/rebaseline-with-modifiers.html', 'path/to/rebaseline-w
ithout-modifiers.html']), | 74 'path/to/rebaseline-with-modifiers.html', 'path/to/rebaseline-w
ithout-modifiers.html']), |
| 75 5678, | 75 5678, |
| 76 '624c3081c0', | 76 '624c3081c0', |
| 77 'foobarbaz1@chromium.org', | 77 'foobarbaz1@chromium.org', |
| 78 set(['24182', '234']), | 78 set(['24182', '234']), |
| 79 True)) | 79 True)) |
| 80 | 80 |
| 81 def test_tests_to_rebaseline_over_limit(self): | 81 def test_tests_to_rebaseline_over_limit(self): |
| 82 def blame(_): | 82 def blame(_): |
| 83 result = "" | 83 result = "" |
| 84 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): | 84 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): |
| 85 result += ("624c3081c0 path/to/TestExpectations
" | 85 result += ("624c3081c0 path/to/TestExpectations
" |
| 86 "(<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000
13) " | 86 "(<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000
13) " |
| 87 "crbug.com/24182 path/to/rebaseline-%s.html [ NeedsRe
baseline ]\n" % i) | 87 "crbug.com/24182 path/to/rebaseline-%s.html [ NeedsRe
baseline ]\n" % i) |
| 88 return result | 88 return result |
| 89 self.tool.scm().blame = blame | 89 self.tool.git().blame = blame |
| 90 | 90 |
| 91 expected_list_of_tests = [] | 91 expected_list_of_tests = [] |
| 92 for i in range(0, self.command.MAX_LINES_TO_REBASELINE): | 92 for i in range(0, self.command.MAX_LINES_TO_REBASELINE): |
| 93 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) | 93 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) |
| 94 | 94 |
| 95 min_revision = 9000 | 95 min_revision = 9000 |
| 96 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( | 96 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( |
| 97 set(expected_list_of_tests), | 97 set(expected_list_of_tests), |
| 98 5678, | 98 5678, |
| 99 '624c3081c0', | 99 '624c3081c0', |
| (...skipping 26 matching lines...) Expand all Loading... |
| 126 'Build: https://build.chromium.org/p/my.master/builders
/b/builds/123\n\n' | 126 'Build: https://build.chromium.org/p/my.master/builders
/b/builds/123\n\n' |
| 127 'https://chromium.googlesource.com/chromium/src/+/abcd5
67\n\n' | 127 'https://chromium.googlesource.com/chromium/src/+/abcd5
67\n\n' |
| 128 'BUG=234,345\n' | 128 'BUG=234,345\n' |
| 129 'TBR=foo@chromium.org\n') | 129 'TBR=foo@chromium.org\n') |
| 130 | 130 |
| 131 def test_no_needs_rebaseline_lines(self): | 131 def test_no_needs_rebaseline_lines(self): |
| 132 def blame(_): | 132 def blame(_): |
| 133 return """ | 133 return """ |
| 134 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] | 134 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] |
| 135 """ | 135 """ |
| 136 self.tool.scm().blame = blame | 136 self.tool.git().blame = blame |
| 137 | 137 |
| 138 self._execute_with_mock_options() | 138 self._execute_with_mock_options() |
| 139 self.assertEqual(self.tool.executive.calls, []) | 139 self.assertEqual(self.tool.executive.calls, []) |
| 140 | 140 |
| 141 def test_execute(self): | 141 def test_execute(self): |
| 142 def blame(_): | 142 def blame(_): |
| 143 return """ | 143 return """ |
| 144 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn
't bork parsing. | 144 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn
't bork parsing. |
| 145 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] | 145 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.
html [ Failure ] |
| 146 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 146 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 147 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Mac10.11 ] fast/dom/prototype
-strawberry.html [ NeedsRebaseline ] | 147 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Mac10.11 ] fast/dom/prototype
-strawberry.html [ NeedsRebaseline ] |
| 148 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.ht
ml [ NeedsRebaseline ] | 148 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.ht
ml [ NeedsRebaseline ] |
| 149 624caaaaaa path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots
.html [ NeedsRebaseline ] | 149 624caaaaaa path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots
.html [ NeedsRebaseline ] |
| 150 0000000000 path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.h
tml [ NeedsRebaseline ] | 150 0000000000 path/to/TestExpectations (<foo@chromium.org>
2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.h
tml [ NeedsRebaseline ] |
| 151 """ | 151 """ |
| 152 self.tool.scm().blame = blame | 152 self.tool.git().blame = blame |
| 153 | 153 |
| 154 test_port = self.tool.port_factory.get('test') | 154 test_port = self.tool.port_factory.get('test') |
| 155 | 155 |
| 156 # Have prototype-chocolate only fail on "MOCK Mac10.11", | 156 # Have prototype-chocolate only fail on "MOCK Mac10.11", |
| 157 # and pass on "Mock Mac10.10". | 157 # and pass on "Mock Mac10.10". |
| 158 self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults
({ | 158 self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults
({ |
| 159 "tests": { | 159 "tests": { |
| 160 "fast": { | 160 "fast": { |
| 161 "dom": { | 161 "dom": { |
| 162 "prototype-taco.html": { | 162 "prototype-taco.html": { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 crbug.com/24182 [ Linux Win ] fast/dom/prototype-chocolate.html [ NeedsRebaselin
e ] | 259 crbug.com/24182 [ Linux Win ] fast/dom/prototype-chocolate.html [ NeedsRebaselin
e ] |
| 260 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] | 260 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] |
| 261 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] | 261 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] |
| 262 """) | 262 """) |
| 263 | 263 |
| 264 def test_execute_git_cl_hangs(self): | 264 def test_execute_git_cl_hangs(self): |
| 265 def blame(_): | 265 def blame(_): |
| 266 return """ | 266 return """ |
| 267 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 267 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 268 """ | 268 """ |
| 269 self.tool.scm().blame = blame | 269 self.tool.git().blame = blame |
| 270 | 270 |
| 271 test_port = self.tool.port_factory.get('test') | 271 test_port = self.tool.port_factory.get('test') |
| 272 | 272 |
| 273 # Have prototype-chocolate only fail on "MOCK Mac10.11". | 273 # Have prototype-chocolate only fail on "MOCK Mac10.11". |
| 274 self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults
({ | 274 self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults
({ |
| 275 "tests": { | 275 "tests": { |
| 276 "fast": { | 276 "fast": { |
| 277 "dom": { | 277 "dom": { |
| 278 "prototype-taco.html": { | 278 "prototype-taco.html": { |
| 279 "expected": "PASS", | 279 "expected": "PASS", |
| (...skipping 28 matching lines...) Expand all Loading... |
| 308 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.h
tml']], | 308 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.h
tml']], |
| 309 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', 'fast
/dom/prototype-taco.html']], | 309 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', 'fast
/dom/prototype-taco.html']], |
| 310 ['git', 'cl', 'upload', '-f'], | 310 ['git', 'cl', 'upload', '-f'], |
| 311 ]) | 311 ]) |
| 312 | 312 |
| 313 def test_execute_test_passes_everywhere(self): | 313 def test_execute_test_passes_everywhere(self): |
| 314 def blame(_): | 314 def blame(_): |
| 315 return """ | 315 return """ |
| 316 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 316 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 317 """ | 317 """ |
| 318 self.tool.scm().blame = blame | 318 self.tool.git().blame = blame |
| 319 | 319 |
| 320 test_port = self.tool.port_factory.get('test') | 320 test_port = self.tool.port_factory.get('test') |
| 321 | 321 |
| 322 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: | 322 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: |
| 323 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ | 323 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ |
| 324 "tests": { | 324 "tests": { |
| 325 "fast": { | 325 "fast": { |
| 326 "dom": { | 326 "dom": { |
| 327 "prototype-taco.html": { | 327 "prototype-taco.html": { |
| 328 "expected": "FAIL", | 328 "expected": "FAIL", |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. | 360 # The mac ports should both be removed since they're the only ones in bu
ilders._exact_matches. |
| 361 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ | 361 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g
eneric_test_expectations_file()), """ |
| 362 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 362 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 363 """) | 363 """) |
| 364 | 364 |
| 365 def test_execute_use_alternate_rebaseline_branch(self): | 365 def test_execute_use_alternate_rebaseline_branch(self): |
| 366 def blame(_): | 366 def blame(_): |
| 367 return """ | 367 return """ |
| 368 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 368 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 369 """ | 369 """ |
| 370 self.tool.scm().blame = blame | 370 self.tool.git().blame = blame |
| 371 | 371 |
| 372 test_port = self.tool.port_factory.get('test') | 372 test_port = self.tool.port_factory.get('test') |
| 373 | 373 |
| 374 self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ | 374 self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ |
| 375 "tests": { | 375 "tests": { |
| 376 "fast": { | 376 "fast": { |
| 377 "dom": { | 377 "dom": { |
| 378 "prototype-taco.html": { | 378 "prototype-taco.html": { |
| 379 "expected": "FAIL", | 379 "expected": "FAIL", |
| 380 "actual": "PASS", | 380 "actual": "PASS", |
| 381 "is_unexpected": True | 381 "is_unexpected": True |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 })) | 386 })) |
| 387 | 387 |
| 388 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 388 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 389 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 389 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 390 """) | 390 """) |
| 391 | 391 |
| 392 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 392 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 393 | 393 |
| 394 self.tool.executive = MockLineRemovingExecutive() | 394 self.tool.executive = MockLineRemovingExecutive() |
| 395 | 395 |
| 396 self.tool.builders = BuilderList({ | 396 self.tool.builders = BuilderList({ |
| 397 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, | 397 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, |
| 398 }) | 398 }) |
| 399 old_branch_name = self.tool.scm().current_branch_or_ref | 399 old_branch_name = self.tool.git().current_branch_or_ref |
| 400 try: | 400 try: |
| 401 self.command.tree_status = lambda: 'open' | 401 self.command.tree_status = lambda: 'open' |
| 402 self.tool.scm().current_branch_or_ref = lambda: 'auto-rebaseline-tem
porary-branch' | 402 self.tool.git().current_branch_or_ref = lambda: 'auto-rebaseline-tem
porary-branch' |
| 403 self._execute_with_mock_options() | 403 self._execute_with_mock_options() |
| 404 self.assertEqual(self.tool.executive.calls, [ | 404 self.assertEqual(self.tool.executive.calls, [ |
| 405 ['git', 'cl', 'upload', '-f'], | 405 ['git', 'cl', 'upload', '-f'], |
| 406 ['git', 'pull'], | 406 ['git', 'pull'], |
| 407 ['git', 'cl', 'land', '-f', '-v'], | 407 ['git', 'cl', 'land', '-f', '-v'], |
| 408 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r
ietveldissue'], | 408 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r
ietveldissue'], |
| 409 ['git', 'cl', 'set_close'], | 409 ['git', 'cl', 'set_close'], |
| 410 ]) | 410 ]) |
| 411 | 411 |
| 412 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 412 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
| 413 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 413 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 414 """) | 414 """) |
| 415 finally: | 415 finally: |
| 416 self.tool.scm().current_branch_or_ref = old_branch_name | 416 self.tool.git().current_branch_or_ref = old_branch_name |
| 417 | 417 |
| 418 def test_execute_stuck_on_alternate_rebaseline_branch(self): | 418 def test_execute_stuck_on_alternate_rebaseline_branch(self): |
| 419 def blame(_): | 419 def blame(_): |
| 420 return """ | 420 return """ |
| 421 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 421 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 422 """ | 422 """ |
| 423 self.tool.scm().blame = blame | 423 self.tool.git().blame = blame |
| 424 | 424 |
| 425 test_port = self.tool.port_factory.get('test') | 425 test_port = self.tool.port_factory.get('test') |
| 426 | 426 |
| 427 self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ | 427 self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({ |
| 428 "tests": { | 428 "tests": { |
| 429 "fast": { | 429 "fast": { |
| 430 "dom": { | 430 "dom": { |
| 431 "prototype-taco.html": { | 431 "prototype-taco.html": { |
| 432 "expected": "FAIL", | 432 "expected": "FAIL", |
| 433 "actual": "PASS", | 433 "actual": "PASS", |
| 434 "is_unexpected": True | 434 "is_unexpected": True |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 })) | 439 })) |
| 440 | 440 |
| 441 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ | 441 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe
ctations_file(), """ |
| 442 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] | 442 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 443 """) | 443 """) |
| 444 | 444 |
| 445 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") | 445 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy
test contents") |
| 446 | 446 |
| 447 self.tool.executive = MockLineRemovingExecutive() | 447 self.tool.executive = MockLineRemovingExecutive() |
| 448 | 448 |
| 449 self.tool.builders = BuilderList({ | 449 self.tool.builders = BuilderList({ |
| 450 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, | 450 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": ["Win7", "
Release"]}, |
| 451 }) | 451 }) |
| 452 old_branch_name = self.tool.scm().current_branch_or_ref | 452 old_branch_name = self.tool.git().current_branch_or_ref |
| 453 try: | 453 try: |
| 454 self.command.tree_status = lambda: 'open' | 454 self.command.tree_status = lambda: 'open' |
| 455 self.tool.scm().current_branch_or_ref = lambda: 'auto-rebaseline-alt
-temporary-branch' | 455 self.tool.git().current_branch_or_ref = lambda: 'auto-rebaseline-alt
-temporary-branch' |
| 456 self._execute_with_mock_options() | 456 self._execute_with_mock_options() |
| 457 self.assertEqual(self.tool.executive.calls, [ | 457 self.assertEqual(self.tool.executive.calls, [ |
| 458 ['git', 'cl', 'upload', '-f'], | 458 ['git', 'cl', 'upload', '-f'], |
| 459 ['git', 'pull'], | 459 ['git', 'pull'], |
| 460 ['git', 'cl', 'land', '-f', '-v'], | 460 ['git', 'cl', 'land', '-f', '-v'], |
| 461 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 461 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
| 462 ['git', 'cl', 'set_close'], | 462 ['git', 'cl', 'set_close'], |
| 463 ]) | 463 ]) |
| 464 | 464 |
| 465 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 465 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
| 466 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 466 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 467 """) | 467 """) |
| 468 finally: | 468 finally: |
| 469 self.tool.scm().current_branch_or_ref = old_branch_name | 469 self.tool.git().current_branch_or_ref = old_branch_name |
| 470 | 470 |
| 471 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j
son=None, commit_author=None, dry_run=False): | 471 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j
son=None, commit_author=None, dry_run=False): |
| 472 def blame(_): | 472 def blame(_): |
| 473 return """ | 473 return """ |
| 474 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] | 474 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org>
2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe
baseline ] |
| 475 """ | 475 """ |
| 476 self.tool.scm().blame = blame | 476 self.tool.git().blame = blame |
| 477 | 477 |
| 478 test_port = self.tool.port_factory.get('test') | 478 test_port = self.tool.port_factory.get('test') |
| 479 | 479 |
| 480 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: | 480 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: |
| 481 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ | 481 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ |
| 482 "tests": { | 482 "tests": { |
| 483 "fast": { | 483 "fast": { |
| 484 "dom": { | 484 "dom": { |
| 485 "prototype-taco.html": { | 485 "prototype-taco.html": { |
| 486 "expected": "FAIL", | 486 "expected": "FAIL", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', rietv
eld_refresh_token], | 522 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', rietv
eld_refresh_token], |
| 523 ['git', 'pull'], | 523 ['git', 'pull'], |
| 524 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', r
ietveld_refresh_token], | 524 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', r
ietveld_refresh_token], |
| 525 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 525 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
| 526 ['git', 'cl', 'set_close', '--auth-refresh-token-json', rietveld
_refresh_token], | 526 ['git', 'cl', 'set_close', '--auth-refresh-token-json', rietveld
_refresh_token], |
| 527 ], | 527 ], |
| 528 auth_refresh_token_json=rietveld_refresh_token) | 528 auth_refresh_token_json=rietveld_refresh_token) |
| 529 | 529 |
| 530 def test_execute_with_dry_run(self): | 530 def test_execute_with_dry_run(self): |
| 531 self._basic_execute_test([], dry_run=True) | 531 self._basic_execute_test([], dry_run=True) |
| 532 self.assertEqual(self.tool.scm().local_commits(), []) | 532 self.assertEqual(self.tool.git().local_commits(), []) |
| 533 | 533 |
| 534 def test_bot_revision_data(self): | 534 def test_bot_revision_data(self): |
| 535 self._setup_mock_build_data() | 535 self._setup_mock_build_data() |
| 536 self.assertEqual( | 536 self.assertEqual( |
| 537 self.command.bot_revision_data(self.tool.scm()), | 537 self.command.bot_revision_data(self.tool.git()), |
| 538 [{'builder': 'MOCK Win7', 'revision': '9000'}]) | 538 [{'builder': 'MOCK Win7', 'revision': '9000'}]) |
| OLD | NEW |