Closed Bug 1678663 Opened 5 years ago Closed 5 years ago

Make web-platform-tests run with py3 in CI

Categories

(Testing :: web-platform-tests, task)

Default
task

Tracking

(firefox86 fixed)

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: jgraham, Assigned: jgraham)

References

(Blocks 1 open bug)

Details

Attachments

(14 files, 3 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

This depends on upstream switching over; the timetable for that is https://github.com/web-platform-tests/rfcs/blob/master/rfcs/py_3.md Based on that timetable, we should expect to switch at the start of December.

Depends on: 1679434
Depends on: 1679442

It's not the same as the stdlib for 3.6+ and is present on 3

Assignee: nobody → james
Status: NEW → ASSIGNED

This doesn't make sense since tests are running on the device, not
locally.

This makes Linux match Windows and macOS, and avoids a py3-only bug
where mozrunner desctructors can end up being called incorrectly in
the child process, so causing tests to fail.

To do this correctly turns out to require using an explicit context
which we pass down to everywhere we use multiprocessing. That's
because wptrunner isn't usually invoked directly but from a frontend
like wpt run or mach. Therefore spawned processed don't go through
the same entrypoint as the initial process and so don't set the
context themselves.

This unfortunately requires backwards-incompatible changes in mozlog,
so that will need to be released for this to land upstream.

data[bytes] must exist but can be None; comaping None with an integer
is an error in Py3

The problem was that classes defined in functions can't be recreated in
child processes. So we need to make the classes global instead.

The change in behaviour of the gc in Python 3 means that del is
being called in cases where it previously wasn't, and this can have
unfortunate side effects where del is being used to clean up
resources.

In particular with web-platform-tests running on Android, we end up
closing the test application unexpectedly. That causes widespread test
failures.

In general using del for this kind of cleanup is problematic
because it's not defined exactly when, or if, it's called. It's much
better to require explcit cleanup (and better still to make that
scope-based, using a context manager, although this patch doesn't do
so).

Therefore we add an option to only do explicit cleanup. This is
currently opt-in to make the breakage as small as possible, but
ultimately ought to be the default and only behaviour. We also change
the wpt android runner to use this behaviour.

Comment on attachment 9192219 [details]
Bug 1678663 - Fix use of iteritems in WebDriver helpers,

Revision D99253 was moved to bug 1680114. Setting attachment 9192219 [details] to obsolete.

Attachment #9192219 - Attachment is obsolete: true

Under Python 3 on Windows we sometimes get an OSError which may be a
race with the process exiting. There's not much we can do about
exceptions during shutdown so just ignore them.

This test was previously stable but seems to run a litle slower in
Python 3 so we see some timeouts. Make the timeout longer so avoid the
failure.

Attachment #9192583 - Attachment is obsolete: true
Attachment #9192583 - Attachment is obsolete: false
Attachment #9192583 - Attachment is obsolete: true
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/c9931fc09331 Don't try to set the environment for firefox_android, r=karlcow https://hg.mozilla.org/integration/autoland/rev/c584e6f853e6 Support passing adb binary in to wptrunner, r=bc https://hg.mozilla.org/integration/autoland/rev/6d4a8738da36 Only install enum for python 2, r=karlcow https://hg.mozilla.org/integration/autoland/rev/4fbd1c323b6d Fix rather broken handling of errors during setup, r=karlcow https://hg.mozilla.org/integration/autoland/rev/aeb183f1c3f0 Use correct error for socket timeout in Py3, r=marionette-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/e63f988a3d82 Fix TypeError under Python 3, r=bc https://hg.mozilla.org/integration/autoland/rev/38d6e1fcab14 Change wptrunner multiprocessing start method to spawn, r=karlcow,bc https://hg.mozilla.org/integration/autoland/rev/4a753391c683 Allow mozrunner.Runner instances to avoid cleanup in __del__, r=whimboo https://hg.mozilla.org/integration/autoland/rev/3ab9b82d7122 Fix stash unittests with multiprocessing.spawn, r=karlcow https://hg.mozilla.org/integration/autoland/rev/3fdacb63d3c3 Fix usage of bytes in cookie tests, r=karlcow https://hg.mozilla.org/integration/autoland/rev/00c401c41d16 Ignore connection errors during webdriver shutdown, r=webdriver-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/d5afbee022e5 Swallow exceptions during shutdown of fix_stacks.py, r=bc https://hg.mozilla.org/integration/autoland/rev/4967a4a57ab2 Add long timeout to test that times out on win 7 opt in py3, r=karlcow https://hg.mozilla.org/integration/autoland/rev/70a2e2a4b156 Run wpt tests under Python 3 on Taskcluster, r=bc
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.

Backed out aeb183f1c3f04a60f59841de3f0c231bc836b3b0 for causing marionette failures

backout: https://hg.mozilla.org/integration/autoland/rev/dff02098b9a627cce58cbfd8553597833c807456

push: https://treeherder.mozilla.org/jobs?repo=autoland&revision=70a2e2a4b156e8188b62988f9bc5e19aeab33a83&searchStr=marionette&selectedTaskRun=PbOVw8JaRdO8o6azb-sfFQ.0

failure log: https://treeherder.mozilla.org/logviewer?job_id=324458602&repo=autoland&lineNumber=51968

[task 2020-12-14T16:18:44.291Z] 16:18:44 INFO - Failed to gather test failure debug: Process crashed (Exit code: 1) (Reason: [Errno 10054] An existing connection was forcibly closed by the remote host)
[task 2020-12-14T16:18:44.292Z] 16:18:44 ERROR - TEST-UNEXPECTED-ERROR | testing/marionette/harness/marionette_harness/tests/unit/test_crash.py TestCrash.test_crash_chrome_process | NameError: global name 'TimeoutError' is not defined
[task 2020-12-14T16:18:44.292Z] 16:18:44 INFO - Traceback (most recent call last):
[task 2020-12-14T16:18:44.292Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_harness\marionette_test\testcases.py", line 214, in run
[task 2020-12-14T16:18:44.293Z] 16:18:44 INFO - testMethod()
[task 2020-12-14T16:18:44.293Z] 16:18:44 INFO - File "Z:\task_1607961860\build\tests\marionette\tests\testing\marionette\harness\marionette_harness\tests\unit\test_crash.py", line 130, in test_crash_chrome_process
[task 2020-12-14T16:18:44.294Z] 16:18:44 INFO - self.assertRaisesRegexp(IOError, "Process crashed", self.crash, parent=True)
[task 2020-12-14T16:18:44.294Z] 16:18:44 INFO - File "c:\mozilla-build\python\lib\unittest\case.py", line 993, in assertRaisesRegexp
[task 2020-12-14T16:18:44.294Z] 16:18:44 INFO - callable_obj(*args, **kwargs)
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - File "Z:\task_1607961860\build\tests\marionette\tests\testing\marionette\harness\marionette_harness\tests\unit\test_crash.py", line 101, in crash
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - "about:crash{}".format("parent" if parent else "content")
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_driver\marionette.py", line 1510, in navigate
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - self._send_message("WebDriver:Navigate", {"url": url})
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_driver\decorators.py", line 27, in _
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - return func(*args, **kwargs)
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_driver\marionette.py", line 617, in _send_message
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - msg = self.client.request(name, params)
[task 2020-12-14T16:18:44.295Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_driver\transport.py", line 288, in request
[task 2020-12-14T16:18:44.296Z] 16:18:44 INFO - return self.receive()
[task 2020-12-14T16:18:44.296Z] 16:18:44 INFO - File "Z:\task_1607961860\build\venv\lib\site-packages\marionette_driver\transport.py", line 163, in receive
[task 2020-12-14T16:18:44.296Z] 16:18:44 INFO - except (TimeoutError, socket.timeout):
[task 2020-12-14T16:18:44.296Z] 16:18:44 INFO - TEST-INFO took 199ms

Regressions: 1682805
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/4d41b11ea020 Pass multiprocessing context in when starting server, r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/26940 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c45207c0ba80 [wpt PR 26940] - [Gecko Bug 1678663] Don't try to set the environment for firefox_android, a=testonly
Attachment #9192211 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: