Automated tests for the Nuwa process

RESOLVED FIXED in Firefox 28, Firefox OS v1.3

Status

()

Core
IPC
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: cyu, Assigned: kk1fff)

Tracking

unspecified
mozilla29
x86_64
Linux
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(blocking-b2g:1.3+, firefox27 wontfix, firefox28 fixed, firefox29 fixed, b2g-v1.3 fixed)

Details

Attachments

(1 attachment, 4 obsolete attachments)

(Reporter)

Description

5 years ago
The Nuwa templated content process is now disabled by default. We need to add automated tests for turning it on.
Created attachment 819300 [details] [diff] [review]
WIP: Observe Nuwa process creation.

Test to observe NuwaReady. This basically works if we startup emulator only for this test case, since the preallocated process is not there then, we can observe it's event. But if the emulator has already run many tests before running this, we will need to restart the preallocated process. The preference observer doesn't seem work, I am still finding a way to restart it.
Attachment #819300 - Flags: feedback?(cyu)
(Assignee)

Updated

5 years ago
Depends on: 928995
(Reporter)

Comment 2

5 years ago
Comment on attachment 819300 [details] [diff] [review]
WIP: Observe Nuwa process creation.

Review of attachment 819300 [details] [diff] [review]:
-----------------------------------------------------------------

This test looks good, but we need to consider for the failure path and don't block the whole test suite if RecvNuwaReady() is never called.

If for some reason the Nuwa process won't be ready, we need to timeout and fail the test explicitly. The timeout value can be a loose, but not too big, value. 1 min is a safe value, I guess.
Attachment #819300 - Flags: feedback?(cyu)
(Assignee)

Updated

5 years ago
Assignee: nobody → pwang
Created attachment 823988 [details] [diff] [review]
WIP: Observe Nuwa process creation.
Attachment #819300 - Attachment is obsolete: true
(Reporter)

Updated

5 years ago
Blocks: 930282
Current status of test case: since running program in emulator is slower than in a real device, we are likely to be affected by bug 941466. It would result in all test cases time out once Nuwa is turned on.

Cervantes suggests we turn off PreloadSlowThings in emulator prevent asynchrous events from being dispatched after start to freeze. I tested turing off PreloadSlowThings on try server, the tests cases are all passed. I think we can turn off PreloadSlowThings on emulator for now, and re-enable it after we fixed bug 941466.
(Reporter)

Updated

5 years ago
Depends on: 941466
I don't really like the idea of turning off PreloadSlowThings in the emulator because it means that we're no longer testing the same code that we're shipping. We have every reason to believe that users will hit this.
Created attachment 8340314 [details] [diff] [review]
Test nuwa creation and fork new process.
Attachment #823988 - Attachment is obsolete: true
Comment on attachment 8340314 [details] [diff] [review]
Test nuwa creation and fork new process.

Review of attachment 8340314 [details] [diff] [review]:
-----------------------------------------------------------------

Kyle, could you help review this patch?
Attachment #8340314 - Flags: review?(khuey)
(Assignee)

Updated

5 years ago
blocking-b2g: --- → 1.3?
Comment on attachment 8340314 [details] [diff] [review]
Test nuwa creation and fork new process.

Review of attachment 8340314 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/ipc/PreallocatedProcessManager.cpp
@@ +285,5 @@
> +    nsCOMPtr<nsIMessageBroadcaster> ppmm =
> +      do_GetService("@mozilla.org/parentprocessmessagemanager;1");
> +    nsresult rv = ppmm->BroadcastAsyncMessage(
> +      NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
> +      JSVAL_NULL, JSVAL_NULL, AutoJSContext(), 1);

AutoJSContext cannot be used as a temporary.  If you ran this in a debug build it would assert at http://mxr.mozilla.org/mozilla-central/source/mfbt/GuardObjects.h#97

@@ +324,5 @@
> +    nsCOMPtr<nsIMessageBroadcaster> ppmm =
> +      do_GetService("@mozilla.org/parentprocessmessagemanager;1");
> +    nsresult rv = ppmm->BroadcastAsyncMessage(
> +      NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"),
> +      JSVAL_NULL, JSVAL_NULL, AutoJSContext(), 1);

Same here.
Attachment #8340314 - Flags: review?(khuey) → review-
Created attachment 8343593 [details] [diff] [review]
Patch: Test nuwa creation and fork new process.

I just realized AutoJSContext cannot be used as a temporary object. Thank for catching this, Kyle.
Attachment #8340314 - Attachment is obsolete: true
Attachment #8343593 - Flags: review?(khuey)
Created attachment 8343606 [details] [diff] [review]
Patch: Test nuwa creation and fork new process.

Remove redundant log message from test_NuwaProcessCreation.html
Attachment #8343593 - Attachment is obsolete: true
Attachment #8343593 - Flags: review?(khuey)
Attachment #8343606 - Flags: review?(khuey)
Comment on attachment 8343606 [details] [diff] [review]
Patch: Test nuwa creation and fork new process.

Review of attachment 8343606 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/ipc/tests/test_NuwaProcessCreation.html
@@ +75,5 @@
> +  };
> +  let timeout = setTimeout(function() {
> +    ok(false, "Nuwa process is not launched");
> +    testEnd();
> +  }, 60000);

Do we really need to wait a full minute here?
Attachment #8343606 - Flags: review?(khuey) → review+
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #11)
> Do we really need to wait a full minute here?

It won't take that long if test pass. If we get the two message, we can finish the test. Setting 1 minute is because emulator is slower then real device.
https://hg.mozilla.org/mozilla-central/rev/bf8e90edd152
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Backed out in https://hg.mozilla.org/mozilla-central/rev/06b3a7aea2c0 for frequent (somewhere between 20 and 50%) xpcshell shutdown crashes like https://tbpl.mozilla.org/php/getParsedLog.php?id=31651189&tree=B2g-Inbound
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla28 → ---
https://hg.mozilla.org/mozilla-central/rev/d48b1a339842
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
for rel eng
blocking-b2g: 1.3? → 1.3+
https://hg.mozilla.org/releases/mozilla-aurora/rev/11ec4ba33de4
status-firefox27: --- → wontfix
status-firefox28: --- → fixed
status-firefox29: --- → fixed
status-b2g-v1.3: --- → fixed
You need to log in before you can comment on or make changes to this bug.