Closed Bug 1162285 Opened 9 years ago Closed 9 years ago

mach mochitest-plain fails to launch Fennec on Android

Categories

(Firefox for Android Graveyard :: Testing, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox40 fixed)

RESOLVED FIXED
Firefox 40
Tracking Status
firefox40 --- fixed

People

(Reporter: wchen, Assigned: gbrown)

References

Details

Attachments

(5 files)

Step to reproduce:

export MOZ_HOST_BIN=directory containing xpcshell
./mach mochitest-plain

I tried running the command on both Linux and Mac machines (adb version 1.0.32) with an Android 4.0, 4.4 and 5.0 device and it fails to launch Fennec on the device, thus fails to run tests. I am using a clean build of Fennec and I have tried using my own build of xpcshell as well as pre-built binaries.

I bisected the failures to the patch in Bug 1160393, reverting the patch allows the tests to run again.
Assignee: nobody → gbrown
Blocks: 1160393
Bug 1160393 only defines some additional environment variables: R_LOG_LEVEL, R_LOG_DESTINATION, and R_LOG_VERBOSE -- I would expect that to be pretty safe.
For comparison -- here's my successful output (until I ctrl-C'd out).
:wchen - One thing I notice in your output is that org.mozilla.fennec_wchen was already running (presumably in the background) when you started the test. Can you kill fennec (adb shell kill <pid>) just before running mach to see if that makes a difference?
Flags: needinfo?(wchen)
:wchen -- Here's a speculative fix with some additional logging. Can you also try running with this patch, collect the output and attach it here?
I normally kill Fennec before running the command, but I guess I forgot in the particular instance I captured the dump, that isn't the cause.

Your speculative fix resolves the problem!

I wonder if command line length is also the cause of problems I was having earlier. I had wrote some new tests that had long file names and I was unable to run them when I launched from Mac (same problem with browser failing to launch on device). I was able to run them when I shortened the test file name.
Flags: needinfo?(wchen)
Thanks William.

Comparing your command line:

['adb', 'shell', '"am" "start" "-W" "-n" "org.mozilla.fennec_wchen/.App" "--es" "args" "-no-remote -profile /storage/sdcard0/tests/profile/" "--es" "env0" "MOZ_CRASHREPORTER=1" "--es" "env1" "XPCOM_DEBUG_BREAK=stack" "--es" "env2" "R_LOG_VERBOSE=1" "--es" "env3" "DISABLE_UNSAFE_CPOW_WARNINGS=1" "--es" "env4" "MOZ_PROCESS_LOG=/var/folders/qv/nmp1j0g93pl0tkjbkm_npxp00000gn/T/tmpVW48QZpidlog" "--es" "env5" "MOZ_DISABLE_NONLOCAL_CONNECTIONS=1" "--es" "env6" "R_LOG_DESTINATION=stderr" "--es" "env7" "MOZ_CRASHREPORTER_NO_REPORT=1" "--es" "env8" "NO_EM_RESTART=1" "--es" "env9" "NSPR_LOG_FILE=/storage/sdcard0/tests/nspr/nspr.log" "--es" "env10" "R_LOG_LEVEL=6" "--es" "env11" "MOZ_HIDE_RESULTS_TABLE=1" "-d" "http://mochi.test:8888/tests/?autorun=1&closeWhenDone=1&logFile=%2Fstorage%2Fsdcard0%2Ftests%2Flogs%2Fmochitest.log&fileLevel=INFO&consoleLevel=INFO&hideResultsTable=1&manifestFile=tests.json&dumpOutputDirectory=%2Fstorage%2Fsdcard0%2Ftests"']

with mine:

['adb', 'shell', '"am" "start" "-W" "-n" "org.mozilla.fennec_gbrown/.App" "--es" "args" "-no-remote -profile /sdcard/tests/profile/" "--es" "env0" "MOZ_CRASHREPORTER=1" "--es" "env1" "XPCOM_DEBUG_BREAK=stack" "--es" "env2" "R_LOG_VERBOSE=1" "--es" "env3" "DISABLE_UNSAFE_CPOW_WARNINGS=1" "--es" "env4" "MOZ_PROCESS_LOG=/tmp/tmpOPA22ipidlog" "--es" "env5" "MOZ_DISABLE_NONLOCAL_CONNECTIONS=1" "--es" "env6" "R_LOG_DESTINATION=stderr" "--es" "env7" "MOZ_CRASHREPORTER_NO_REPORT=1" "--es" "env8" "NO_EM_RESTART=1" "--es" "env9" "NSPR_LOG_FILE=/sdcard/tests/nspr/nspr.log" "--es" "env10" "R_LOG_LEVEL=6" "--es" "env11" "MOZ_HIDE_RESULTS_TABLE=1" "-d" "http://mochi.test:8888/tests/?autorun=1&closeWhenDone=1&logFile=%2Fsdcard%2Ftests%2Flogs%2Fmochitest.log&fileLevel=INFO&consoleLevel=INFO&hideResultsTable=1&manifestFile=tests.json&dumpOutputDirectory=%2Fsdcard%2Ftests"']

I notice that the sdcard location is /sdcard on my device and /storage/sdcard0 on yours; my local tmp directory is /tmp, while yours is /var/folders/qv/nmp1j0g93pl0tkjbkm_npxp00000gn/T. Variables like this explain the difference between our experience here. Your pre-fix adb command line length was a little over 1024 characters -- a limitation I have seen before.
Do you have any concerns with deleting these variables from the remote process' environment?

I am thinking about a better long-term solution to the problem of adb command line length but this gives us some breathing room and helps :wchen immediately.
Attachment #8603003 - Flags: review?(jmaher)
Comment on attachment 8603003 [details] [diff] [review]
delete environment vars not used on Android

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

how to reduce these in general?  can we just define the ones we need?  maybe reorganize our env vars in such a way that there are comments to remove them from android unless they are absolutely required?

is there a need for this in mochitest?
Attachment #8603003 - Flags: review?(jmaher) → review+
I think we need (or at least want!) most of the remaining environment, and I expect there will be more useful options to add in future. The xpcshell solution -- use a script on device that defines environment variables and launches the test app -- has worked well and removes all limits on environment length. I am not sure that can be done for mochitest and reftest, but I will have a look at that.
https://hg.mozilla.org/mozilla-central/rev/2efde71ffd9f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 40
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.