Skip to content

Commit a617a14

Browse files
wangxianzhuCommit Bot
authored and
Commit Bot
committed
Let virtual tests also inherit [ Skip ] if no override
This followups crrev.com/c/2173656 which let virtual tests inherit base tests' expectations except for [ Skip ]. This CL also allows inheritance of [ Skip ]. In less common cases, we intentionally skip some base tests which is only meaningful to run with specific flags in virtual tests. In these cases we need to override the [ Skip ] with [ Pass ], like: (In NeverFixTests) # This test run under virtual suites only. crbug.com/981970 external/wpt/fetch/http-cache/split-cache.tentative.html [ Skip ] virtual/not-split-http-cache/external/wpt/fetch/http-cache/split-cache.tentative.html [ Pass ] virtual/split-http-cache/external/wpt/fetch/http-cache/split-cache.tentative.html [ Pass ] Bug: 1072015 Change-Id: Ie6c5b5472203bd81120dd2c3589a89d9df6fa45b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2178173 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Rakib Hasan <rmhasan@google.com> Reviewed-by: Robert Ma <robertma@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Cr-Commit-Position: refs/heads/master@{#766598}
1 parent d7be689 commit a617a14

12 files changed

+225
-383
lines changed

docs/testing/web_tests.md

+7
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ Consider the following when choosing between them:
322322
in the suite or `virtual/blocking_repaint/fast/repaint/dir` to run real
323323
or virtual tests in the suite under a specific directory.
324324

325+
*** note
326+
We can run a virtual test with additional flags. Both the virtual args and the
327+
additional flags will be applied. The fallback order of baselines and
328+
expectations will be: 1) flag-specific virtual, 2) non-flag-specific virtual,
329+
3) flag-specific base, 4) non-flag-specific base
330+
***
331+
325332
## Tracking Test Failures
326333

327334
All bugs, associated with web test failures must have the

third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py

+53-4
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,10 @@ def _check_expectations_file_content(content):
159159
return failures
160160

161161

162-
def _check_expectations(host, port, path, test_expectations):
162+
def _check_directory_glob(host, port, path, expectations):
163163
failures = []
164-
for exp in test_expectations.get_updated_lines(path):
165-
if (exp.is_glob or not exp.to_string().strip()
166-
or exp.to_string().strip().startswith('#')):
164+
for exp in expectations:
165+
if not exp.test or exp.is_glob:
167166
continue
168167

169168
test_name, _ = port.split_webdriver_test_name(exp.test)
@@ -183,6 +182,56 @@ def _check_expectations(host, port, path, test_expectations):
183182
return failures
184183

185184

185+
def _check_redundant_virtual_expectations(host, port, path, expectations):
186+
# FlagExpectations are not checked because something like the following in
187+
# a flag-specific expectations file looks redundant but is needed to
188+
# override the virtual expectations in TestExpectations. For example, in
189+
# the main TestExpectations:
190+
# foo/bar/test.html [ Failure ]
191+
# virtual/suite/foo/bar/test.html [ Timeout ]
192+
# and in a flag expectation file, we want to override both to [ Crash ]:
193+
# foo/bar/test.html [ Crash ]
194+
# virtual/suite/foo/bar/test.html [ Crash ]
195+
if 'FlagExpectations' in path:
196+
return []
197+
198+
failures = []
199+
expectations_by_test = {}
200+
for exp in expectations:
201+
if exp.test:
202+
expectations_by_test.setdefault(exp.test, []).append(exp)
203+
204+
for exp in expectations:
205+
if not exp.test:
206+
continue
207+
208+
base_test = port.lookup_virtual_test_base(exp.test)
209+
if not base_test:
210+
continue
211+
212+
for base_exp in expectations_by_test.get(base_test, []):
213+
if (base_exp.results == exp.results
214+
and base_exp.is_slow_test == exp.is_slow_test
215+
and base_exp.tags.issubset(exp.tags)):
216+
error = "{}:{} Expectation '{}' is redundant with '{}' in line {}".format(
217+
host.filesystem.basename(path), exp.lineno, exp.test,
218+
base_test, base_exp.lineno)
219+
_log.error(error)
220+
failures.append(error)
221+
222+
return failures
223+
224+
225+
def _check_expectations(host, port, path, test_expectations):
226+
# Check for original expectation lines (from get_updated_lines) instead of
227+
# expectations filtered for the current port (test_expectations).
228+
expectations = test_expectations.get_updated_lines(path)
229+
failures = _check_directory_glob(host, port, path, expectations)
230+
failures.extend(
231+
_check_redundant_virtual_expectations(host, port, path, expectations))
232+
return failures
233+
234+
186235
def check_virtual_test_suites(host, options):
187236
port = host.port_factory.get(options=options)
188237
fs = host.filesystem

third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py

+32
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,38 @@ def test_lint_globs(self):
245245
all_logs = ''.join(self.logMessages())
246246
self.assertIn('directory', all_logs)
247247

248+
def test_virtual_test_redundant_expectation(self):
249+
options = optparse.Values({
250+
'additional_expectations': [],
251+
'platform': 'test',
252+
'debug_rwt_logging': False
253+
})
254+
host = MockHost()
255+
256+
port = host.port_factory.get(options.platform, options=options)
257+
port.virtual_test_suites = lambda: [
258+
VirtualTestSuite(prefix='foo', bases=['test'], args=['--foo'])
259+
]
260+
test_expectations = (
261+
'# tags: [ mac win ]\n'
262+
'# tags: [ debug release ]\n'
263+
'# results: [ Failure Pass ]\n'
264+
'[ mac ] test/test1.html [ Failure ]\n'
265+
'[ mac debug ] virtual/foo/test/test1.html [ Failure ]\n'
266+
'[ win ] virtual/foo/test/test1.html [ Failure ]\n'
267+
'[ mac release ] virtual/foo/test/test1.html [ Pass ]\n')
268+
port.expectations_dict = lambda: {
269+
'testexpectations': test_expectations
270+
}
271+
272+
host.port_factory.get = lambda platform, options=None: port
273+
host.port_factory.all_port_names = lambda platform=None: [port.name()]
274+
275+
res = lint_test_expectations.lint(host, options)
276+
277+
self.assertEquals(len(res), 1)
278+
self.assertIn('redundant', res[0])
279+
248280

249281
class CheckVirtualSuiteTest(unittest.TestCase):
250282
def setUp(self):

third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -340,18 +340,8 @@ def get_expectations(self, test, fallback_for_test=None):
340340
fallback_for_test))
341341
base_test = self.port.lookup_virtual_test_base(test)
342342
if base_test:
343-
base_expectations = self.get_expectations(base_test, test)
344-
if ResultType.Skip in base_expectations.results:
345-
# TODO(crbug.com/1072015#c9): Temporarily remove Skip from the
346-
# inherited expectations to avoid unexpected Skip.
347-
base_expectations = typ_types.Expectation(
348-
test=base_expectations.test,
349-
results=base_expectations.results - set([ResultType.Skip]),
350-
is_slow_test=base_expectations.is_slow_test,
351-
reason=base_expectations.reason,
352-
trailing_comments=base_expectations.trailing_comments)
353343
return self._override_or_fallback_expectations(
354-
expectations, base_expectations)
344+
expectations, self.get_expectations(base_test, test))
355345
return expectations
356346

357347
def get_flag_expectations(self, test):

third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_virtual_expectations(self):
127127
'virtual/virtual_failures/failures/expected/crash.html',
128128
ResultType.Crash)
129129
self.assert_exp('virtual/virtual_passes/passes/image.html',
130-
ResultType.Pass)
130+
ResultType.Skip)
131131
# Non existence virtual suite doesn't fallback.
132132
self.assert_exp('virtual/xyz/failures/expected/crash.html',
133133
ResultType.Pass)

third_party/blink/tools/blinkpy/web_tests/port/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,8 @@ def _wpt_test_urls_matching_paths(self, filter_paths, virtual_prefixes=[]):
19741974
return tests
19751975

19761976
def _lookup_virtual_suite(self, test_name):
1977+
if not test_name.startswith('virtual/'):
1978+
return None
19771979
for suite in self.virtual_test_suites():
19781980
if test_name.startswith(suite.full_prefix):
19791981
return suite

third_party/blink/tools/blinkpy/web_tests/port/test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ def __getitem__(self, item):
137137
#
138138
TOTAL_TESTS = 171
139139
TOTAL_WONTFIX = 3
140-
TOTAL_SKIPS = 23 + TOTAL_WONTFIX
140+
TOTAL_SKIPS = 26 + TOTAL_WONTFIX
141141
TOTAL_CRASHES = 78
142142

143143
UNEXPECTED_PASSES = 2
144144
UNEXPECTED_NON_VIRTUAL_FAILURES = 34
145-
UNEXPECTED_FAILURES = 68
145+
UNEXPECTED_FAILURES = 67
146146

147147

148148
def unit_test_list():

third_party/blink/web_tests/MSANExpectations

