Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: content/test/gpu/gpu_tests/test_expectations_unittest.py

Issue 2632603002: Add support for ASAN-specific test expectations to WebGL tests. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import unittest 4 import unittest
5 5
6 from gpu_tests import test_expectations 6 from gpu_tests import test_expectations
7 7
8 class StubPlatform(object): 8 class StubPlatform(object):
9 def __init__(self, os_name, os_version_name=None): 9 def __init__(self, os_name, os_version_name=None):
10 self.os_name = os_name 10 self.os_name = os_name
(...skipping 26 matching lines...) Expand all
37 def ParseCondition(self, condition): 37 def ParseCondition(self, condition):
38 if condition == 'valid_condition_matched': 38 if condition == 'valid_condition_matched':
39 self.valid_condition_matched = True 39 self.valid_condition_matched = True
40 elif condition == 'valid_condition_unmatched': 40 elif condition == 'valid_condition_unmatched':
41 self.valid_condition_unmatched = True 41 self.valid_condition_unmatched = True
42 else: 42 else:
43 super(SampleExpectationSubclass, self).ParseCondition(condition) 43 super(SampleExpectationSubclass, self).ParseCondition(condition)
44 44
45 45
46 class SampleTestExpectations(test_expectations.TestExpectations): 46 class SampleTestExpectations(test_expectations.TestExpectations):
47 def __init__(self, url_prefixes=None, is_asan=False):
48 super(SampleTestExpectations, self).__init__(
49 url_prefixes=url_prefixes, is_asan=is_asan)
50
47 def CreateExpectation(self, expectation, url_pattern, conditions=None, 51 def CreateExpectation(self, expectation, url_pattern, conditions=None,
48 bug=None): 52 bug=None):
49 return SampleExpectationSubclass(expectation, url_pattern, 53 return SampleExpectationSubclass(expectation, url_pattern,
50 conditions=conditions, bug=bug) 54 conditions=conditions, bug=bug)
51 55
52 def SetExpectations(self): 56 def SetExpectations(self):
53 self.Fail('page1.html', ['win', 'mac'], bug=123) 57 self.Fail('page1.html', ['win', 'mac'], bug=123)
54 self.Fail('page2.html', ['vista'], bug=123) 58 self.Fail('page2.html', ['vista'], bug=123)
55 self.Fail('page3.html', bug=123) 59 self.Fail('page3.html', bug=123)
56 self.Fail('page4.*', bug=123) 60 self.Fail('page4.*', bug=123)
57 self.Fail('Pages.page_6') 61 self.Fail('Pages.page_6')
58 self.Fail('page7.html', ['mountainlion']) 62 self.Fail('page7.html', ['mountainlion'])
59 self.Fail('page8.html', ['mavericks']) 63 self.Fail('page8.html', ['mavericks'])
60 self.Fail('page9.html', ['yosemite']) 64 self.Fail('page9.html', ['yosemite'])
61 # Test browser conditions. 65 # Test browser conditions.
62 self.Fail('page10.html', ['android', 'android-webview-shell'], bug=456) 66 self.Fail('page10.html', ['android', 'android-webview-shell'], bug=456)
63 # Test user defined conditions. 67 # Test user defined conditions.
64 self.Fail('page11.html', ['win', 'valid_condition_matched']) 68 self.Fail('page11.html', ['win', 'valid_condition_matched'])
65 self.Fail('page12.html', ['win', 'valid_condition_unmatched']) 69 self.Fail('page12.html', ['win', 'valid_condition_unmatched'])
66 # Test file:// scheme. 70 # Test file:// scheme.
67 self.Fail('conformance/attribs/page13.html') 71 self.Fail('conformance/attribs/page13.html')
68 # Test file:// scheme on Windows. 72 # Test file:// scheme on Windows.
69 self.Fail('conformance/attribs/page14.html', ['win']) 73 self.Fail('conformance/attribs/page14.html', ['win'])
70 # Explicitly matched paths have precedence over wildcards. 74 # Explicitly matched paths have precedence over wildcards.
71 self.Fail('conformance/glsl/*') 75 self.Fail('conformance/glsl/*')
72 self.Skip('conformance/glsl/page15.html') 76 self.Skip('conformance/glsl/page15.html')
77 # Test ASAN expectations.
78 self.Fail('page16.html', ['mac', 'asan'])
79 self.Fail('page17.html', ['mac', 'no_asan'])
80 # Explicitly specified ASAN expectations should not collide.
81 self.Skip('page18.html', ['mac', 'asan'])
82 self.Fail('page18.html', ['mac', 'no_asan'])
73 83
74 def _ExpectationAppliesToTest( 84 def _ExpectationAppliesToTest(
75 self, expectation, browser, test_url, test_name): 85 self, expectation, browser, test_url, test_name):
76 if not super(SampleTestExpectations, self)._ExpectationAppliesToTest( 86 if not super(SampleTestExpectations, self)._ExpectationAppliesToTest(
77 expectation, browser, test_url, test_name): 87 expectation, browser, test_url, test_name):
78 return False 88 return False
79 # These tests can probably be expressed more tersely, but that 89 # These tests can probably be expressed more tersely, but that
80 # would reduce readability. 90 # would reduce readability.
81 if (not expectation.valid_condition_matched and 91 if (not expectation.valid_condition_matched and
82 not expectation.valid_condition_unmatched): 92 not expectation.valid_condition_unmatched):
83 return True 93 return True
84 return expectation.valid_condition_matched 94 return expectation.valid_condition_matched
85 95
86 class FailingAbsoluteTestExpectations(test_expectations.TestExpectations): 96 class FailingAbsoluteTestExpectations(test_expectations.TestExpectations):
87 def CreateExpectation(self, expectation, url_pattern, conditions=None, 97 def CreateExpectation(self, expectation, url_pattern, conditions=None,
88 bug=None): 98 bug=None):
89 return SampleExpectationSubclass(expectation, url_pattern, 99 return SampleExpectationSubclass(expectation, url_pattern,
90 conditions=conditions, bug=bug) 100 conditions=conditions, bug=bug)
91 101
92 def SetExpectations(self): 102 def SetExpectations(self):
93 self.Fail('http://test.com/page5.html', bug=123) 103 self.Fail('http://test.com/page5.html', bug=123)
94 104
95 class TestExpectationsTest(unittest.TestCase): 105 class TestExpectationsTest(unittest.TestCase):
96 def setUp(self): 106 def setUpHelper(self, is_asan=False):
97 self.expectations = SampleTestExpectations(url_prefixes=[ 107 self.expectations = SampleTestExpectations(url_prefixes=[
98 'third_party/webgl/src/sdk/tests/', 108 'third_party/webgl/src/sdk/tests/',
99 'content/test/data/gpu']) 109 'content/test/data/gpu'], is_asan=is_asan)
110
111 def setUp(self):
112 self.setUpHelper()
100 113
101 def assertExpectationEquals(self, expected, url, platform=StubPlatform(''), 114 def assertExpectationEquals(self, expected, url, platform=StubPlatform(''),
102 browser_type=None): 115 browser_type=None):
103 self.assertExpectationEqualsForName( 116 self.assertExpectationEqualsForName(
104 expected, url, '', platform=platform, browser_type=browser_type) 117 expected, url, '', platform=platform, browser_type=browser_type)
105 118
106 def assertExpectationEqualsForName( 119 def assertExpectationEqualsForName(
107 self, expected, url, name, platform=StubPlatform(''), browser_type=None): 120 self, expected, url, name, platform=StubPlatform(''), browser_type=None):
108 self.expectations.ClearExpectationsCacheForTesting() 121 self.expectations.ClearExpectationsCacheForTesting()
109 result = self.expectations.GetExpectationForTest( 122 result = self.expectations.GetExpectationForTest(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 self.assertExpectationEqualsForName( 243 self.assertExpectationEqualsForName(
231 'skip', 244 'skip',
232 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\page15.html', 245 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\page15.html',
233 'Page15', 246 'Page15',
234 StubPlatform('win')) 247 StubPlatform('win'))
235 self.assertExpectationEqualsForName( 248 self.assertExpectationEqualsForName(
236 'fail', 249 'fail',
237 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\foo.html', 250 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\foo.html',
238 'Foo', 251 'Foo',
239 StubPlatform('win')) 252 StubPlatform('win'))
253
254 def testCaseInsensitivity(self):
255 url = 'http://test.com/page1.html'
256 self.assertExpectationEquals('fail', url, StubPlatform('Win'))
257 url = 'http://test.com/page2.html'
258 self.assertExpectationEquals('fail', url, StubPlatform('Win', 'Vista'))
259 url = 'http://test.com/page10.html'
260 self.assertExpectationEquals('fail', url, StubPlatform('android'),
261 browser_type='Android-Webview-Shell')
262
263 def testASANExpectations(self):
264 url16 = 'page16.html'
265 url18 = 'page18.html'
266 self.assertExpectationEquals('pass', url16, StubPlatform('mac'))
267 self.assertExpectationEquals('fail', url18, StubPlatform('mac'))
268 self.setUpHelper(is_asan=True)
269 self.assertExpectationEquals('fail', url16, StubPlatform('mac'))
270 self.assertExpectationEquals('skip', url18, StubPlatform('mac'))
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/test_expectations.py ('k') | content/test/gpu/gpu_tests/webgl2_conformance_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698