Comment 1 for bug 1270497

Revision history for this message
Sergio Schvezov (sergiusens) wrote : Re: [Bug 1270497] [NEW] phablet-test-run doesn't work with emulators out of the box, looks for 'usb' in adb

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