-20
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ crbug.com/856601 [ Linux ] external/wpt/IndexedDB/idlharness.https.any.servicewo
115115
crbug.com/856601 [ Linux ] external/wpt/IndexedDB/interfaces.any.html [ Pass Timeout ]
116116
crbug.com/856601 [ Linux ] external/wpt/appmanifest/idlharness.window.html [ Skip ]
117117
crbug.com/856601 [ Linux ] external/wpt/bluetooth/idl/idlharness.tentative.window.html [ Skip ]
118-
crbug.com/856601 [ Linux ] virtual/web-bluetooth-new-permissions-backend/external/wpt/bluetooth/idl/idlharness.tentative.https.window.html [ Skip ]
119118
crbug.com/856601 [ Linux ] external/wpt/cookie-store/idlharness.tentative.https.html [ Skip ]
120119
crbug.com/856601 [ Linux ] external/wpt/css/css-animations/idlharness.html [ Skip ]
121120
crbug.com/856601 [ Linux ] external/wpt/css/css-font-loading/idlharness.https.html [ Skip ]
@@ -159,7 +158,6 @@ crbug.com/856601 [ Linux ] external/wpt/touch-events/idlharness.window.html [ Sk
159158
crbug.com/856601 [ Linux ] external/wpt/screen-wake-lock/idlharness.https.window.html [ Skip ]
160159
crbug.com/856601 [ Linux ] external/wpt/webstorage/idlharness.window.html [ Skip ]
161160
crbug.com/856601 [ Linux ] virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaDevices-IDL-enumerateDevices.html [ Pass Timeout ]
162-
crbug.com/856601 [ Linux ] virtual/feature-policy-permissions/external/wpt/mediacapture-streams/idlharness.https.window.html [ Skip ]
163161
crbug.com/856601 [ Linux ] external/wpt/fetch/api/idl.any.sharedworker.html [ Pass Timeout ]
164162
crbug.com/856601 [ Linux ] external/wpt/fetch/cors-rfc1918/idlharness.tentative.https.any.serviceworker.html [ Skip ]
165163
crbug.com/856601 [ Linux ] external/wpt/media-capabilities/idlharness.any.html [ Skip ]
@@ -172,7 +170,6 @@ crbug.com/856601 [ Linux ] external/wpt/media-source/idlharness.any.html [ Skip
172170
crbug.com/856601 [ Linux ] external/wpt/page-visibility/idlharness.window.html [ Skip ]
173171
crbug.com/856601 [ Linux ] external/wpt/css/filter-effects/interfaces.any.html [ Timeout Pass ]
174172
crbug.com/856601 [ Linux ] external/wpt/webxr/idlharness.https.window.html [ Skip ]
175-
crbug.com/856601 [ Linux ] virtual/webrtc-wpt-plan-b/external/wpt/webrtc/idlharness.https.window.html [ Skip ]
176173
crbug.com/856601 [ Linux ] fast/js/toString-stack-overflow.html [ Pass Timeout ]
177174
crbug.com/856601 [ Linux ] external/wpt/css/css-masking/idlharness.html [ Skip ]
178175
crbug.com/856601 [ Linux ] external/wpt/css/css-transitions/idlharness.html [ Skip ]
@@ -226,9 +223,6 @@ crbug.com/856601 [ Linux ] external/wpt/fullscreen/idlharness.window.html [ Skip
226223
crbug.com/856601 [ Linux ] external/wpt/payment-handler/idlharness.https.any.html [ Skip ]
227224
crbug.com/856601 [ Linux ] external/wpt/payment-handler/idlharness.https.any.serviceworker.html [ Skip ]
228225
crbug.com/856601 [ Linux ] external/wpt/payment-request/idlharness.https.window.html [ Skip ]
229-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/resource-timing/idlharness.any.html [ Skip ]
230-
crbug.com/856601 [ Linux ] virtual/speech-with-unified-autoplay/external/wpt/speech-api/idlharness.window.html [ Skip ]
231-
crbug.com/856601 [ Linux ] virtual/unified-autoplay/external/wpt/feature-policy/idlharness.window.html [ Skip ]
232226

233227
# Sheriff 2019-02-22
234228
crbug.com/929122 [ Linux ] external/wpt/html/dom/interfaces.worker.html [ Timeout ]
@@ -273,7 +267,6 @@ crbug.com/856601 [ Linux ] external/wpt/xhr/idlharness.any.worker.html [ Skip ]
273267
crbug.com/856601 [ Linux ] http/tests/devtools/a11y-axe-core/console/console-a11y-test.js [ Pass Timeout ]
274268
crbug.com/856601 [ Linux ] http/tests/devtools/a11y-axe-core/network/network-condition-a11y-test.js [ Pass Timeout ]
275269
crbug.com/856601 [ Linux ] external/wpt/webrtc-identity/idlharness.https.window.html [ Skip ]
276-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/api/idlharness.any.worker.html [ Skip ]
277270

278271
# Sheriff 2019-06-28
279272
crbug.com/856601 [ Linux ] external/wpt/battery-status/battery-interface-idlharness.https.window.html [ Skip ]
@@ -287,7 +280,6 @@ crbug.com/856601 [ Linux ] http/tests/devtools/indexeddb/live-update-indexeddb-c
287280
crbug.com/856601 [ Linux ] http/tests/devtools/indexeddb/live-update-indexeddb-list.js [ Pass Timeout ]
288281

289282
# Sheriff 2019-07-19
290-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.serviceworker.html [ Skip ]
291283
crbug.com/856601 [ Linux ] external/wpt/WebCryptoAPI/idlharness.https.any.html [ Skip ]
292284
crbug.com/856601 [ Linux ] external/wpt/web-animations/interfaces/Animation/idlharness.window.html [ Skip ]
293285

@@ -304,10 +296,6 @@ crbug.com/856601 [ Linux ] external/wpt/web-nfc/idlharness.https.window.html [ S
304296
crbug.com/856601 [ Linux ] external/wpt/xhr/idlharness.any.html [ Skip ]
305297
crbug.com/856601 [ Linux ] external/wpt/xhr/idlharness.any.sharedworker.html [ Skip ]
306298
crbug.com/856601 [ Linux ] http/tests/devtools/a11y-axe-core/settings/geolocations-a11y-test.js [ Pass Timeout ]
307-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.sharedworker.html [ Skip ]
308-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/xhr/idlharness.any.html [ Skip ]
309-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/xhr/idlharness.any.sharedworker.html [ Skip ]
310-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/xhr/idlharness.any.worker.html [ Skip ]
311299
crbug.com/856601 [ Linux ] wpt_internal/std-switch/tentative/interface.html [ Pass Timeout ]
312300
crbug.com/856601 [ Linux ] http/tests/devtools/a11y-axe-core/elements/main-tool-test.js [ Pass Timeout ]
313301
crbug.com/856601 [ Linux ] webaudio/Analyser/realtimeanalyser-freq-data.html [ Pass Timeout ]
@@ -322,11 +310,6 @@ crbug.com/856601 [ Linux ] external/wpt/css/filter-effects/idlharness.any.worker
322310
crbug.com/856601 [ Linux ] external/wpt/fetch/api/idlharness.any.worker.html [ Skip ]
323311
crbug.com/856601 [ Linux ] external/wpt/html/dom/idlharness.worker.html [ Skip ]
324312
crbug.com/856601 [ Linux ] external/wpt/mediasession/idlharness.window.html [ Skip ]
325-
crbug.com/856601 [ Linux ] virtual/cascade/external/wpt/css/css-typed-om/idlharness.html [ Skip ]
326-
crbug.com/856601 [ Linux ] virtual/scalefactor200/external/wpt/css/filter-effects/idlharness.any.html [ Skip ]
327-
crbug.com/856601 [ Linux ] virtual/scalefactor200/external/wpt/css/filter-effects/idlharness.any.worker.html [ Skip ]
328-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/api/idlharness.any.serviceworker.html [ Skip ]
329-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/api/idlharness.any.sharedworker.html [ Skip ]
330313
crbug.com/856601 [ Linux ] external/wpt/BackgroundSync/idlharness.https.any.worker.html [ Skip ]
331314
crbug.com/856601 [ Linux ] external/wpt/fetch/api/idlharness.any.serviceworker.html [ Skip ]
332315
crbug.com/856601 [ Linux ] external/wpt/BackgroundSync/idlharness.https.any.html [ Skip ]
@@ -337,8 +320,6 @@ crbug.com/856601 [ Linux ] external/wpt/fetch/api/idlharness.any.sharedworker.ht
337320
crbug.com/856601 [ Linux ] external/wpt/generic-sensor/idlharness.https.window.html [ Skip ]
338321
crbug.com/856601 [ Linux ] external/wpt/html-media-capture/idlharness.window.html [ Skip ]
339322
crbug.com/856601 [ Linux ] external/wpt/pointerlock/idlharness.window.html [ Skip ]
340-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.worker.html [ Skip ]
341-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/resource-timing/idlharness.any.worker.html [ Skip ]
342323

343324
# Sheriff 2019-09-06
344325
crbug.com/856601 [ Linux ] external/wpt/idle-detection/idlharness.https.any.html [ Skip ]
@@ -347,7 +328,6 @@ crbug.com/856601 [ Linux ] external/wpt/idle-detection/idlharness.https.any.html
347328

348329
crbug.com/856601 [ Linux ] external/wpt/web-animations/idlharness.window.html [ Skip ]
349330
crbug.com/856601 [ Linux ] virtual/controls-refresh/color/color-picker-manual-color-change-invalid-values.html [ Pass Timeout ]
350-
crbug.com/856601 [ Linux ] virtual/omt-worker-fetch/external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.html [ Skip ]
351331

352332
# Note to sheriffs: Timeouts about "idlharness" or "interfaces" are usually crbug.com/856601.
353333
crbug.com/856601 [ Linux ] external/wpt/secure-contexts/idlharness.any.html [ Skip ]

0 commit comments

Comments
 (0)