| 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 import json | 6 import json |
| 7 | 7 |
| 8 from webkitpy.common.checkout.scm.scm_mock import MockSCM | 8 from webkitpy.common.checkout.scm.scm_mock import MockSCM |
| 9 from webkitpy.common.net.buildbot import Build | 9 from webkitpy.common.net.buildbot import Build |
| 10 from webkitpy.common.net.web_mock import MockWeb | 10 from webkitpy.common.net.web_mock import MockWeb |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 'try_job_results': [ | 27 'try_job_results': [ |
| 28 { | 28 { |
| 29 'builder': 'MOCK Try Win', | 29 'builder': 'MOCK Try Win', |
| 30 'buildnumber': 5000, | 30 'buildnumber': 5000, |
| 31 }, | 31 }, |
| 32 { | 32 { |
| 33 'builder': 'MOCK Mac Try', | 33 'builder': 'MOCK Mac Try', |
| 34 'buildnumber': 4000, | 34 'buildnumber': 4000, |
| 35 }, | 35 }, |
| 36 ], | 36 ], |
| 37 'files': { |
| 38 'third_party/WebKit/LayoutTests/fast/dom/prototype-inheritan
ce.html': {'status': 'M'}, |
| 39 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html
': {'status': 'M'}, |
| 40 }, |
| 37 }), | 41 }), |
| 38 }) | 42 }) |
| 39 self.tool.builders = BuilderList({ | 43 self.tool.builders = BuilderList({ |
| 40 "MOCK Try Win": { | 44 "MOCK Try Win": { |
| 41 "port_name": "test-win-win7", | 45 "port_name": "test-win-win7", |
| 42 "specifiers": ["Win7", "Release"], | 46 "specifiers": ["Win7", "Release"], |
| 43 "is_try_builder": True, | 47 "is_try_builder": True, |
| 44 }, | 48 }, |
| 45 "MOCK Try Mac": { | 49 "MOCK Try Mac": { |
| 46 "port_name": "test-mac-mac10.10", | 50 "port_name": "test-mac-mac10.10", |
| 47 "specifiers": ["Mac10.10", "Release"], | 51 "specifiers": ["Mac10.10", "Release"], |
| 48 "is_try_builder": True, | 52 "is_try_builder": True, |
| 49 }, | 53 }, |
| 50 }) | 54 }) |
| 51 self.git = MockSCM() | 55 self.git = MockSCM() |
| 52 self.git.get_issue_number = lambda: 'None' | 56 self.git.get_issue_number = lambda: 'None' |
| 53 self.command.git = lambda: self.git | 57 self.command.git = lambda: self.git |
| 54 | 58 |
| 55 @staticmethod | 59 @staticmethod |
| 56 def command_options(**kwargs): | 60 def command_options(**kwargs): |
| 57 options = { | 61 options = { |
| 62 'only_changed_tests': False, |
| 63 'dry_run': False, |
| 58 'issue': None, | 64 'issue': None, |
| 59 'dry_run': False, | |
| 60 'optimize': True, | 65 'optimize': True, |
| 66 'results_directory': None, |
| 61 'verbose': False, | 67 'verbose': False, |
| 62 'results_directory': None, | |
| 63 } | 68 } |
| 64 options.update(kwargs) | 69 options.update(kwargs) |
| 65 return optparse.Values(dict(**options)) | 70 return optparse.Values(dict(**options)) |
| 66 | 71 |
| 67 def test_execute_with_issue_number_given(self): | 72 def test_execute_with_issue_number_given(self): |
| 68 oc = OutputCapture() | 73 oc = OutputCapture() |
| 69 try: | 74 try: |
| 70 oc.capture_output() | 75 oc.capture_output() |
| 71 self.command.execute(self.command_options(issue=11112222), [], self.
tool) | 76 self.command.execute(self.command_options(issue=11112222), [], self.
tool) |
| 72 finally: | 77 finally: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 self.assertMultiLineEqual( | 106 self.assertMultiLineEqual( |
| 102 logs, | 107 logs, |
| 103 ('Tests to rebaseline:\n' | 108 ('Tests to rebaseline:\n' |
| 104 ' svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr
.html: MOCK Try Win (5000)\n' | 109 ' svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr
.html: MOCK Try Win (5000)\n' |
| 105 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n' | 110 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n' |
| 106 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n' | 111 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n' |
| 107 'Rebaselining fast/dom/prototype-inheritance.html\n' | 112 'Rebaselining fast/dom/prototype-inheritance.html\n' |
| 108 'Rebaselining fast/dom/prototype-taco.html\n' | 113 'Rebaselining fast/dom/prototype-taco.html\n' |
| 109 'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDev
iation-attr.html\n')) | 114 'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDev
iation-attr.html\n')) |
| 110 | 115 |
| 116 def test_execute_with_only_changed_tests_option(self): |
| 117 oc = OutputCapture() |
| 118 try: |
| 119 oc.capture_output() |
| 120 self.command.execute(self.command_options(issue=11112222, only_chang
ed_tests=True), [], self.tool) |
| 121 finally: |
| 122 _, _, logs = oc.restore_output() |
| 123 # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html |
| 124 # is in the list of failed tests, but not in the list of files modified |
| 125 # in the given CL; it should be included because all_tests is set to Tru
e. |
| 126 self.assertMultiLineEqual( |
| 127 logs, |
| 128 ('Tests to rebaseline:\n' |
| 129 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n' |
| 130 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n' |
| 131 'Rebaselining fast/dom/prototype-inheritance.html\n' |
| 132 'Rebaselining fast/dom/prototype-taco.html\n')) |
| 133 |
| 111 def test_rebaseline_calls(self): | 134 def test_rebaseline_calls(self): |
| 112 """Tests the list of commands that are invoked when rebaseline is called
.""" | 135 """Tests the list of commands that are invoked when rebaseline is called
.""" |
| 113 # First write test contents to the mock filesystem so that | 136 # First write test contents to the mock filesystem so that |
| 114 # fast/dom/prototype-taco.html is considered a real test to rebaseline. | 137 # fast/dom/prototype-taco.html is considered a real test to rebaseline. |
| 115 # TODO(qyearsley): Change this to avoid accessing protected methods. | 138 # TODO(qyearsley): Change this to avoid accessing protected methods. |
| 116 # pylint: disable=protected-access | 139 # pylint: disable=protected-access |
| 117 port = self.tool.port_factory.get('test-win-win7') | 140 port = self.tool.port_factory.get('test-win-win7') |
| 118 self._write( | 141 self._write( |
| 119 port._filesystem.join(port.layout_tests_dir(), 'fast/dom/prototype-t
aco.html'), | 142 port._filesystem.join(port.layout_tests_dir(), 'fast/dom/prototype-t
aco.html'), |
| 120 'test contents') | 143 'test contents') |
| 121 | 144 |
| 122 self.command._rebaseline( | 145 self.command._rebaseline( |
| 123 self.command_options(issue=11112222), | 146 self.command_options(issue=11112222), |
| 124 {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt
", "png"]}}) | 147 {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt
", "png"]}}) |
| 125 | 148 |
| 126 self.assertEqual( | 149 self.assertEqual( |
| 127 self.tool.executive.calls, | 150 self.tool.executive.calls, |
| 128 [ | 151 [ |
| 129 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', | 152 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', |
| 130 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], | 153 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], |
| 131 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', | 154 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', |
| 132 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], | 155 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], |
| 133 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--
suffixes', 'txt', 'fast/dom/prototype-taco.html']] | 156 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--
suffixes', 'txt', 'fast/dom/prototype-taco.html']] |
| 134 ]) | 157 ]) |
| OLD | NEW |