Closed Bug 756156 Opened 12 years ago Closed 12 years ago

devicemanagerADB requires ANDROID_SERIAL, even with just one device

Categories

(Testing :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla15

People

(Reporter: gbrown, Assigned: mbrubeck)

References

Details

(Keywords: regression)

Attachments

(1 file)

Bug 741994 added support to devicemanagerADB for distinguishing between multiple connected devices. 

Beginning recently (I noticed it today, others reported problems 1-2 days ago), dmADB fails to initialize unless ANDROID_SERIAL is set:


mozdev@mozdev-virtual-machine:~/src/objdir-native-droid$ export DM_TRANS=adb
mozdev@mozdev-virtual-machine:~/src/objdir-native-droid$ adb shell pwd
/
mozdev@mozdev-virtual-machine:~/src/objdir-native-droid$ make mochitest-robotium
/usr/bin/python2.7 ./build/mobile/robocop/parse_ids.py -i ./mobile/android/base/R.java -o ./build/mobile/robocop/fennec_ids.txt
Android Debug Bridge version 1.0.29
error: device not found
Traceback (most recent call last):
  File "_tests/testing/mochitest/runtestsremote.py", line 518, in <module>
    main()
  File "_tests/testing/mochitest/runtestsremote.py", line 417, in main
    dm = devicemanagerADB.DeviceManagerADB()
  File "/home/mozdev/src/objdir-native-droid/_tests/testing/mochitest/devicemanagerADB.py", line 52, in __init__
    self.verifyDevice()
  File "/home/mozdev/src/objdir-native-droid/_tests/testing/mochitest/devicemanagerADB.py", line 810, in verifyDevice
    raise DMError("unable to connect to device: is it plugged in?")
devicemanager.DMError: unable to connect to device: is it plugged in?
make: *** [mochitest-robotium] Error 1
mozdev@mozdev-virtual-machine:~/src/objdir-native-droid$ adb devices
List of devices attached 
42800C743E06657	device

mozdev@mozdev-virtual-machine:~/src/objdir-native-droid$ adb shell echo hello
hello


Do we know why this changed?
Setting environment variable ANDROID_SERIAL=<device ID> allows tests to run normally.
Attached patch patchSplinter Review
The problem is that build.mk exports ANDROID_SERIAL="" if there's no explicit value set.  This patch fixes it for me.
Assignee: nobody → mbrubeck
Status: NEW → ASSIGNED
Attachment #624797 - Flags: review?(mh+mozilla)
(In reply to Matt Brubeck (:mbrubeck) from comment #2)
> Created attachment 624797 [details] [diff] [review]
> patch
> 
> The problem is that build.mk exports ANDROID_SERIAL="" if there's no
> explicit value set.  This patch fixes it for me.

Indeed, this is definitely a build environment issue. Instantiating and using a DeviceManagerADB from the console still works fine:

wlach@eideticker:~/src/mozilla-central/build/mobile$ python
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import devicemanagerADB
>>> dm = deviceManagerADB.DeviceManagerADB()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'deviceManagerADB' is not defined
>>> dm = devicemanagerADB.DeviceManagerADB()
Android Debug Bridge version 1.0.29

'cp' not found, but 'dd' was found as a replacement
NOT running as root
adbd cannot run as root in production builds
NOT running as root
restarting as root failed
Blocks: 741994
Keywords: regression
Hardware: ARM → All
Comment on attachment 624797 [details] [diff] [review]
patch

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

::: mobile/android/build.mk
@@ +82,2 @@
>  endif
>  ifeq ($(ANDROID_SERIAL),)

You should put the export in the else case of this last test. r+ with that changed.
Attachment #624797 - Flags: review?(mh+mozilla) → review+
(In reply to Mike Hommey [:glandium] from comment #4)
> You should put the export in the else case of this last test. r+ with that
> changed.

Done.  https://hg.mozilla.org/integration/mozilla-inbound/rev/41fff59c307f
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/41fff59c307f
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: