Closed Bug 1066077 Opened 10 years ago Closed 9 years ago

[mozdevice] _verifyDevice is not raising an exception when there is no device attached

Categories

(Testing :: Mozbase, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: davehunt, Assigned: davehunt)

Details

Attachments

(1 file)

It took me a while to figure out what was going on here, but DeviceManagerADB._verifyDevice is currently not raising an exception when there is no device attached.

It would appear the assumption that |adb shell echo| would return None is incorrect, at least on my machine (Mac OS X 10.9.4 running Android Debug Bridge version 1.0.31).

For me, this command is returning 255, which after a quick search appears to be the code for 'device not found'. Changing the code in mozdevice to the following resolves the issue for me:

    if self._checkCmd(["shell", "echo"]) is 255:
        raise DMError("unable to connect to device")
Comment on attachment 8525985 [details] [diff] [review]
Raise an exception when there is no device attached. v1.0

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

Not sure how we missed this!

::: testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
@@ +646,5 @@
>              elif deviceStatus != "device":
>                  raise DMError("bad status for device %s: %s" % (self._deviceSerial, deviceStatus))
>  
>          # Check to see if we can connect to device and run a simple command
> +        if not self._checkCmd(["shell", "echo"]) == 0:

I would probably write this as if self._checkCmd(["shell", "echo"]) != 0
Attachment #8525985 - Flags: review?(wlachance) → review+
The last try had a bunch of failures, so I reran for emulator. It was much better:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=f827d780c649
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/528869f666ff
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.