phablet-test-run doesn't work with emulators out of the box, looks for 'usb' in adb

Bug #1270497 reported by Steve Langasek on 2014-01-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phablet Tools
Fix Committed
Undecided
Unassigned
phablet-tools (Ubuntu)
Medium
Sergio Schvezov

Bug Description

phablet-test-run includes the following code to select a "default" device to connect to:

if test -z $ANDROID_SERIAL; then
    ANDROID_SERIAL=$(adb devices -l | grep usb | cut -f 1 -d " " | head -n1)
fi
export ANDROID_SERIAL=$ANDROID_SERIAL

But this doesn't match the output of 'adb devices' for the ubuntu emulator:

$ adb devices -l
List of devices attached
emulator-5554 device product:occam model:Nexus_4 device:mako

$

I think phablet-test-run should just default to whichever device is the first listed, regardless of whether it's connected over usb:

    ANDROID_SERIAL=$(adb devices -l | awk '/device .*product/ { print $1; q }')

Or else, not set ANDROID_SERIAL at all by default, and pass through the normal behavior of adb: succeed without warning if a single device is connected, require $ANDROID_SERIAL or -s to be specified if there are multiple devices present.

Related branches

Steve Langasek (vorlon) on 2014-01-18
Changed in phablet-tools (Ubuntu):
status: New → Triaged
importance: Undecided → Medium

On 18/01/14 19:26, Steve Langasek wrote:
> Public bug reported:
>
> phablet-test-run includes the following code to select a "default"
> device to connect to:
>
> if test -z $ANDROID_SERIAL; then
> ANDROID_SERIAL=$(adb devices -l | grep usb | cut -f 1 -d " " | head -n1)
> fi
> export ANDROID_SERIAL=$ANDROID_SERIAL
>
> But this doesn't match the output of 'adb devices' for the ubuntu
> emulator:
>
> $ adb devices -l
> List of devices attached
> emulator-5554 device product:occam model:Nexus_4 device:mako
>
> $
>
> I think phablet-test-run should just default to whichever device is the
> first listed, regardless of whether it's connected over usb:
>
> ANDROID_SERIAL=$(adb devices -l | awk '/device .*product/ { print
> $1; q }')
>
> Or else, not set ANDROID_SERIAL at all by default, and pass through the
> normal behavior of adb: succeed without warning if a single device is
> connected, require $ANDROID_SERIAL or -s to be specified if there are
> multiple devices present.

This is the default behaviour for most tools and what to expect from
Android; I'm guessing someone had reasons to add this for ci or QA; I'll
track it down and ask if they have a use case for this; if not; changing
it to feel as the other helper tools.

Cheers

Changed in phablet-tools (Ubuntu):
assignee: nobody → Sergio Schvezov (sergiusens)
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:phablet-tools at revision 234, scheduled for release in phablet-tools, milestone Unknown

Changed in phablet-tools:
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package phablet-tools - 1.0+14.04.20140122-0ubuntu1

---------------
phablet-tools (1.0+14.04.20140122-0ubuntu1) trusty; urgency=low

  [ Sergio Schvezov ]
  * Tool to make it easier to build and test clicks. (LP: #1269163)
  * Removing device serial detection and using the same mechanism as in
    other tools. Removing the unnecessary call to adb root. (LP:
    #1270497)

  [ Francis Ginther ]
  * Allow use of a local package archive when installing packages by
    using 'phablet-config --package-dir'.

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 234
 -- Ubuntu daily release <email address hidden> Wed, 22 Jan 2014 17:23:59 +0000

Changed in phablet-tools (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers