[mozdevice] adb should support ANDROID_SERIAL environment variable
Categories
(Testing :: Mozbase, enhancement, P3)
Tracking
(firefox81 fixed)
Tracking | Status | |
---|---|---|
firefox81 | --- | fixed |
People
(Reporter: botond, Assigned: bc)
References
Details
(Whiteboard: dev-prod-2020)
Attachments
(1 file)
I am trying to run a mochitest on an Android emulator, with a device also connected (for unrelated development).
I am trying to use ANDROID_SERIAL
to tell the mach mochitest
command to use the emulator, but it seems to be ignoring it:
$ ANDROID_SERIAL=emulator-5554 ./mach mochitest --keep-open=false mobile/android/tests/browser/chrome/test_session_scroll_position.html
cat: backend.TestManifestBackend.in: No such file or directory
Build configuration changed. Regenerating backend.
No handlers could be found for logger "mozbuild.frontend.reader"
0:00.70 adb INFO Using adb 1.0.40
Error running mach:
['mochitest', '--keep-open=false', 'mobile/android/tests/browser/chrome/test_session_scroll_position.html']
The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You should consider filing a bug for this issue.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
ValueError: ADBDevice called with multiple devices attached and no device specified
File "/home/botond/dev/mozilla/refactoring/testing/mochitest/mach_commands.py", line 460, in run_mochitest_general
app=app, device_serial=device_serial)
File "/home/botond/dev/mozilla/refactoring/testing/mozbase/mozrunner/mozrunner/devices/android_device.py", line 240, in verify_android_device
device = _get_device(build_obj.substs, device_serial)
File "/home/botond/dev/mozilla/refactoring/testing/mozbase/mozrunner/mozrunner/devices/android_device.py", line 102, in _get_device
device = ADBDevice(adb=adb_path, verbose=verbose_logging, device=device_serial)
File "/home/botond/dev/mozilla/refactoring/testing/mozbase/mozdevice/mozdevice/adb.py", line 599, in __init__
self._device_serial = self._get_device_serial(device)
File "/home/botond/dev/mozilla/refactoring/testing/mozbase/mozdevice/mozdevice/adb.py", line 758, in _get_device_serial
raise ValueError("ADBDevice called with multiple devices "
I haven't figured out a way to get it to use the emulator without disconnecting the phone first.
Comment 1•5 years ago
|
||
You should be able to use
mach mochitest ... --deviceSerial=...
Comment 2•5 years ago
|
||
I updated https://wiki.mozilla.org/Mobile/Fennec/Android/Testing#Multiple_emulators.2Fdevices with this tip.
Reporter | ||
Comment 3•5 years ago
|
||
Thanks! I can confirm that works.
Might still be nice to pass through ANDROID_SERIAL to adb as an enhancement, but it's not super important given the mach option.
Assignee | ||
Comment 4•5 years ago
|
||
Yeah. That's an issue I keep coming back to but it is not a blocker. It would help with logging though since error messages would no longer contain the -s <serial> string. But most frameworks currently require the serial number and we would need additional work to support the environment variable in them as well. Moving this to mozbase/mozdevice. If we ever do fix this then we can think about making the frameworks support ANDROID_SERIAL as well.
Reporter | ||
Comment 5•5 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #3)
Thanks! I can confirm that works.
Hmm -- it doesn't work for |mach install|, though.
Updated•5 years ago
|
Reporter | ||
Comment 6•5 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #5)
(In reply to Botond Ballo [:botond] from comment #3)
Thanks! I can confirm that works.
Hmm -- it doesn't work for |mach install|, though.
Ah, but ANDROID_SERIAL
does work for mach install
. So there's a way to work multiple devices, just as long as you remember each subcommand's idiosyncracies :)
Updated•4 years ago
|
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Geoff, this bug misses a mentor field. So it will never be picked-up that way.
Comment 8•4 years ago
|
||
Actually, as I recall, there are some complications in this bug (handling the env var + existing options and ensuring consistently between different automation layers) -- maybe not a g-f-b after all.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 9•4 years ago
|
||
Comment 10•4 years ago
|
||
Pushed by bclary@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b69794d23f1c [mozdevice 4.0.1] adb should use ANDROID_SERIAL environment variable if device not otherwise specified. r=gbrown
Comment 11•4 years ago
|
||
bugherder |
Assignee | ||
Comment 12•4 years ago
|
||
Description
•