Closed Bug 1908693 Opened 2 years ago Closed 9 months ago

[Gecko-iOS] Basic support for locally running mochitest-plain

Categories

(Testing :: Mochitest, enhancement)

enhancement

Tracking

(firefox148 fixed)

RESOLVED FIXED
148 Branch
Tracking Status
firefox148 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(7 files, 2 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.

On desktop platforms, environment variables are implicitly inherited by content
processes, and on Android, custom environment variables are generally set as
part of GeckoThread initialization, which is performed in every process.

As these env vars are not inherited on iOS, we need to manually specify them
for child processes. This patch does this in a fairly hacky way, by enumerating
all environment variables, and copying ones with a MOZ_ prefix to child
processes as they are created.

We probably want to have a better system for this in the future.

This provides a convenient mechanism for our test runner to specify the initial
URL to load in the test browser. An environment variable was chosen over the
command line for initial implementation simplicity, but it may be worth
changing how the URL is loaded in the future.

Depends on D217131

Before this change, calls through EventDispatcher could be delivered before
the geckoview.js script had begun executing, which would mean that early calls
to the Gecko backend would not be handled. This patch ensures that these events
are queued up until the listeners are ready, which is more in line with the
behaviour on Android.

Depends on D217132

Before this change on iOS, when the application exits, UIKit's main loop method
does not return, so we exit before running through normal XPCOM shutdown. This
patch changes the behaviour around applicationWillTerminate to ensure that we
run at least some of XPCOM shutdown before the application is exited.

This fix also ensures that the iOS application will exit when Quit() is called
by Gecko JS code. This won't happen in normal operation on iOS, as the OS
generally controls app lifetimes, but is important for automated testing. As
iOS provides no proper support for gracefully exiting an app, we call
_exit(0); after performing as much of the shutdown process as possible.

Depends on D217133

This is intended to simplify transitioning code which is checking for Android to
instead check for Android/iOS.

Depends on D217134

This new python package is intended to contain helper types etc. for working
with iOS devices from our test runners. The design is still very much early
stages, and only simulator supports the bulk of the methods.

Depends on D217136

This patch centers around a hacked up version of runtestsremote.py which
instead uses the helper types from moziosdevice to run mochitests on an iOS
device. With this change it is possible to run some basic mochitests on
simulator from a local build. There is currently no support for running on CI.

Tests involving any form of more advanced features such as opening pop-up
windows still are not supported, as the testing browser doesn't support tabs
yet.

Depends on D217137

Depends on: 1921333

Comment on attachment 9413860 [details]
Bug 1908693 - Part 5: Add a MOZ_GECKOVIEW config variable for iOS/Android, r=glandium!

Revision D217135 was moved to bug 1921333. Setting attachment 9413860 [details] to obsolete.

Attachment #9413860 - Attachment is obsolete: true

Comment on attachment 9413861 [details]
Bug 1908693 - Part 6: Switch some AppConstants.platform checks to MOZ_GECKOVIEW, r=glandium!

Revision D217136 was moved to bug 1921333. Setting attachment 9413861 [details] to obsolete.

Attachment #9413861 - Attachment is obsolete: true
Attachment #9413862 - Attachment description: Bug 1908693 - Part 7: Add a skeleton moziosdevice, r=gbrown! → Bug 1908693 - Part 5: Add a skeleton moziosdevice, r=#mach-reviewers!
Attachment #9413863 - Attachment description: Bug 1908693 - Part 8: Basic support for running iOS mochitest-plain, r=gbrown! → Bug 1908693 - Part 6: Basic support for running iOS mochitest-plain, r=#mach-reviewers!

This logic is used to install the xre host tools, such as a host copy of
xpcshell, which is required when running tests on a remote device. As this will
also be useful for iOS, this logic moves the code to a common place so it can
also be used by iOS in the next part.

Depends on D217134

Attachment #9413862 - Attachment description: Bug 1908693 - Part 5: Add a skeleton moziosdevice, r=#mach-reviewers! → Bug 1908693 - Part 6: Add some framework pieces for interacting with iOS devices, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413863 - Attachment description: Bug 1908693 - Part 6: Basic support for running iOS mochitest-plain, r=#mach-reviewers! → Bug 1908693 - Part 7: Basic support for mochitest-plain on iOS, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413856 - Attachment description: Bug 1908693 - Part 1: Propagate MOZ_ environment variables into child processes on iOS, r=glandium! → WIP: Bug 1908693 - Part 1: Propagate MOZ_ environment variables into child processes on iOS, r=glandium!
Attachment #9413857 - Attachment description: Bug 1908693 - Part 2: Allow specifying a MOZ_TEST_URL environment variable, r=glandium! → WIP: Bug 1908693 - Part 2: Allow specifying a MOZ_TEST_URL environment variable, r=glandium!
Attachment #9413858 - Attachment description: Bug 1908693 - Part 3: Delay EventDispatcher messages until listeners are ready on iOS, r=glandium!,owlish! → WIP: Bug 1908693 - Part 3: Delay EventDispatcher messages until listeners are ready on iOS, r=glandium!,owlish!
Attachment #9413859 - Attachment description: Bug 1908693 - Part 4: Shutdown XPCOM on iOS app exit, r=glandium! → WIP: Bug 1908693 - Part 4: Shutdown XPCOM on iOS app exit, r=glandium!
Attachment #9429757 - Attachment description: Bug 1908693 - Part 5: Move host tool install logic out of android_device, r=#mozbase-reviewers!,#mach-reviewers! → WIP: Bug 1908693 - Part 5: Move host tool install logic out of android_device, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413862 - Attachment description: Bug 1908693 - Part 6: Add some framework pieces for interacting with iOS devices, r=#mozbase-reviewers!,#mach-reviewers! → WIP: Bug 1908693 - Part 6: Add some framework pieces for interacting with iOS devices, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413863 - Attachment description: Bug 1908693 - Part 7: Basic support for mochitest-plain on iOS, r=#mozbase-reviewers!,#mach-reviewers! → WIP: Bug 1908693 - Part 7: Basic support for mochitest-plain on iOS, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413856 - Attachment description: WIP: Bug 1908693 - Part 1: Propagate MOZ_ environment variables into child processes on iOS, r=glandium! → Bug 1908693 - Part 1: Propagate MOZ_ environment variables into child processes on iOS, r=glandium!
Attachment #9413857 - Attachment description: WIP: Bug 1908693 - Part 2: Allow specifying a MOZ_TEST_URL environment variable, r=glandium! → Bug 1908693 - Part 2: Allow specifying a MOZ_TEST_URL environment variable, r=glandium!
Attachment #9413858 - Attachment description: WIP: Bug 1908693 - Part 3: Delay EventDispatcher messages until listeners are ready on iOS, r=glandium!,owlish! → Bug 1908693 - Part 3: Delay EventDispatcher messages until listeners are ready on iOS, r=glandium!,owlish!
Attachment #9413859 - Attachment description: WIP: Bug 1908693 - Part 4: Shutdown XPCOM on iOS app exit, r=glandium! → Bug 1908693 - Part 4: Shutdown XPCOM on iOS app exit, r=glandium!
Attachment #9429757 - Attachment description: WIP: Bug 1908693 - Part 5: Move host tool install logic out of android_device, r=#mozbase-reviewers!,#mach-reviewers! → Bug 1908693 - Part 5: Move host tool install logic out of android_device, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413862 - Attachment description: WIP: Bug 1908693 - Part 6: Add some framework pieces for interacting with iOS devices, r=#mozbase-reviewers!,#mach-reviewers! → Bug 1908693 - Part 6: Add some framework pieces for interacting with iOS devices, r=#mozbase-reviewers!,#mach-reviewers!
Attachment #9413863 - Attachment description: WIP: Bug 1908693 - Part 7: Basic support for mochitest-plain on iOS, r=#mozbase-reviewers!,#mach-reviewers! → Bug 1908693 - Part 7: Basic support for mochitest-plain on iOS, r=#mozbase-reviewers!,#mach-reviewers!
Pushed by nlayzell@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/762a2f5afff1 https://hg.mozilla.org/integration/autoland/rev/18bf5ea0f3bb Part 1: Propagate MOZ_ environment variables into child processes on iOS, r=glandium https://github.com/mozilla-firefox/firefox/commit/18449793c18b https://hg.mozilla.org/integration/autoland/rev/16c6bb6559fa Part 2: Allow specifying a MOZ_TEST_URL environment variable, r=glandium,geckoview-reviewers,owlish https://github.com/mozilla-firefox/firefox/commit/ef13c67d27be https://hg.mozilla.org/integration/autoland/rev/32a0e42f6e66 Part 3: Delay EventDispatcher messages until listeners are ready on iOS, r=glandium,owlish,geckoview-reviewers https://github.com/mozilla-firefox/firefox/commit/f55e7af1f62c https://hg.mozilla.org/integration/autoland/rev/1b06d7a76460 Part 4: Shutdown XPCOM on iOS app exit, r=glandium,geckoview-reviewers,m_kato https://github.com/mozilla-firefox/firefox/commit/34b2f98faa68 https://hg.mozilla.org/integration/autoland/rev/22d633da015b Part 5: Move host tool install logic out of android_device, r=mozbase-reviewers,mach-reviewers,jmaher,ahal https://github.com/mozilla-firefox/firefox/commit/3884dcda47f1 https://hg.mozilla.org/integration/autoland/rev/2a57de058f8a Part 6: Add some framework pieces for interacting with iOS devices, r=mach-reviewers,mozbase-reviewers,ahal,jmaher,firefox-build-system-reviewers,ahochheiden https://github.com/mozilla-firefox/firefox/commit/425f9ec4676c https://hg.mozilla.org/integration/autoland/rev/cb5b8d7057af Part 7: Basic support for mochitest-plain on iOS, r=gbrown,geckoview-reviewers,owlish,mozbase-reviewers,jmaher
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: