Closed Bug 1454101 Opened 6 years ago Closed 6 years ago

Provide a mechanism for specifying profile and gecko environment to geckoview junit tests

Categories

(Firefox for Android Graveyard :: Testing, enhancement)

enhancement
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
Firefox 61
Tracking Status
firefox61 --- fixed

People

(Reporter: gbrown, Assigned: jchen)

References

Details

Attachments

(3 files)

In support of bug 1445716, I need a mechanism for specifying the gecko profile location and environment seen by gecko when running geckoview junit tests.


Existing Android browser test harnesses create a test gecko profile on device and start Firefox with a -profile argument: --es args "--profile /mnt/sdcard/myprofile". This is helpful for specifying test network proxies and also for ensuring that <profile>/minidumps is easily monitored and controlled for crash reporting.

Existing Android browser test harnesses start Firefox with a specified environment by passing --es env0 VAR=val. Also important for crash reporting (MOZ_CRASHREPORTER, etc).

Those harnesses use 'am start' to start Firefox. Geckoview junit tests will run with 'am instrument', so a different mechanism is required.

Robocop also uses 'am instrument'; robocop passes arguments and environment in the robotium.config file: 

https://dxr.mozilla.org/mozilla-central/rev/cf543bdd424f24f5320d6284c19cb5c51eda054a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseRobocopTest.java#154-159
Assignee: nobody → nchen
Status: NEW → ASSIGNED
These patches should let us use the same "args" and "env<n>" arguments as before, but you pass them in though the -e flag: "adb instrument ... -e args foo -e env0 bar=baz"
This is great - thanks Jim!

Everything seems to work for me, but please confirm that this looks like a correct command line (to run just one test):

am instrument -w -r -e args '-profile /sdcard/tests/junit-profile -use_multiprocess true' -e class org.mozilla.geckoview.test.GeckoSessionTestRuleTest#delegateUntilTestEnd -e env0 MOZ_CRASHREPORTER=1 -e env1 XPCOM_DEBUG_BREAK=stack -e env2 R_LOG_VERBOSE=1 -e env3 DISABLE_UNSAFE_CPOW_WARNINGS=1 -e env4 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 -e env5 MOZ_IN_AUTOMATION=1 -e env6 MOZ_CRASHREPORTER_SHUTDOWN=1 -e env7 R_LOG_DESTINATION=stderr -e env8 MOZ_CRASHREPORTER_NO_REPORT=1 -e env9 R_LOG_LEVEL=6 org.mozilla.geckoview.test/android.support.test.runner.AndroidJUnitRunner
As discussed:

am instrument -w -r -e args '-profile /sdcard/tests/junit-profile' -e use_multiprocess true -e class org.mozilla.geckoview.test.GeckoSessionTestRuleTest#delegateUntilTestEnd -e env0 MOZ_CRASHREPORTER=1 -e env1 XPCOM_DEBUG_BREAK=stack -e env2 R_LOG_VERBOSE=1 -e env3 DISABLE_UNSAFE_CPOW_WARNINGS=1 -e env4 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 -e env5 MOZ_IN_AUTOMATION=1 -e env6 MOZ_CRASHREPORTER_SHUTDOWN=1 -e env7 R_LOG_DESTINATION=stderr -e env8 MOZ_CRASHREPORTER_NO_REPORT=1 -e env9 R_LOG_LEVEL=6 org.mozilla.geckoview.test/android.support.test.runner.AndroidJUnitRunner
Comment on attachment 8968287 [details]
Bug 1454101 - 2. Add "use_multiprocess" arg for GeckoSessionTestRule;

https://reviewboard.mozilla.org/r/236972/#review243384
Attachment #8968287 - Flags: review?(snorp) → review+
Comment on attachment 8968288 [details]
Bug 1454101 - 3. Add instrumentation arguments as extras;

https://reviewboard.mozilla.org/r/236974/#review243386
Attachment #8968288 - Flags: review?(snorp) → review+
Attachment #8968286 - Flags: review?(nchen)
Comment on attachment 8968286 [details]
Bug 1454101 - 1. Make getTestBytes not an extension;

https://reviewboard.mozilla.org/r/236970/#review243456
Attachment #8968286 - Flags: review?(nchen) → review+
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/63e9f66de6ec
1. Make getTestBytes not an extension; r=jchen
https://hg.mozilla.org/integration/autoland/rev/93cc25c9864d
2. Add "use_multiprocess" arg for GeckoSessionTestRule; r=snorp
https://hg.mozilla.org/integration/autoland/rev/3fcf64d3df17
3. Add instrumentation arguments as extras; r=snorp
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.