Chromium Code Reviews| 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 json | 5 import json |
| 6 import copy | 6 import copy |
| 7 | 7 |
| 8 from webkitpy.common.host_mock import MockHost | 8 from webkitpy.common.host_mock import MockHost |
| 9 from webkitpy.common.net.buildbot import Build | 9 from webkitpy.common.net.buildbot import Build |
| 10 from webkitpy.common.net.buildbot_mock import MockBuildBot | 10 from webkitpy.common.net.buildbot_mock import MockBuildBot |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 updater = WPTExpectationsUpdater(self.mock_host()) | 143 updater = WPTExpectationsUpdater(self.mock_host()) |
| 144 results = { | 144 results = { |
| 145 'fake/test/path.html': { | 145 'fake/test/path.html': { |
| 146 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, | 146 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, |
| 147 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, | 147 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 self.assertEqual(updater.create_line_list(results), []) | 150 self.assertEqual(updater.create_line_list(results), []) |
| 151 | 151 |
| 152 def test_create_line_list_new_tests(self): | 152 def test_create_line_list_new_tests(self): |
| 153 # In this example, there are unexpected non-fail results in w3c tests. | 153 # In this example, there are three unexpected results. The new |
| 154 # test expectation lines are sorted by test, and then specifier. | |
|
jeffcarp
2017/02/17 20:56:38
If this comment is at the beginning of a function,
qyearsley
2017/02/17 23:56:52
I don't personally think so -- in this case (and i
| |
| 154 updater = WPTExpectationsUpdater(self.mock_host()) | 155 updater = WPTExpectationsUpdater(self.mock_host()) |
| 155 results = { | 156 results = { |
| 157 'external/fake/test/zzzz.html': { | |
| 158 'test-mac-mac10.10': {'expected': 'PASS', 'actual': 'FAIL', 'bug ': 'crbug.com/test'}, | |
| 159 }, | |
| 156 'external/fake/test/path.html': { | 160 'external/fake/test/path.html': { |
| 157 'test-linux-trusty': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'}, | 161 'test-linux-trusty': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'}, |
| 158 'test-mac-mac10.10': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'}, | |
| 159 'test-mac-mac10.11': {'expected': 'FAIL', 'actual': 'TIMEOUT', ' bug': 'crbug.com/test'}, | 162 'test-mac-mac10.11': {'expected': 'FAIL', 'actual': 'TIMEOUT', ' bug': 'crbug.com/test'}, |
| 160 } | 163 }, |
| 161 } | 164 } |
| 162 self.assertEqual( | 165 self.assertEqual( |
| 163 updater.create_line_list(results), | 166 updater.create_line_list(results), |
| 164 [ | 167 [ |
| 165 'crbug.com/test [ Linux ] external/fake/test/path.html [ Pass ]' , | 168 'crbug.com/test [ Linux ] external/fake/test/path.html [ Pass ]' , |
| 166 'crbug.com/test [ Mac10.10 ] external/fake/test/path.html [ Pass ]', | |
| 167 'crbug.com/test [ Mac10.11 ] external/fake/test/path.html [ Time out ]', | 169 'crbug.com/test [ Mac10.11 ] external/fake/test/path.html [ Time out ]', |
| 170 'crbug.com/test [ Mac10.10 ] external/fake/test/zzzz.html [ Fail ure ]', | |
|
qyearsley
2017/02/14 21:41:06
Another test added here to assert that added lines
| |
| 168 ]) | 171 ]) |
| 169 | 172 |
| 170 def test_specifier_part(self): | 173 def test_specifier_part(self): |
| 171 updater = WPTExpectationsUpdater(self.mock_host()) | 174 updater = WPTExpectationsUpdater(self.mock_host()) |
| 172 self.assertEqual(updater.specifier_part(['test-mac-mac10.10'], 'x/y.html '), '[ Mac10.10 ]') | 175 self.assertEqual(updater.specifier_part(['test-mac-mac10.10'], 'x/y.html '), '[ Mac10.10 ]') |
| 173 | 176 |
| 174 def test_skipped_specifiers_when_test_is_wontfix(self): | 177 def test_skipped_specifiers_when_test_is_wontfix(self): |
| 175 host = self.mock_host() | 178 host = self.mock_host() |
| 176 expectations_path = '/test.checkout/LayoutTests/NeverFixTests' | 179 expectations_path = '/test.checkout/LayoutTests/NeverFixTests' |
| 177 host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ] ext ernal/wpt/test.html [ WontFix ]\n' | 180 host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ] ext ernal/wpt/test.html [ WontFix ]\n' |
| 178 host.filesystem.files['/test.checkout/LayoutTests/external/wpt/test.html '] = '' | 181 host.filesystem.files['/test.checkout/LayoutTests/external/wpt/test.html '] = '' |
| 179 updater = WPTExpectationsUpdater(host) | 182 updater = WPTExpectationsUpdater(host) |
| 180 self.assertEqual(updater.skipped_specifiers('external/wpt/test.html'), [ 'Trusty']) | 183 self.assertEqual(updater.skipped_specifiers('external/wpt/test.html'), [ 'Trusty']) |
| 181 | 184 |
| 182 def test_simplify_specifiers(self): | 185 def test_simplify_specifiers(self): |
| 183 macros = { | 186 macros = { |
| 184 'mac': ['Mac10.10', 'mac10.11'], | 187 'mac': ['Mac10.10', 'mac10.11'], |
| 185 'win': ['Win7', 'win10'], | 188 'win': ['Win7', 'win10'], |
| 186 'linux': ['Trusty'], | 189 'Linux': ['TRUSTY'], |
|
qyearsley
2017/02/14 21:41:06
Capitalization changed to test the case-insensitiv
| |
| 187 } | 190 } |
| 188 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['mac10.10', 'mac10.11'], macros), ['Mac']) | 191 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['mac10.10', 'mac10.11'], macros), ['Mac']) |
| 189 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty'], macros), ['Linux', 'Mac']) | 192 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty'], macros), ['Linux', 'Mac']) |
| 190 self.assertEqual( | 193 self.assertEqual( |
| 191 WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty', 'Win7', 'Win10'], macros), []) | 194 WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty', 'Win7', 'Win10'], macros), []) |
| 192 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['a', 'b', ' c'], {}), ['A', 'B', 'C']) | 195 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['a', 'b', ' c'], {}), ['A', 'B', 'C']) |
| 196 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac', 'Win ', 'Linux'], macros), []) | |
|
qyearsley
2017/02/14 21:41:06
This line tests the case where all OS types are co
| |
| 193 | 197 |
| 194 def test_merge_dicts_with_conflict_raise_exception(self): | 198 def test_merge_dicts_with_conflict_raise_exception(self): |
| 195 updater = WPTExpectationsUpdater(self.mock_host()) | 199 updater = WPTExpectationsUpdater(self.mock_host()) |
| 196 # Both dicts here have the key "one", and the value is not equal. | 200 # Both dicts here have the key "one", and the value is not equal. |
| 197 with self.assertRaises(ValueError): | 201 with self.assertRaises(ValueError): |
| 198 updater.merge_dicts( | 202 updater.merge_dicts( |
| 199 { | 203 { |
| 200 'external/fake/test/path.html': { | 204 'external/fake/test/path.html': { |
| 201 'one': {'expected': 'FAIL', 'actual': 'PASS'}, | 205 'one': {'expected': 'FAIL', 'actual': 'PASS'}, |
| 202 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT'}, | 206 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT'}, |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 updater.get_issue_number = lambda: '11112222' | 439 updater.get_issue_number = lambda: '11112222' |
| 436 updater.get_try_bots = lambda: ['test-builder-name'] | 440 updater.get_try_bots = lambda: ['test-builder-name'] |
| 437 self.assertEqual(1, updater.run(args=[])) | 441 self.assertEqual(1, updater.run(args=[])) |
| 438 self.assertEqual( | 442 self.assertEqual( |
| 439 host.web.urls_fetched, | 443 host.web.urls_fetched, |
| 440 [ | 444 [ |
| 441 'https://codereview.chromium.org/api/11112222', | 445 'https://codereview.chromium.org/api/11112222', |
| 442 'https://codereview.chromium.org/api/11112222/1' | 446 'https://codereview.chromium.org/api/11112222/1' |
| 443 ]) | 447 ]) |
| 444 self.assertLog(['ERROR: No try job information was collected.\n']) | 448 self.assertLog(['ERROR: No try job information was collected.\n']) |
| OLD | NEW |