Run GeckoView xpcshell tests in Android service
Categories
(GeckoView :: General, enhancement, P1)
Tracking
(firefox89 fixed)
Tracking | Status | |
---|---|---|
firefox89 | --- | fixed |
People
(Reporter: CuveeHsu, Assigned: agi)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [geckoview:m82][geckoview:m87][geckoview:m88])
Attachments
(24 files, 4 obsolete files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
FWIW, all */unit_ipc/xpcshell.ini disable android.
Comment 1•5 years ago
|
||
Junior, could you work on this when possible (P2)?
Reporter | ||
Comment 2•5 years ago
|
||
The crash stack is:
mozilla::jni::GetEnvForThread()
mozilla::ipc::AndroidProcessLauncher::DoLaunch()
mozilla::ipc::BaseProcessLauncher::PerformAsyncLaunch()
which is triggered by BaseProcessLauncher::Launch
and initial from the stack:
GeckoChildProcessHost::AsyncLaunch
mozilla::ipc::GeckoChildProcessHost::LaunchAndWaitForProcessHandle
mozilla::dom::ContentParent::LaunchSubprocessInternal
mozilla::dom::ContentParent::LaunchSubprocessSync
mozilla::dom::ContentParent::GetNewOrUsedBrowserProcess
GetOrCreateTestShellParent
XRE_SendTestShellCommand
whose root is javascript sendCommand
in test https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/testing/xpcshell/head.js#1320
That is, we need to set the JNIEnv
if we want to launch a child process.
Currently we set the environment only for native launch through GeckoStart
for parent process or XRE_SetAndroidChildFds
for child process.
https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/mozglue/android/APKOpen.cpp#370-386
But I'm not familiar with xpcshell-test setup in android.
Hello :snorp,
Do you (or someone else) know where might be the best place to set the JNIEnv
for xpcshell-test?
Thanks!
xpcshell doesn't have a Dalvik VM at all, so we'd need to change that in order to fix this bug. My suggestion would be to host the xpcshell in an Android Service. Probably a pretty decent amount of work.
Reporter | ||
Comment 4•5 years ago
|
||
Thanks :snorp.
Looks like it won't happen in the near future.
Comment 5•5 years ago
|
||
In bug 1567342 I'll probably need to run nodeJS in a separate Android service, so maybe we could merge these efforts.
Reporter | ||
Updated•5 years ago
|
Comment 6•5 years ago
|
||
Only giving this a P3 priority to get it off the Fennec Project Board.
Comment 8•5 years ago
|
||
Raising the priority because this now blocks a P2 bug to re-enable some networking tests for Fenix (a Tier-1 platform).
The way forward here is to not run a bare executable on Android, but instead launch Gecko from a Service
as we do for the JUnit tests. The steps are roughly:
- Create a new
Service
inorg.mozilla.geckoview.test
,XPCShellService
perhaps? - Make the service instantiate a
GeckoRuntime
that will somehow end up callingXRE_XPCShellMain()
. We don't want xpcshell garbage in the public API, so one way to do this would be a hack that detects a special process name (like:xpcshell
) and calls the different entry point. It's also possible that we don't even need a different entry point on Android, since we're already kinda headless. - Fix up the
mach
to launch this new service instead of running the bare executables. Any arguments we would normally pass can be sent in theIntent
to start the service.
Updated•5 years ago
|
Comment 10•5 years ago
|
||
James (David Bolter doesn't accept ni?), I'm looking for an assignee here, as this blocks a (P2) work to re-enable now Tier-1/Fenix networking xpcshell tests. Can you advice please?
Other option is to give more detailed pointers where to start (a code to duplicate or use as an example perhaps; for the purpose stated in comment 9 by James) and someone from our team could work on this.
Thanks.
It's going to be pretty hairy. I think we'll need to try to prioritize this on the GV team. We probably need Emily for that.
Updated•5 years ago
|
Comment 12•5 years ago
|
||
proposed for GV76 sprint
Updated•5 years ago
|
Updated•5 years ago
|
I changed the summary to reflect how we're really treating this bug -- we need to run the xpcshell tests in an Android service in order for e10s to work.
Assignee | ||
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 14•4 years ago
|
||
We don't need to initialize SafeBrowsing immediately at startup and we can
wait until the InitLater stage.
This has the added benefit of not crashing xpcshell-test which doesn't have
SafeBrowsing support.
Assignee | ||
Comment 15•4 years ago
|
||
Assignee | ||
Comment 16•4 years ago
|
||
Assignee | ||
Comment 17•4 years ago
|
||
Assignee | ||
Comment 18•4 years ago
|
||
Assignee | ||
Comment 19•4 years ago
|
||
Assignee | ||
Comment 20•4 years ago
|
||
Assignee | ||
Comment 21•4 years ago
|
||
Assignee | ||
Comment 22•4 years ago
|
||
Sending arguments in one string breaks arguments that contain a space, e.g. in
xpcshell-test.
Assignee | ||
Comment 23•4 years ago
|
||
nsBaseAppShell already listens to xpcom-shutdown and calls |Exit| when it
receives it so we don't need to also listen for it in nsAppShell (which causes
two calls to xpcom-shutdown instead of one).
Assignee | ||
Comment 24•4 years ago
|
||
This is consistent to geckoview-junit and mochitest.
Assignee | ||
Comment 25•4 years ago
|
||
This commit adds a new command line option |-xpcshell| that, when passed, will
run an xpcshell instead of launching a full Gecko instance.
This command line option is restricted to org.mozilla.geckoview.test for now,
as it's really hard to use and not really a usecase outside mozilla. We can
revisit this if there's interest.
Assignee | ||
Comment 26•4 years ago
|
||
This service, based off of TestRunnerActivity, can be used to run an
xpcshell-test instance.
It supports up to 10 concurrent instances, although we can add more if we need
to.
Local testing indicates that with more than 4 concurrent instances there's not
gain in test running performance.
This also adds a new intent action
|org.mozilla.geckoview.test.XPCSHELL_TEST_MAIN| that can be used by the test
harness to start the main application and gain foreground priority without
starting Gecko (which would interfere with the xpcshell runner services).
Assignee | ||
Comment 27•4 years ago
|
||
This is done so that xpcshell-test runs with a Dalvik VM and has access to all
the java-implemented bits of GeckoView.
Assignee | ||
Comment 28•4 years ago
|
||
Assignee | ||
Comment 29•4 years ago
|
||
When getting the *-extension-installed messages we should always notify
GeckoViewWebExtension.
This currently works because we always install the test support extension which
causes us to initialize GeckoViewWebExtension. On xpcshel tests, however, there
is no support extension so we need to account for that in GeckoViewStartup.
Assignee | ||
Comment 30•4 years ago
|
||
There is a little Woodoo in this patch but here it is:
- According to the Android docs, services that implement onStartService are
not considered bound services and need to stop themselves. Since we do want
our child processes to die after every client unbounds, we shouldn't implement
it. - Sometimes processes don't die after |onDestroy| is called, this causes
processes being reused on some esoteric edge case (multiple runtimes, mostly).
To avoid these corner cases, we call System.exit in onDestroy. Note: chromium
does this too. - We now don't need to kill the process on onBind anymore (this is mostly to
align with chromium). - We make sure we don't get created multiple times, as that could cause really
weird behavior which is hard to debug (especially on users' devices).
Assignee | ||
Comment 31•4 years ago
|
||
For tests, we want to be able to run multiple runtimes at the same time (each
runtime gets its own process).
This mostly work, except our process allocator does not currently check that it
owns a certain process and it will happily try to take control of a different
runtime's process (and fail).
To make this work we tag each content process with the parent process' UUID so
that we can check whether the process that we try to create is free or not.
This strategy is pretty rudimental and we can iteratively improve on it if we
decide to use multiple runtimes on actual apps (and not just tests).
Assignee | ||
Comment 32•4 years ago
|
||
This error is sent to the native layer so we never log it (at least locally).
This also adds a "cause" exception to have the full stacktrace.
Comment 33•4 years ago
|
||
Comment on attachment 9208422 [details]
Bug 1567341 - Ensure GeckoServiceChildProcess is treated as a bound service.
Revision D108036 was moved to bug 1696460. Setting attachment 9208422 [details] to obsolete.
Comment 34•4 years ago
|
||
Comment on attachment 9208423 [details]
Bug 1567341 - Allow multiple runtimes to run at the same time.
Revision D108037 was moved to bug 1696460. Setting attachment 9208423 [details] to obsolete.
Comment 35•4 years ago
|
||
Comment on attachment 9208424 [details]
Bug 1567341 - Improve bind error logging.
Revision D108038 was moved to bug 1696460. Setting attachment 9208424 [details] to obsolete.
Assignee | ||
Comment 36•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 37•4 years ago
|
||
On Android we kill the content process when receiving |MarkAsDead|. This means
that the shutdown sequence races with killing the content process, as sometimes
the content process is killed before it has a chance to complete the shutdown
sequence and notify the parent process.
To avoid test timeouts we remove the shutdown blockers instead.
Assignee | ||
Comment 38•4 years ago
|
||
Assignee | ||
Comment 39•4 years ago
|
||
The code as written does not remove the connection from both
mContentConnections and mNonStartedContentConnections since && short circuits.
Since the connection is always present in mContentConnections, we just check
that.
Assignee | ||
Comment 40•4 years ago
|
||
Assignee | ||
Comment 41•4 years ago
|
||
Assignee | ||
Comment 42•4 years ago
|
||
Assignee | ||
Comment 43•4 years ago
|
||
Assignee | ||
Comment 44•4 years ago
|
||
Updated•4 years ago
|
Comment 45•4 years ago
|
||
Comment 46•4 years ago
|
||
Backed out 24 changesets (bug 1567341) for causing xpcshell failures in test_telemetry.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/c83c94d1986637661ff52d0beb24b4c94a6cd887
Push with failures, failure log.
Comment 47•4 years ago
|
||
Comment 49•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/efb6cf38264e
https://hg.mozilla.org/mozilla-central/rev/dbc4f44ee10a
https://hg.mozilla.org/mozilla-central/rev/e755ef39a0ee
https://hg.mozilla.org/mozilla-central/rev/e50020363a1c
https://hg.mozilla.org/mozilla-central/rev/b2b2eaa9a75f
https://hg.mozilla.org/mozilla-central/rev/072597b667ec
https://hg.mozilla.org/mozilla-central/rev/303fda21f7c0
https://hg.mozilla.org/mozilla-central/rev/2e1e1ec91eb8
https://hg.mozilla.org/mozilla-central/rev/8980d58216bc
https://hg.mozilla.org/mozilla-central/rev/0e4b4e8cdb69
https://hg.mozilla.org/mozilla-central/rev/c2a0b0be6c7d
https://hg.mozilla.org/mozilla-central/rev/9b55527ca451
https://hg.mozilla.org/mozilla-central/rev/c347bab90951
https://hg.mozilla.org/mozilla-central/rev/848ba2ab270c
https://hg.mozilla.org/mozilla-central/rev/0db615460866
https://hg.mozilla.org/mozilla-central/rev/f2e031c40335
https://hg.mozilla.org/mozilla-central/rev/1c8892fce160
https://hg.mozilla.org/mozilla-central/rev/fc76a1768da4
https://hg.mozilla.org/mozilla-central/rev/c4aa3900ca76
https://hg.mozilla.org/mozilla-central/rev/de0dc03a7073
https://hg.mozilla.org/mozilla-central/rev/edb1af92004d
https://hg.mozilla.org/mozilla-central/rev/2bd1a86b219b
https://hg.mozilla.org/mozilla-central/rev/2bb57a8dd29f
https://hg.mozilla.org/mozilla-central/rev/1b0d3c1d43c7
Description
•