History log of /external/autotest/server/hosts/adb_host.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d81f9d9a1f484f78ed7a0d901381afd966535d86 17-Mar-2017 Prathmesh Prabhu <pprabhu@chromium.org> [autotest] Add back afe_utils import in adb_host

A revert of the CL that removed some usages played badly with another CL
that (was on top and) removed the import.
Since then, others have used the import as well.

So, add the import back while things are in flux.
+ Fix another bug introduced by that revert that hadn't hit anybody yet
(methinks).

BUG=b:36390218
TEST=None

Change-Id: Ia067ba9721bff4ce8f5c1387cd27af59c896cc43
Reviewed-on: https://chromium-review.googlesource.com/457096
Reviewed-by: Dan Shi <dshi@google.com>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
/external/autotest/server/hosts/adb_host.py
3d92c0828540d24b5b2a83673ff82cba3fb42afb 15-Mar-2017 Benny Peake <bpeake@google.com> Fixed bug with download url

The devserver url was giving back inconsistent paths for files.
This has been changed on the devsever side to always be
case sensitive. This change is to reflect that.

BUG=b:36257342
TEST=None

Change-Id: I6aac21f60c9c55d1a555e4134a8485d77c90cdc9
Reviewed-on: https://chromium-review.googlesource.com/455984
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
Reviewed-by: Joe Brennan <jmbrenna@google.com>
Commit-Queue: Benjamin Peake <bpeake@chromium.org>
/external/autotest/server/hosts/adb_host.py
83904b1ded3752220ee088feecba1571e1e8ad63 09-Mar-2017 Benny Peake <bpeake@google.com> Added ability to save info about devices.

Testbed and adb hosts can now save info and will save the
build info used for each device.

BUG=b:36029261
TEST=Ran test, checked that files were there.

Change-Id: I15c0e8c2dbc81f7a5755cfda562b1cac9538a556
Reviewed-on: https://chromium-review.googlesource.com/452803
Commit-Ready: Benjamin Peake <bpeake@chromium.org>
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
d48b5aa7bb08b729f1d23d9a8233f073604b4c80 10-Mar-2017 Benny Peake <bpeake@google.com> Fixed bug where file name was appended to some URLs

When downloading a file the file name is appended to the
url if it does not end with that file name. URLs are always
lowercase, however files are not, thus if the case didn't
match the file name would be appended again.

BUG=b:35950125
TEST=None

Change-Id: Iec132596ddb467ae5c419d52ac2d3f349c737893
Reviewed-on: https://chromium-review.googlesource.com/452745
Commit-Ready: Jim Tan <jimtan@chromium.org>
Tested-by: Jim Tan <jimtan@chromium.org>
Tested-by: Benjamin Peake <bpeake@chromium.org>
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Jim Tan <jimtan@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
b6cea61e59b40819af04fbf9ced7dba75785d43e 10-Feb-2017 Prathmesh Prabhu <pprabhu@chromium.org> Replaces usage of afe_utils.get_labels with HostInfo properties

BUG=chromium:678430
TEST=None

Change-Id: I3502e1d6baddd9f598634077854030005ceef290
Reviewed-on: https://chromium-review.googlesource.com/440563
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
/external/autotest/server/hosts/adb_host.py
b9d7adf07aec05db6a3f1a8b74f45abd7a87c74a 07-Mar-2017 Prathmesh Prabhu <pprabhu@chromium.org> Revert "Use HostInfo to obtain host attributes"

This reverts commit 838f89f628e404bd3d657e5eb4b45c02bfb363b9.


Original change's description:
> Use HostInfo to obtain host attributes
>
> BUG=chromium:678430
> TEST=unittests
>
> Change-Id: I4ae2d4ee0c19eae5545eeb9ff01a7fe8853bc34d
> Reviewed-on: https://chromium-review.googlesource.com/440366
> Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
> Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
> Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
>

TBR=pprabhu@chromium.org,ayatane@chromium.org
BUG=chromium:678430
BUG=chromium:699188

Change-Id: I36b47500518ef4a710145f35f730e53d40cdb0a0
Reviewed-on: https://chromium-review.googlesource.com/450845
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
/external/autotest/server/hosts/adb_host.py
e6a167df3bcd25ed5ecd0c014f434cae9f427b46 06-Mar-2017 Dan Shi <dshi@google.com> [autotest] Allow testbed to repair multiple devices

This CL fixes two bugs:
1. Allow all devices connected to the testbed to be repaired. So a single device
repair failure won't abort the testbed repair.
2. Make each device provision job run under different resutdir, or the name
collision will failed the test.

BUG=b:35841571
TEST=local repair

Change-Id: Ib75d5dba9b83027bf1248f03c2a451a98e71e23c
Reviewed-on: https://chromium-review.googlesource.com/450557
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
838f89f628e404bd3d657e5eb4b45c02bfb363b9 09-Feb-2017 Prathmesh Prabhu <pprabhu@chromium.org> Use HostInfo to obtain host attributes

BUG=chromium:678430
TEST=unittests

Change-Id: I4ae2d4ee0c19eae5545eeb9ff01a7fe8853bc34d
Reviewed-on: https://chromium-review.googlesource.com/440366
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
/external/autotest/server/hosts/adb_host.py
e104c89bdf8a10c0281909e01e5d87a97e89ac21 02-Mar-2017 Dan Shi <dshi@google.com> [autotest] Allow testbed repair to set adb_host's board and os in repair call

For host created in testbed, it does not have host labels and attributes.
Therefore, the board name and os needs to be passed in from the testbed repair
call. Then provision can get the stable build from the given board.

BUG=b:35841571
TEST=local repair

Change-Id: Ibe7edccbda21df005589c0d9e04ce80a828509e1
Reviewed-on: https://chromium-review.googlesource.com/448877
Reviewed-by: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
f6a15b490110c8b3ebedb8a563769207f94b8d83 01-Mar-2017 Dan Shi <dshi@google.com> [autotest] Skip reinstall if adb device is up already.

This is to prevent testbed from reinstall good devices.

BUG=b:35841571
TEST=None

Change-Id: Ibe70ec1ebd0de7de03a08dd5224197e3bc5b75d4
Reviewed-on: https://chromium-review.googlesource.com/448318
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Trybot-Ready: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
fadec8828d6d6d86df89bc6f73f90e0a29abe343 28-Feb-2017 Dan Shi <dshi@google.com> [autotest] Force android device repair to do reinstall.

Current logic tries to put the device into adb mode first in repair. That
leads to device repair can't be done automatically if the device has a bad
build on it and can't boot into adb mode, and it requires manual action to
put the device into fastboot mode.

BUG=b:35841571
TEST=local repair

Change-Id: I65a37f6695f5309c9f7fe058f3812a2629c88072
Reviewed-on: https://chromium-review.googlesource.com/448021
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
e8838cf8e272ba5ca28f2fe4bdfa6a1a1263fbff 10-Feb-2017 Benny Peake <bpeake@google.com> Refactored android provisioning to include alias system

-The mapping for android product name to board name acts more like
the image mapping now.
-Expanded the tool to allow for multiple aliases per phone.
-Included correct mappings for known android devices and image
files

BUG=b:33814254,b:32145046
TEST=Flashed seed and volantis device.

Change-Id: Ic38355bf301361cb5e70964990a9a397453908ab
Reviewed-on: https://chromium-review.googlesource.com/441285
Commit-Ready: Benjamin Peake <bpeake@chromium.org>
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
395b34785fabfb7d7e95c73f4e5973631c8e10b0 31-Jan-2017 Simran Basi <sbasi@google.com> [autotest] Cleanup adb_host.

BUG=chromium:687304
TEST=None

Change-Id: I7fcac881588a5d4ca322121c29abd8a4f134e3c5
Reviewed-on: https://chromium-review.googlesource.com/435559
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
d05ed02c9d6f906a779b80d2ecdd515a5a5eba1e 23-Jan-2017 Prathmesh Prabhu <pprabhu@chromium.org> [autotest] Do not preserve permissions on crash dumps.

We've seen tombstones with all permissions unset. This causes errors
later on when we try to read / copy the collected crashes. There is no
need to preserve permissions in this case.

BUG=chromium:684106
TEST=None.

Change-Id: Ia4d27bc7727630c35d31bb009bd808ee9f66ea4d
Reviewed-on: https://chromium-review.googlesource.com/431321
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
/external/autotest/server/hosts/adb_host.py
196c997233b7fb8334055206b4d348251364da64 18-Jan-2017 Benny Peake <bpeake@google.com> Fixed bug with atest create host and android devices

atest create host was crashing when creating an android device
because stop_loggers was assuming there was a valid job. This
caused a NoneType exception to be thrown.

BUG=b:34361289
TEST=Ran atest.

Change-Id: Icf61ae9c9730601e782845455d13daf47a2f099f
Reviewed-on: https://chromium-review.googlesource.com/430111
Commit-Ready: Benjamin Peake <bpeake@chromium.org>
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
701fde8fcace5c224a3e614c5e1b8b691346fdd4 12-Jan-2017 Simran Basi <sbasi@google.com> Rework adb_host/teststation_host closing.

The process of closing a host calls stop_loggers AFTER the ssh
connection has been disconnected. But for adb_host it grabs the
logs from the remote test station which opens a new ssh connection.

This change ensures that last SSH connection is properly cleaned up.

Lastly, removes the teststation optimization of not calling close, if
its already closed as it will be reopened by each DUT that is part of
the testbed.

BUG=chromium:679024
TEST=local testbed dummy test run and verified no stray ssh connections
remained afterwards.

Change-Id: Ia584813e49061f7f08300965027ac97fc872b44b
Reviewed-on: https://chromium-review.googlesource.com/427361
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
661fcc39f3bc04940d22142ec02197561caed9c3 22-Dec-2016 Benny Peake <bpeake@google.com> Added timeout to adb commands

Adb commands from the AdbHost will now timeout just like fastboot
commands.

BUG=b:33562943
TEST=Ran single test.

Change-Id: Ibbfc2bcdf1f43b40d51e62e75b93a39f97d59448
Reviewed-on: https://chromium-review.googlesource.com/423256
Commit-Ready: Kris Rambish <krisr@chromium.org>
Tested-by: Benjamin Peake <bpeake@chromium.org>
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
a4b5aa39fca765170c8004b54529f08ce584c370 20-Dec-2016 Benny Peake <bpeake@google.com> Setup wizard skip no longer fatal

The setup wizard on some builds does not exist. When trying to skip
the setup wizard on these systems the code ends up crashing. Failing
to skip the setup wizard does not need to be fatal so it will now
log an error and continue on with provisioning.

BUG=b:33424242
TEST=Provisioned phone with no setup wizard.

Change-Id: I0fa2df11e1049835ea66f12f4847c61ff5662062
Reviewed-on: https://chromium-review.googlesource.com/422411
Tested-by: Benjamin Peake <bpeake@chromium.org>
Tested-by: Bindu Mahadev <bmahadev@chromium.org>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
Commit-Queue: Bindu Mahadev <bmahadev@chromium.org>
Trybot-Ready: Bindu Mahadev <bmahadev@chromium.org>
/external/autotest/server/hosts/adb_host.py
7f162d5c050dc4229f634c347fb79a9bd04080f6 07-Dec-2016 tturney <tturney@google.com> Add board mapping for Android Auto devices

Bug:b:33218549
Change-Id: I896acfe1745bec6d0af058c1308b9712572fe964
Reviewed-on: https://chromium-review.googlesource.com/417703
Reviewed-by: Tom Turney <tturney@google.com>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
Commit-Queue: Tom Turney <tturney@google.com>
Tested-by: Tom Turney <tturney@google.com>
/external/autotest/server/hosts/adb_host.py
a529ebe652898b4ef78ffb337da62ca6e4924f6d 30-Nov-2016 Benny Peake <bpeake@google.com> Added timeout wrapper to fastboot commands.

Fastboot commands sometimes do not die and just sit in the background.
This uses the linux command timeout to kill the command after some
time.

BUG=b:31946096
TEST=Ran simple test to make sure phones could still flash.

Change-Id: If721a2c1f6e44e085ac715252cc6c54886d385c7
Reviewed-on: https://chromium-review.googlesource.com/415269
Commit-Ready: Kris Rambish <krisr@chromium.org>
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
bd7d54b99793a6d14290f7d7ea768484370f464b 22-Nov-2016 tturney <tturney@google.com> Skip qcom devices in verify_software

Android auto devices need to have their
hardware set properly once they are
full fledged devices. In order to get
automation running successfully on test
boards, skip this hardware check if
it is set to qcom.

Bug: 32337862
Change-Id: I7a5137648de4cb2f9bb0c17403d5f171f24824cc
Reviewed-on: https://chromium-review.googlesource.com/413586
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Tom Turney <tturney@google.com>
Reviewed-by: Tom Turney <tturney@google.com>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
/external/autotest/server/hosts/adb_host.py
73d00b7134e73b30553f8a25a55f389a0911ded0 27-Oct-2016 Benny Peake <bpeake@google.com> Android will now skip wizard on install

Android will now skip the install wizard by default on install.

BUG=b:28027976
TEST=Ran setup on phone and checked if wizard skipped.

Change-Id: I54a65fb0c282535759781694423279bf70acb084
Reviewed-on: https://chromium-review.googlesource.com/403522
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
9e825f4bbc930cb36a35adfc0a76ae3a52641c75 27-Oct-2016 Benny Peake <bpeake@google.com> Package verification turned off on android install

Package verification will now be turned off by defaul when android
is installed on a device.

BUG=b:32182262
TEST=Ran autotest provisioning and checked that command passed.

Change-Id: I67a2dfe478115880ffe43d419b881eaa5636ea8e
Reviewed-on: https://chromium-review.googlesource.com/403415
Tested-by: Benjamin Peake <bpeake@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
0613f91a0bcc8fc24d211c26e02b813932e540b6 21-Oct-2016 Simran Basi <sbasi@google.com> adb_host: Temporary device hardware/product exemption for msm8996

BUG=b:32337862
TEST=None

Change-Id: I1c8a8390674c2b4833c66d58c39f418715c20a14
Reviewed-on: https://chromium-review.googlesource.com/401848
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
14de762a33061ee078102f076e3e2b44274fc827 22-Aug-2016 Dan Shi <dshi@google.com> [autotest] Support Launch Control build starting with `P` for SSP

Also update the SSP code to log clear error message if stage_server_side_package
failed for any reason.

BUG=chromium:638039,chromium:632524
TEST=verify locally and in test push server

Change-Id: I435cf416726644d507119d6741f62322a6d1a1aa
Reviewed-on: https://chromium-review.googlesource.com/373569
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
f6ffe0c53b9df675f9612bccd9a2ce8b381f5916 16-Aug-2016 Justin Giorgi <jgiorgi@google.com> [autotest] Move to GenericHostRunError

AutoservHostError is not thrown on command failures AutoservRunError is.
This potentially breaks reboot checks in the lab because the device may
be down when the call is made.

TEST=Verified locally.
BUG=None

Change-Id: I41dd17198f2d9950a946693a9158f135241f4d38
Reviewed-on: https://chromium-review.googlesource.com/370822
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
38a859f0189650054a6f65898349e07cd95a1610 16-Aug-2016 Justin Giorgi <jgiorgi@google.com> [autotest] Added package uninstall.

BUG=None
TEST=Verified on moblab.

Change-Id: I6a9f0c7b12faa451f2d0301591d9bd4a9c4d453b
Reviewed-on: https://chromium-review.googlesource.com/371058
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
2e28393dd19f6b4e9afed589398f67071f55baad 12-Aug-2016 David Pursell <dpursell@google.com> adb_host: add get_file() sanity check and debugging.

It's difficult to determine from existing logs why get_file() might be
failing to copy file permissions from the device onto the host, so this
CL adds some additional debug logging as well as a sanity check to skip
permission copying if the file can't be found. This may allow us to
re-enable crash collection without breaking presubmits while we
continue to investigate this problem.

BUG=b:30740714
TEST=./site_utils/test_droid.py brillo_ADBFileTransfer.10iters
TEST=./site_utils/test_droid.py brillo_ADBDirectoryTransfer

Change-Id: Id62fe61032a5b65a951232e15fdbba1d5077facc
Reviewed-on: https://chromium-review.googlesource.com/368717
Commit-Ready: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
Reviewed-by: Ralph Nathan <ralphnathan@chromium.org>
/external/autotest/server/hosts/adb_host.py
6ee645357e48ac0a32a4543e29f58a7b6bc5d183 10-Aug-2016 Justin Giorgi <jgiorgi@google.com> [autotest] GenericHostRunError.

Renamed HostRunErrorMixIn to GenericHostRunError as a generic
error used for both client and server host.run failures. Fixed ADBHost,
EmulatedADBHost, EmulatorManager and all android/brillo tests to catch this
exception where they were catching one or both of AutotestHostRunError and
AutoservRunError.

TEST=Verified locally, ran unit tests.
BUG=None

Change-Id: I87e166bd580df7dd4b021e2fe0b426beaba2c270
Reviewed-on: https://chromium-review.googlesource.com/367015
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
3b758a343bbe8afc045e83923567b7236602229e 12-Aug-2016 Ralph Nathan <ralphnathan@google.com> brillo: Turn off native crash reporting.

Native crash reporting is causing tests in the lab. For now, turn off
native crash reporting for Brillo until we figure out what's going on.

BUG:b:30740714
TEST=none

Change-Id: Id4e83163e9ea84126b8505bda7c91c79a37617f3
Reviewed-on: https://chromium-review.googlesource.com/368450
Reviewed-by: Steve Fung <stevefung@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
/external/autotest/server/hosts/adb_host.py
ea3de26005a51c01aa198bf1993535f1f9771a16 09-Aug-2016 Justin Giorgi <jgiorgi@google.com> [autotest] Added detection of lightning reboots.

If the host reboots quickly we may not see it. wait_down can now
consider the host down if the boot_id changes.

TEST=Verified locally.
BUG=b:30741113

Change-Id: I3a2b34c472e8525adcd564a1e15e0dfc0ae3ea8d
Reviewed-on: https://chromium-review.googlesource.com/366886
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
b244ddb2b4ad5151f82a793b0711065ac8a12643 21-Jul-2016 Alex Deymo <deymo@chromium.org> adb_host: Sync the UTC time for M and later devices.

The "-u" option in the "date" command sets the UTC time instead of
localtime used by the adb host. This patch synchronizes the time of
the adb host in the UTC timezone with the autotest server time in the
UTC timezone so they match. The previous code was syncing the localtime
ignoring the timezones.

BUG=b:30265445
TEST=syntax check; manually test a "date -u" command.

Change-Id: I632537501c0dca4e8693d09b11d0674dcabb8df8
Reviewed-on: https://chromium-review.googlesource.com/362071
Commit-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Bryan Lewandowski <bryanlew@google.com>
/external/autotest/server/hosts/adb_host.py
35a39be4d20f41d2b9cf7695a4ad3805490ccf89 25-Jul-2016 Dan Shi <dshi@google.com> [autotest] Retry run command when fail to parse command exit code

For some reason, an adb command can pass but the return value is not in the
desired format of "ADB_CMD_OUTPUT:<value>"

This change retries the command when parsing failed.

BUG=b:29759939
TEST=local run command through adb_host

Change-Id: I64bf8daf08cf67c0e4021198f210ddd77d6dd0d1
Reviewed-on: https://chromium-review.googlesource.com/362876
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
8c96bb2b1eccf3bbfff88efb7cbed5bcf78b09c9 19-Jul-2016 Bryan Lewandowski <bryanlew@google.com> Reenable logging, warn on logging failure.

Reenables native crash logging, and considers the inability to
enable crash logging as a warning rather than an error. This
is important because the provision operation calls job_start(),
and depending on the preexisting image on the DUT, the attempt
to enable logging will fail. Note that job_start() is called
again to start the test case, so logging will be enabled once
the device is provisioned with the image under test.

BUG=chromium:623743
BUG=chromium:627134
TEST=Local test_droid on Brillo: android_DummyTest brillo_CrashLogging
TEST=Local test_droid on Android: android_DummyTest android_CrashLogging
TEST=Lab test_droid on Brillo: android_DummyTest brillo_CrashLogging
TEST=Guado MobLab on Brillo: android_DummyTest brillo_CrashLogging

Change-Id: I1da04f7f2c7c5133ea7befaf152afb4e2166f406
Reviewed-on: https://chromium-review.googlesource.com/362611
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
dd05a946c3e3edcceb2844d64e92c73466d5065b 06-Jul-2016 Justin Giorgi <jgiorgi@google.com> [autotest] Added Host for emulated adb devices.

Minor changes to factory and utilities. Added EmulatorManager class to
handle the grunt work and EmulatedADBHost to interface with emulated
devices.

CQ-DEPEND=360512
BUG=None
TEST=Ran dummy tests on emulator with install from go/ab. Also verified
on dragonboard.

Change-Id: I3058e886deeb256e9187c4313d34f807b34eb58d
Reviewed-on: https://chromium-review.googlesource.com/360220
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
6708ea672c2e0b9a86b27e8e6c964ee99f9faa39 19-Jul-2016 Bryan Lewandowski <bryanlew@google.com> Disable/revert log collection while we look into an issue in Brillo.

BUG=chromium:623743
TEST=Local test_droid on Brillo and Android log/dummy tests.

Change-Id: Ib1189d0dfcba08576fc2ae39108d463bea4fd222
Reviewed-on: https://chromium-review.googlesource.com/361375
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Ralph Nathan <ralphnathan@chromium.org>
/external/autotest/server/hosts/adb_host.py
1cbf3816a82b2848d8a8dd89d4246a9300098c07 19-Jul-2016 Dan Shi <dshi@google.com> Revert "[autotest] Add retry to adb command passed but return value failed to be parsed."

This reverts commit fecac0ca3361aeb558d7a079b9afb016fcc4ae6d.

Change-Id: Idc3cf6db34c1198b6b2cb7145938bee38230183a
Reviewed-on: https://chromium-review.googlesource.com/361540
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
84a71ba953ff70ca78d9cc3a1535bd784848ede1 14-Jul-2016 Kevin Cheng <kevcheng@chromium.org> [autotest] Update some afe_utils methods to use host._afe_host.

Updated the following methods to use local host._afe_host.labels:
- get_labels
- get_board
- get_os
- get_build

Also updated callers as well since it used to return a list of Label
objects, now it returns a list of strings.

BUG=None
TEST=unittests and tryjob on wolf-paladin with hwtests.

Change-Id: Ib1ab3b4fea5d69d2e587a0d09ef0f3463915e11e
Reviewed-on: https://chromium-review.googlesource.com/360512
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
fecac0ca3361aeb558d7a079b9afb016fcc4ae6d 16-Jul-2016 Dan Shi <dshi@google.com> [autotest] Add retry to adb command passed but return value failed to be parsed.

For some reason, an adb command can pass but the return value is not in the
desired format of "ADB_CMD_OUTPUT:<value>"

BUG=b:29759939
TEST=local run command through adb_host

Change-Id: If026b67586d18fea478801daf6df13f624a610b0
Reviewed-on: https://chromium-review.googlesource.com/361021
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
5208eaac79f67826fb546d3c3516d6b04e467e3e 03-Jul-2016 Justin Giorgi <jgiorgi@google.com> [autotest] Added per-host ssh parameters.

Parameters are stored as host attributes ssh_user, ssh_port,
ssh_verbosity_flag and ssh_options. Password is intentionally not stored. The
verbosity flag and options are only used by CrosHost.

No modifications necessary to ssh host objects because they already
receive and utilize the parameters. Only modified factory to pull
arguments from attributes before using existing defaults. Testbed and ADBHost
were modified to pass the arguments through.

Also fixed typo in factory and added tests.

Modified atest host create to pass simulated afe_host so that detection
of parameters by host attributes works even before the attributes are in
afe.

BUG=chromium:620196
TEST=Unit tests of changes to factory, confirmed manually locally and on
moblab.

Change-Id: I61ff857edf28b973d8241a275456219782f2ff03
Reviewed-on: https://chromium-review.googlesource.com/353040
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Justin Giorgi <jgiorgi@google.com>
/external/autotest/server/hosts/adb_host.py
68646b610fad1a951f9d5f6dac839acb0f442bf2 12-Jul-2016 Bryan Lewandowski <bryanlew@google.com> Autotest: Add Android tombstone collection, and a test for the same.

Other cleanup:
* Modifies the brillo_CrashLogging test to remove any previous crash logs
* Adds OS labels to the control files

BUG=chromium:627134
TEST=test_droid with Nexus 5 local device
TEST=test_droid against local and remote Brillo devices
TEST=Additional android_CrashLogging test

Change-Id: I5be7ed48c5562ee0fe9174daf3c988eb6374cb1f
Reviewed-on: https://chromium-review.googlesource.com/360021
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
05ae2a45397188dd7d7adbc49a61095ebf85e151 06-Jun-2016 Kevin Cheng <kevcheng@chromium.org> [autotest] Store afe_host in and remove host attributes to/from machine dict.

There are multiple times when the AFE is queried for random bits of info
(host attibutes, labels, etc). To reduce the number of calls, store the
AFE host object into the machine dict so we can store it into the host class.
I chose the AbstractSSHHost class to grab it out of the arg dict since that
is used both by CrosHost and ADBHost.

Also removed host attributes as a class instance attribute since
afe_host contains all that info already.

Also use the os labels to do host class detection.

BUG=chromium:546741
TEST=Tested a couple scenarios:
- Manually on moblab to make sure cros/adb/testbed devices all pass
dummy tests.
- Trybot job on gnawty-paladin.
- Moblab dummy suite run to ensure no breaking backward compatibility changes
(moblab on R52 and testing with a tryjob gnawty build).
- test_{that,droid}.py on a cros/adbhost device.

Change-Id: I101c478c0f27f9fd444ccd4699a5c94e76d3b17e
Reviewed-on: https://chromium-review.googlesource.com/349990
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
11f8aedd8f1577ca7a94b7cf687064138fe35896 30-Jun-2016 Bryan Lewandowski <bryanlew@google.com> Add crash log collection for Brillo DUTs.

Added hooks for collecting native crash logs from ADBHost hosts.
Currently this is only available on Brillo. A test was added to
check that Brillo crash logs are created when a process is killed.

BUG=chromium:623743
TEST=test_droid against local device
TEST=test_droid against remote device
TEST=New test run with test_droid on both local and remote devices

Change-Id: I90d59a64e8485310051679c1897b475628d617c3
Reviewed-on: https://chromium-review.googlesource.com/357721
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
d37736b67febeebd991d0209dd030635f7ff5cfd 07-Jul-2016 Dan Shi <dshi@google.com> [autotest] Update stage_server_side_package to support restricted subnet.

If a dut is in restricted subnet, server-side packaging uses the devserver in
the same subnet of the dut. This leads to test failure as drone, which is
outside the restricted subnet, doesn't have http access to the devserver.

This change update method stage_server_side_package so it resolves a new
devserver outside restricted subnet if needed.

BUG=chromium:624554
TEST=local run test

Change-Id: I2c431fe7b0b8d4453978917e8a5e96fd310805f6
Reviewed-on: https://chromium-review.googlesource.com/358610
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
e6c4f14ceedaa14a56a9fc3192eb663c890cddf2 24-Jun-2016 Simran Basi <sbasi@google.com> adb_host: Log adb server's pid

Logs the pid of the adb server prior to calling any adb command.
This will be useful in debugging random adb failures.

BUG=b:29542030
TEST=test_droid local test run.

Change-Id: Id83949260653ec14be007ed6c7c57ed9c97dd7fc
Reviewed-on: https://chromium-review.googlesource.com/355745
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
cf7d2569c8a46bf420222a883e33db359e5217f1 16-Jun-2016 Dan Shi <dshi@google.com> [autotest] Only check dev.bootcomplete when dut boots into adb mode

dev.bootcomplete and sys.boot_completed should only be checked when the dut
boots into adb mode.

BUG=b:29392247
TEST=local test

Change-Id: I2c4770a22c4be89812214c9b477e33ebe531b7aa
Reviewed-on: https://chromium-review.googlesource.com/353350
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
1b4558eddf7c7fe517febddb15885f0f3c42eb60 15-Jun-2016 Dan Shi <dshi@google.com> [autotest] Remove sys.oem_unlock_allowed check for Android device

The check is done differently for different board. And its functionality will be
changed.

BUG=b:29371674
TEST=None

Change-Id: I41892454e959503e312a89475cc8d3d8e0b2a811
Reviewed-on: https://chromium-review.googlesource.com/352762
Commit-Queue: Dan Shi <dshi@google.com>
Trybot-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
/external/autotest/server/hosts/adb_host.py
68094121da94e7b4730b56386ea9a23473c8204c 10-Jun-2016 Dan Shi <dshi@google.com> [autotest] Ignore adb command failure when retrying to get a return value.

adb command can be flaky some time, and the command may fail and leads to an
AutoservRunError exception. This change stops the run method to raise exception,
thus allow more retries.

BUG=b:29272754
TEST=local run test

Change-Id: I76d5b066a3dd183437b04bea3dc80b86ce5d2ef5
Reviewed-on: https://chromium-review.googlesource.com/351571
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
242f8de9f5fbd6221a6ad6d5c3ca958c26bebdfe 08-Jun-2016 Simran Basi <sbasi@google.com> autotest: Logcat support for testbeds.

Updates adb_host to append the device serial to the logcat filename.
This will enable support for testbeds as each test has multiple
devices.

BUG=b:29082270
TEST=./site_utils/test_droid.py -s ZX1G22KTSC,ZX1G22KMZ6 -r \
android1758-row1-rack7-test-station-5.cros testbed_DummyTest
The resulting test results folder had 2 files:
logcat_ZX1G22KTSC.log & logcat_ZX1G22KMZ6.log

Change-Id: I2020c62426c2ccee7957b1a446a2f95e868f9c8d
Reviewed-on: https://chromium-review.googlesource.com/350931
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
3b6c117d96df8707b1940761715b2cdaedbc9c56 08-Jun-2016 Dan Shi <dshi@google.com> [autotest] Wait for dev.bootcomplete and sys.boot_completed to be 1 after reboot

This is to make sure the device is fully up to make getprop calls.
sys.boot_completed is only applicable to Android.

BUG=b:29064349
TEST=local run test
import common
from autotest_lib.server import hosts
host = hosts.create_host('100.96.51.111', adb_serial='123')
host.reboot()

Change-Id: If6926229cd4c82b0fc5ad7253a3344446bc008f5
Reviewed-on: https://chromium-review.googlesource.com/350770
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
d6b4979708b67deeb27809ec277821e7d022c648 08-Jun-2016 Simran Basi <sbasi@google.com> adb_host: Fix repair if the host is down.

Currently adb_host tries to setup logging before running any test
or special task. In the case of repair this is bad because the
device is unavaliable to receive the logging initialization
commands.

BUG=chromium:616826
TEST=Put a device in fastboot mode and tested repair.

Change-Id: I7596634eda49e5654f8d8ddeb321ca74836ec6a0
Reviewed-on: https://chromium-review.googlesource.com/350580
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
ea4a06d29336d6a2b5cae2509f460904176a3887 03-Jun-2016 Bryan Lewandowski <bryanlew@google.com> Add timeouts to run calls.

Logcat collection and time sync calls might fail. Add explicit timeouts
so that the default 3600 second timeout is not triggered. This case
happens when a device is or becomes unavailable.

BUG=chromium:616977
TEST=test_droid against local board
TEST=test_droid against remote test station's board

Change-Id: Iacea4d8d973337f3dd121ba6f64d3e889f38fa87
Reviewed-on: https://chromium-review.googlesource.com/349631
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
594a80eeebc41e7a197a0670081412da235d017e 01-Jun-2016 Bindu Mahadev <bmahadev@google.com> [autotest]Correcting check for directory on adb host

BUG=b:29057678
TEST=Tested locally

Change-Id: Idd2101d6272998cbd312ca29b884a1871588d11b
Reviewed-on: https://chromium-review.googlesource.com/348711
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Bindu Mahadev <bmahadev@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
c716ac68ef8f3d536314da95f4f96aa4e9d83f69 25-May-2016 Dan Shi <dshi@google.com> [autotest] Add retry to install_apk

Before each retry, reboot the dut to make sure the dut is in working condition.

BUG=b:28622153
TEST=local run

Change-Id: I59790870f4fb9813c77bc3e3e1c774d725584f8d
Reviewed-on: https://chromium-review.googlesource.com/347074
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
a1df0f2bead9a75e47cecbc83aaff476d7bd27a9 01-Jun-2016 Simran Basi <sbasi@chromium.org> Revert "android_ACTS: Skip setup wizard."

This reverts commit 7ef00a3e9f8dc448d2886b95cefb505c7120e893.

Change-Id: I6c90ba35dc80c0933072b48951e083d2ccbdee28
Reviewed-on: https://chromium-review.googlesource.com/348442
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
0f3f011ce18fa9c547cd5da40170742ae9ad0bf6 28-May-2016 Bryan Lewandowski <bryanlew@google.com> Enable logcat logging for adb_host.

1. Perform an approximate sync of host and server clocks so that logcat
and Autotest server/test-runner logs can be compared/matched.
2. Save ADB device's logcat as 'logcat.log' in the test job's results
directory. The entire logcat is included since there are often
boot-time errors which manifest as a test failure much later, for
example, a daemon crashing.

BUG=chromium:610699
TEST=L and M devices (for time-set function)
TEST=test_droid (on appropriate internal whitelisted targets)
TEST=test_droid on local and remote teststations

Change-Id: Ib7a0a7cf615fdc12ae69f90578bd3fe5160f6a55
Reviewed-on: https://chromium-review.googlesource.com/347989
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
973bf71c591d2811ecaf4b8b64f6eec1ddce6bc9 26-May-2016 Simran Basi <sbasi@google.com> test_droid.py: Support passing in fastboot serials.

Some devices may have a different adb/fastboot serial.
Allow test_droid users to supply the fastboot serial.

While this allows importing multiple fastboot serials,
the work to support testbeds is not yet ready.

BUG=None
TEST=quick test on test_droid.py

Change-Id: I2625f0b48076d33369630a33830e96b35e4cda5e
Reviewed-on: https://chromium-review.googlesource.com/347606
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
ac86aee120fc53a2f23ccbf6585a674769b28bfe 18-May-2016 Simran Basi <sbasi@google.com> android_ACTS: Skip setup wizard.

Skips the setup wizard following the installation of the sl4a apk.

BUG=b:28027976
TEST=None

Change-Id: I90507ebbe0c1f90ef21e92079c1435859579786b
Reviewed-on: https://chromium-review.googlesource.com/345573
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Ang Li <angli@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
8c51bdae69182834a7d1de6ee82a5c79f7eb65f2 26-May-2016 Dan Shi <dshi@google.com> [autotest] Add retry to adb getprop command to reduce flake

adb getprop command may return empty string some times, add retry to reduce
flake.

BUG=b:28961361
TEST=local run verify test
import common
from autotest_lib.server import hosts
serial = '123456'
host = hosts.create_host('100.96.51.111', adb_serial=serial)
host.verify_software()

Change-Id: I377f11beea1118c6755b11765dfd67f2dbbeecfc
Reviewed-on: https://chromium-review.googlesource.com/347742
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
2d279cf8dfece67dadd2d76dfff898169a2c84cd 28-May-2016 Dan Shi <dshi@google.com> Revert "Enable logcat logging for adb_host."

This reverts commit f21ef531bc634830a043d6b09e2976b571b56a71.

The reason is in the comment of patchset 9

Change-Id: If0b463e6d2d4b3d48b0454195a1c6eabde9b1b59
Reviewed-on: https://chromium-review.googlesource.com/348030
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
f21ef531bc634830a043d6b09e2976b571b56a71 10-May-2016 Bryan Lewandowski <bryanlew@google.com> Enable logcat logging for adb_host.

1. Perform an approximate sync of host and server clocks so that logcat
and Autotest server/test-runner logs can be compared/matched.
2. Save ADB device's logcat as 'logcat.log' in the results-#-suiteName
directory. The entire logcat is included since there are often
boot-time errors which manifest as a test failure much later, for
example, a daemon crashing.

BUG=chromium:610699
TEST=L and M devices (for time-set function)
TEST=test_droid (on appropriate internal whitelisted targets)

Change-Id: Ib4b9a0779e3c781140b6a589fc291863e5be44b3
Reviewed-on: https://chromium-review.googlesource.com/343911
Commit-Ready: Bryan Lewandowski <bryanlew@google.com>
Tested-by: Bryan Lewandowski <bryanlew@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
788b1b580aa5aa24a258fb445fa5e91d87cc2a32 19-May-2016 David Pursell <dpursell@chromium.org> autotest: Fix brillo_ADBDirectoryTransfer (take 2).

My last CL (https://chromium-review.googlesource.com/#/c/344413/)
didn't get rsync behavior quite right so paths were still broken when
copying directories to and from the device.

In particular, for a directory foo/, the command `rsync -a foo bar`
will create bar/foo/ instead of just copying foo/ to bar/, which was
what I had thought the behavior would be.

This CL fixes LocalHost behavior to actually match rsync and corrects
AdbHost get_file() permissions copying paths accordingly.

BUG=b/28150688
TEST=test_droid.py brillo_ADBFileTransfer.10iters \
brillo_ADBDirectoryTransfer
TEST=utils/unittest_suite.py autotest_lib.client.bin.local_host_unittest

Change-Id: I879bd1cde9f415a2f5545eba7268b599d23773c7
Reviewed-on: https://chromium-review.googlesource.com/346110
Commit-Ready: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
Reviewed-by: Casey Dahlin <casey.dahlin@gmail.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
626d54176ce6bcd520a91ef38362f5145180bb09 17-May-2016 Dan Shi <dshi@google.com> [autotest] Check if bootloader is locked in abd_host verify.

For lab devices, sys.oem_unlock_allowed should be 1. Set the device to repair
failed if bootloader is locked.

BUG=b:28794873
TEST=local run verify

Change-Id: I3cdf867539ed0c0f423da6ca84108578cb2b5b10
Reviewed-on: https://chromium-review.googlesource.com/344776
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
1e2a98a12d4cce06a17bbbf79190b86b43145af6 18-May-2016 Dan Shi <dshi@google.com> [autotest] Check adb_host's ro.boot.hardware and ro.build.product properties.

The two properties' value must match for Android device.

BUG=b:28794591
TEST=local run

Change-Id: I2b71c11e83a2d40e77efdbd263a1253e2b5ff787
Reviewed-on: https://chromium-review.googlesource.com/345912
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
e01548bf30d7d0102c7ff7b34153553e156359d3 11-May-2016 David Pursell <dpursell@chromium.org> ADBDirectoryTransfer: fix test breakage.

Fixes a few reasons why ADBDirectoryTransfer was breaking:

1. Differing send_file/get_file behavior on LocalHost vs SSHHost.
LocalHost was copying directory contents rather than the directory
itself. This CL changes LocalHost to match rsync behavior, which
should help avoid this case in the future by making local tests
behave the same as bot tests.

2. ADBDirectoryTransfer targeting.
The source/dest targeting in this test was set up to work based on
the old LocalHost behavior. This CL modifies the test to make sure
it's the whole directory that is sent, and adds an additional subdir
to make sure that also works as expected.

3. Preserving permissions in ADBHost get_file.
The permission transferring code had a few bugs for directories.
This CL fixes the pathing and variable names so that permissions will
be copied correctly for all the transferred files/directories.

BUG: b/28150688
TEST: test_droid.py brillo_ADBFileTransfer.10iters \
brillo_ADBDirectoryTransfer
TEST: unittest_suite.py fails the same tests as before.
Change-Id: I941444dbf34ca488e831ceac06a4a4e0b4abf828
Reviewed-on: https://chromium-review.googlesource.com/344413
Commit-Ready: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
Reviewed-by: David Pursell <dpursell@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
12a4f66097d7af858b7ce5b3dd5bbc347249ad93 10-May-2016 Dan Shi <dshi@google.com> [autotest] Add retry to fastboot run during reimage.

This is to reduce the flake from flash failure.

BUG=b:28680145
TEST=local reimage job

Change-Id: Ica944c88429c04af09ca0310f798f2cb5cc7030e
Reviewed-on: https://chromium-review.googlesource.com/343963
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
f6bc8edc1becd2980e08aa168672fe49194bcd38 13-Apr-2016 Casey Dahlin <sadmac@google.com> Fix adb_host get_file for directory transfers

We now handle permissions correctly for directory transfers. The only
thing missing is preserve_symlinks may not work as expected.

TEST=brillo_ADBDirectoryTransfer passes, after removing its hacks to get
around this bug
BUG=b:28071719

Change-Id: I67c3054a48d2e83eedbb07e74e6f02f4d1d7cacb
Reviewed-on: https://chromium-review.googlesource.com/338874
Commit-Ready: Casey Dahlin <sadmac@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
da995002902396c39e4cd46fffe7181648209c20 26-Apr-2016 Dan Shi <dshi@google.com> [autotest] Change apk force install to default to True

This is to help to reduce flakes from adb install.

BUG=b:28382692
TEST=None

Change-Id: I3e4f672209cff24eed9c34ab54a4947e1f668ebe
Reviewed-on: https://chromium-review.googlesource.com/340537
Commit-Ready: Kris Rambish <krisr@chromium.org>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
3a011ed46a847d711d2f769497073680a1846266 26-Apr-2016 Dan Shi <dshi@google.com> [autotest] Bug fix in adb_host init

For host without adb_serial specified in host attribute, test job will fail.
The bug is introduced in CL 336737
It also cause server-side packaging to fail as host attributes is not retrieved
from AFE while autoserv tries to stage server side package.

BUG=None
TEST=local run a test with server-side packaging.

Change-Id: I31e05a06a7d1d271b9e6b24a5ad971f2db6d2e06
Reviewed-on: https://chromium-review.googlesource.com/340761
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
224415e36f9e99d030aefa93aff5cbedc315ebb8 22-Apr-2016 Kevin Cheng <kevcheng@chromium.org> [autotest] Update ADBHost device regex for arc++ serial.

BUG=None
TEST=locally tested successfully created ADBHOST on minnie_cheets.

Change-Id: Ic274ee9fd528623b577ee26d45afe2ebe13ed5ca
Reviewed-on: https://chromium-review.googlesource.com/340440
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
7075f55ae1367d7c068d73ec91da50ab2254dffa 22-Apr-2016 Dan Shi <dshi@google.com> [autotest] Add retry when calling adb get-state

Default timeout is set to 10 seconds. This is to avoid flakes on dut
connectivity.

BUG=b:28202131
TEST=local test_droid run
Update android_DummyTest to call host.is_device_ready after waiting for 20
seconds.
./site_utils/test_droid.py -r 100.96.51.111 -s 2c462228 android_DummyTest

Change-Id: I6df53bc37e5c66d3222307ebdc12150c6aa2c02b
Reviewed-on: https://chromium-review.googlesource.com/340189
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
922de3043e93d6e4e547eaf2c76aca04355c0db5 23-Apr-2016 Dan Shi <dshi@google.com> [autotest] Retry adb root call

adb command may flake with error "device not found". Retry the root command
to reduce the chance of flake.

BUG=b:28343980
TEST=local test_droid

Change-Id: I675b66e26150a197cc68427c6999e2fc76c92e5d
Reviewed-on: https://chromium-review.googlesource.com/340471
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
49d451fac1f3189ea2dc84c544d4207059bc65fe 19-Apr-2016 Dan Shi <dshi@google.com> [autotest] Allow global config to specify list of images to install in Android.

This change adds the support to specify list of images to install in Android.
For example:
[CLIENT]
android_standalone_images_shamu: bootloader.img
android_artifacts_shamu: bootloader_image, zip_images, test_zip

Above settings will allow shamu device to skip flashing radio.img

BUG=b:28087501
TEST=unittest, local run

Change-Id: I0b83fd9be69c6a09e4d8da161bdfd1285d7db0a7
Reviewed-on: https://chromium-review.googlesource.com/339848
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
cfcb2cf34493decc28bcfd74542a928f16529380 13-Apr-2016 Kevin Cheng <kevcheng@chromium.org> [autotest] Update _get_devices to catch a general Exception for fastboot.

The latest update to getting the device serials via fastboot handle the
situation where fastboot does not return serials for TCP. There's a
check to see if the device is in fastboot mode with an expected timeout
but the try/catch looks for the wrong exception. I've switched out the
exception to be a general Exception with a comment explaining why.

BUG=None
TEST=locally on moblab

Change-Id: I47acf3d805e120aa471767ab0c8557c23c669723
Reviewed-on: https://chromium-review.googlesource.com/338871
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
043c45b809837590a729c4aa61763a8b23d753d7 12-Apr-2016 Dan Shi <dshi@google.com> [autotest] Wait for mount service to be up before installing apk

BUG=b:28095787
TEST=local run test

Change-Id: I631ed46f918b12bf5a484e0d3755d82f6b77125f
Reviewed-on: https://chromium-review.googlesource.com/338192
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
969ff7c7758a74898e9878bcead463578e41df86 30-Mar-2016 Alexandru Branciog <alexandru.n.branciog@intel.com> Add fastboot_reboot to adb_host

The brillo_BootLoader test fails for userdebug builds because
fastboot reboot is not followed by adb root.
Using the newly added fastboot_reboot which handles this
resolves the issue.

Fixed _assert_equal argument order.

Bug=27914750

Change-Id: I569259531b6c87d6713529cea508f035d61140e0
Signed-off-by: Alexandru Branciog <alexandru.n.branciog@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/336736
Commit-Ready: Alexandru N Branciog <alexandru.n.branciog@intel.com>
Tested-by: Alexandru N Branciog <alexandru.n.branciog@intel.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
ea380fb2a314dcfe73b8f7b421bc9407332ba72d 01-Apr-2016 Alexandru Branciog <alexandru.n.branciog@intel.com> Modify fastboot_serial for TCP

The brillo_BootLoader test is failing for boards that are using
adb and fastboot over TCP because adb and fastboot serials differ.
Prepend "tcp:" to the IP retrieved from adb serial to
obtain fastboot serial

Fastboot devices does not list serials for TCP. In order to chack that
the device is in fastboot mode we check that fastboot getvar
is successful

b:27915323

Change-Id: I7409819b3e0881ca7ddc5f67ccdd6e4a3548681f
Signed-off-by: Alexandru Branciog <alexandru.n.branciog@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/336737
Commit-Ready: Mohammed Habibulla <moch@google.com>
Tested-by: Alexandru N Branciog <alexandru.n.branciog@intel.com>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
9c5d3983729e7dbdd2e5ca449c26594c59bc726a 02-Apr-2016 Simran Basi <sbasi@google.com> adb_host: Wait for package service & map product name to target.

* Updated install_apk to wait for the package service to be running.
* Update get_board_name to check a product to build target map.

BUG=b:27934416,b:27804717
TEST=Used test_droid and a custom test to verify functionality.

Change-Id: Ie898d0fc78158462ce70a1fe154cc724302bc0c7
Reviewed-on: https://chromium-review.googlesource.com/336904
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
7756a0b6949729cb5a632955ebd8fe5dbd308c08 16-Mar-2016 Simran Basi <sbasi@google.com> brillo_Gtests: Support running in the lab.

* Updated brillo_Gtests to download and install the nativetests
package when running in the lab.
* Updated/refactored adb_host's download_file method to handle
unzipping of files.
* Fixed a bug in get_build_from_afe to support Android/Brillo
builds.

BUG=b:26967765
TEST=Ran brillo_Gtests on a MobLab.

Change-Id: I26c968a8d0a3fc7556e40ee1c11ad0bb4d5c8854
Reviewed-on: https://chromium-review.googlesource.com/336271
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
9228a6fdc22d9161770f082028b303f96f6658e5 29-Mar-2016 Simran Basi <sbasi@google.com> adb_host: Support running tests over TCP/IP

* Cleaned up the old unused TCP/IP logic.
* Updated the adb_host to enable TCP/IP mode if the serial contains
a port. When this mode is enabled, test_droid instructs the test
station to adb connect to the device when resetting the adbd
connection.

BUG=chromium:598789
TEST=test_droid.py -s 192.168.86.113:5555 brillo_DiskSizeTest &
test_droid.py -s 92c52320 brillo_DiskSizeTest

Change-Id: Idb4b495c363699e99d84bad1a251341f60aa5e77
Reviewed-on: https://chromium-review.googlesource.com/335683
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: David Pursell <dpursell@chromium.org>
/external/autotest/server/hosts/adb_host.py
049803707f7b3b047d5baccb64225b6a7c439801 22-Mar-2016 Dan Shi <dshi@google.com> [autotest] Add a timeout in fastboot reboot command and ignore timeout error

BUG=b:27624929
TEST=local run
import common
from autotest_lib.server import hosts
host = hosts.create_host('100.96.51.111')
host.ensure_adb_mode()

Change-Id: I24631fd5cb687dd98bb4e64479f8258e8e35404a
Reviewed-on: https://chromium-review.googlesource.com/334297
Trybot-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
70c30198f336186e460dd6fdd3ed214c7a3d31ac 23-Mar-2016 Dan Shi <dshi@google.com> [autotest] Reduce parse file limit from 512MB to 256MB

512MB is still too big and failing fastboot flash.
256MB is tested to be working.

BUG=b:27804588
TEST=None

Change-Id: If64202f1ffc1405f5454413791a79a095421f2bd
Reviewed-on: https://chromium-review.googlesource.com/334483
Commit-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Kris Rambish <krisr@chromium.org>
/external/autotest/server/hosts/adb_host.py
6450e148ba84c878490b4ea166218430fd393ddd 11-Mar-2016 Dan Shi <dshi@google.com> [autotest] Support run_suite with suite package and SSP for Brillo.

This change allows one to run run_suite command without using
--run_prod_code for Brillo build.
create_suite_job will use test_suites and control_files packages from
the Brillo build to create suite job and its test jobs.

Server-side packaging is also supported for newer builds that have
autotest_server_package artifact build.

BUG=chromium:584705
TEST=run in local instance, unittest, verify in moblab

Change-Id: Ia96ca4de919b178302580c23f911bb6445016285
Reviewed-on: https://chromium-review.googlesource.com/332431
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
c6a645adaf6f134d9457cf8b5d3408d66bfbb1ef 18-Dec-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Create new Base Label class.

This is to create the scaffolding for the base label scheme and to move
ADBHost and TestBed over since they only have one label for now. A
separate cl will move CrosHost over since there are many more labels
there.

Also add in the os label for ADBHost.

BUG=chromium:571085
TEST=Ensure adbhost and testbed create the same labels as before in
addition to the os label and unittests

Change-Id: Ief3961d05be030f81fe7cb8c9846f04c4e92b8e5
Reviewed-on: https://chromium-review.googlesource.com/319483
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
91b4235943abccda4c9d3b51690f69be66738fcf 11-Mar-2016 Dan Shi <dshi@google.com> [autotest] Bug fix in brillo provision

The missing space in command line causes provision-device command to
fail.

BUG=None
TEST=None

Change-Id: I48f5fd2fefd78f6162091debe6a617fbbd01ac37
Reviewed-on: https://chromium-review.googlesource.com/332202
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
e9913d3a848f6e89516b458496dd7f863b2f0aa0 09-Mar-2016 Dan Shi <dshi@google.com> [autotest] Automatically sparse files greater than 512MB for fastboot call

When flash large image files, e.g., system.img, fastboot might fail due
to the size limit. For example, fastboot call will post following
warning:
target reported max download size of 536870912 bytes

system.img file larger than that may fail the flash attempt. To make the
flash more reliable, pass `-s 512M` to fastboot command so it can
automatically sparse files greater than 512MB.

BUG=b:27463702
TEST=local run test

Change-Id: I655e7d5701862a913f79bf7c21211168b53970ce
Reviewed-on: https://chromium-review.googlesource.com/332061
Trybot-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
86bd8c01e2a67e29c110f82e98d25aa61be4dd4a 10-Mar-2016 Dan Shi <dshi@google.com> [autotest] Specify serial in brillo provision

Serial should be specified when provisioning a brillo device. Otherwise,
teststation with multiple brillo device connected may get confused.

BUG=b:27581956
TEST=local run provision-device command in a teststation

Change-Id: Icb9caa43b19cdc11bbea894ab1f9e1d7c958d742
Reviewed-on: https://chromium-review.googlesource.com/332063
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
Commit-Queue: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
18848d47e1c8e7331f7a76e1361c4f587d69585a 09-Mar-2016 Dan Shi <dshi@google.com> [autotest] Bug fix in waiting for ADBHost.is_up

When multiple devices are connected to a test bed, we should only run
is_device_ready when `adb devices` command lists the serial of the
device. Otherwise, is_device_ready call will fail with an error.

BUG=chromium:592806
TEST=local run test.

Change-Id: I15f9004be68cc29535d82236e2f53e4da34dd45b
Reviewed-on: https://chromium-review.googlesource.com/331785
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
d21d66ae567f7fd77d60df9b8b826b65cf333b82 01-Mar-2016 Christopher Wiley <wiley@google.com> Tolerate missing directories in ADBHost.list_files_glob

BUG=b:26425238
TEST=`test_droid.py dummy_PassServer` doesn't complain while fetching
crash dumps

Change-Id: I5f8542ef6d9f608b975ab67b8d72684b9cbecbe8
Reviewed-on: https://chromium-review.googlesource.com/329940
Commit-Ready: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
6cf6d2fa8d69d9896eba005310e110fa521b9cc3 30-Jan-2016 xixuan <xixuan@google.com> autotest: Use SSH Tunnel For Communication to Servo & Chameleon

Create a ssh tunnel for autoserv to communicate to servo/chameleon.
ServoHost/ChameleonHost call rpc_server_tracker to create a safe ssh connection
to servo/chameleon.

Related Change:

1. In AbstractSSH, remove |rpc_port_forward| since it does the same thing
as |create_ssh_tunnel|.

2. In AstractSSH, Change |rpc_port_disconnect| to |disconnect_ssh_tunnel|
since that the whole function is about to disconnect the existing ssh tunnel.

3. Add an exception of input arg 'command' in |xmlrpc_connect| of
rpc_server_tracker, so that it can be reused by ServoHost and ChameleonHost.

4. Add a |enable_ssh_tunnel_for_servo|/|enable_ssh_tunnel_for_chameleon| flag
to enable/disable ssh tunnel for servo/chameleon.

The refactoring of SSH tunneling code in ChameleonHost will be in a seperate CL
related to BUG=chromium:588806.

BUG=chromium:582646
TEST=For Servo:
Ran platform_ServoPowerStateController in local autotest instance & moblab to
test enable/disable SSH tunnel connection to ServoHost.
Ran network_WiFi_SimpleConnect.wifi_check11g in local autotest instance &
moblab to ensure that rpc_server_tracker still works other tasks.

For Chameleon:
Ran display_ServerChameleonConnection in chromeos2-row1-rack4-host4 to test
enable/disable SSH tunnel connection to ChameleonHost.

Change-Id: I45b5191f088f72819641f19d457d38a9d29cf1fd
Reviewed-on: https://chromium-review.googlesource.com/324841
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
/external/autotest/server/hosts/adb_host.py
5d7a7098589fe52703cda3788ce889588c42e7e4 23-Feb-2016 Mike Frysinger <vapier@chromium.org> test_droid: make serial # optional

Users need not specify the serial # by default when they only have one
device attached.

This also fixes the serial number parser to allow dashes as this shows
up in the emulator:
emulator-5554 device

BUG=b:27301538
TEST=read the doc
TEST=`./test_droid.py brillo_Gtests` works w/emu (auto-detected)
TEST=`./test_droid.py brillo_Gtests -s emulator-5554` works w/emu
TEST=`./test_droid.py brillo_Gtests -s alsdkjf` fails as it can't find device

Change-Id: I3b64fe898beea5222c64074b3ffee2e86f10eecf
Reviewed-on: https://chromium-review.googlesource.com/329140
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
db0366c921c4067beb88f94a1b9df7ddf9265a37 19-Feb-2016 Dan Shi <dshi@google.com> [autotest] Add a utility to install apk to an Android device

The method install_apk_from_build will use the job_repo_url of the host
to get build information, and install the given apk from the given build
artifact.

BUG=chromium:586320
TEST=local run test
modify testbed_DummyTest.py to install apk
from autotest_lib.server import adb_utils
adb_utils.install_apk_from_build(testbed.adb_devices['ZX1G22K3SQ'],
'sl4a.apk', 'test_zip')
Run the test in local Autotest instance with a image, e.g.,
git_mnc-release/shamu-userdebug/LATEST
Confirm the apk is installed.

adb_utils.install_apk_from_build(
testbed.adb_devices['ZX1G22K3SQ'], 'sl4a.apk', 'test_zip',
package_name='com.googlecode.android_scripting',
force_reinstall=True)
Confirm package is reinstalled
adb_utils.install_apk_from_build(
testbed.adb_devices['ZX1G22K3SQ'], 'sl4a.apk', 'test_zip',
package_name='no such package',
force_reinstall=True)
Confirm the package install failed due to package not found.

Change-Id: I1b9aa7668a97e18f4cde5b6f1532e8e3c4d830ab
Reviewed-on: https://chromium-review.googlesource.com/328478
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
08ff128c59a0fda5f76faba06e4d89f8d9dc6d26 19-Feb-2016 Dan Shi <dshi@google.com> [autotest] Add support for devserver call locate_file

This change update the client lib of devserver in autotest to make
locate_file call.

BUG=chromium:586320
TEST=local run script
import common
from autotest_lib.client.common_lib.cros import dev_server

build_info = {'branch': 'git_mnc-release',
'target': 'shamu-userdebug',
'build_id': '2419303',
'os_type': 'android'}

build_name ='%(branch)s/%(target)s/%(build_id)s' % build_info
devserver = dev_server.AndroidBuildServer.resolve(build_name, 'localhost')
print devserver.locate_file('sl4a.apk', 'test_zip', None, build_info)

Expected return:
http://1.1.1.1:8080/static/git_mnc-release/shamu-userdebug/23/DATA/priv-app/sl4a/sl4a.apk

Change-Id: I94ab40a169f900f95ecb69d68c5cf1dadf94875d
Reviewed-on: https://chromium-review.googlesource.com/328477
Commit-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
be3636ad815a877f4f951e5fd61794b769203d0c 15-Feb-2016 Dan Shi <dshi@google.com> [autotest] Update job_repo_url_[serial] after adb devices is provisioned

The job_repo_url_[serial] will be used for tests to stage more build
artifacts.

This change also refactor the return value of machine_install. The
return is now a type of (image_name, host_attributes). host_attributes
is a dictionary of attribute: value. The caller, e.g.,
afe_utils.machine_install_and_update_labels, will be responsible of
remove and update the host attributes.

BUG=chromium:586327
TEST=local run provision for both cros and adb devices.
./site_utils/test_droid.py ZX1G22K3SQ android_DummyTest

Change-Id: Idaaa0377a93c6587f18af5c2ab17971dcec86a66
Reviewed-on: https://chromium-review.googlesource.com/327671
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
beb2bb20028027fa31c2790e54619c82f4d51422 04-Feb-2016 Simran Basi <sbasi@google.com> [autotest] Support adb_host repair

Implements a basic repair function for adb_host which
runs provision_AndroidUpdate if the device is reachable
via fastboot. The repair image will be retrieved from
global_config or the DB if it is set.

BUG=b:26879108
TEST=local moblab repair.

Change-Id: I26a962c1bf458a8b02ad66efbc2c2bda99530320
Reviewed-on: https://chromium-review.googlesource.com/325519
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
5ace6f2e17f808efbee863a7d7dbe1bc52527a19 07-Jan-2016 Simran Basi <sbasi@google.com> [autotest] Support Android/Brillo suite runs.

This change does 3 key things:

1) Enables suite runs to use the production code currently
deployed on the lab servers. This disables this requirement
and now run_suite.py can be passed --run_prod_code. This means
that it will use the control files on the drone and SSP has
been disabled.
2) Refactors out the AFE interactions for applying version labels
out of the host objects. These utilities are in a new module
called afe_utils. The afe_utils:host_in_lab function
determines if a host is running in an lab environment and if
it is in the AFE.
The introduction of afe_utils enables further cleanup of the
cros_host object.
3) Enables provisioning for Android/Brillo devices. Added a new
site-test and provision attribute. Run_suite will determine
if an Android/Brillo build is being used and will set the
correct version prefix. Then the scheduler/provision code
will find an appropriate device and kick off the
provision_AndroidUpdate test to install the build prior to
test runs.

BUG=chromium:574566
TEST=On my moblab:
./run_suite.py --build=git_mnc-brillo-dev/dragonboard-userdebug/2558576 \
--board=brillo-dragonboard --suite_name=brillo-bvt --run_prod_code \
--pool=''
./site_utils/run_suite.py --board=peppy --build=peppy-release/LATEST \
--suite_name=dummy --pool=''
test_that 100.96.51.40 dummy_PassServer
DEPLOY=apache

Change-Id: I5a81e6bd989188b7c0621e2a76752a39033f9782
Reviewed-on: https://chromium-review.googlesource.com/323781
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
e234deaef7529852c91383f3136fecb3ef52bcd8 21-Jan-2016 Dan Shi <dshi@google.com> [autotest] Allow provisioning multiple DUTs without specifying serial.

This change enables provisioning multiple DUTs without specifying serial.
For example, image name can be:
git_mnc-release/shamu-userdebug/LATEST,git_mnc-dev/shamu-userdebug/LATEST
testbed will allocate dut based on the board specified in each build name.

BUG=chromium:574543
TEST=local run test

Change-Id: Iae60e0f6dd3c55dc00b84f8ad6c37ebd2decc432
Reviewed-on: https://chromium-review.googlesource.com/322769
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
7e52c625ecf8d55aa127b67ca00fbf3d5b270bc5 06-Jan-2016 Simran Basi <sbasi@google.com> autotest: Ensure fastboot commands use sudo when required.

Previously we only prepended sudo when running on MobLab.
This is technically incorrect as some ACTS test stations
will be using user adb and will need to use sudo when
running provisioning.

Also prepends sudo to the Brillo provision command.

BUG=None.
TEST=Quick test on moblab.

Change-Id: I1487f28929b1a9641834a262db40d055aee39420
Reviewed-on: https://chromium-review.googlesource.com/320492
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
31355948357f266e95432783d1ff697f0972410e 05-Jan-2016 Kevin Cheng <kevcheng@chromium.org> [autotest] Add ability for adbhost to install apk.

BUG=chromium:574161
TEST=locally tested on a hammerhead with the latest GmsCore apk.
Verified the apk was installed by checking the version after
installation.

Change-Id: Ifda3953302d8acb1c8d26046f14a888a10bbcc06
Reviewed-on: https://chromium-review.googlesource.com/320396
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
50a412a8074bea54ea184b11a7bf615d6e242f8b 05-Jan-2016 Dan Shi <dshi@google.com> [autotest] Support provisioning multiple duts connected to a testbed

This is the first step to support provisioning multiple duts connected to a
testbed. The image string entered in afe create job tab should specify the
serial of each build to install, e.g.,
branch1/shamu-userdebug/LATEST:serial1,branch2/shamu-userdebug/LATEST:serial2

BUG=chromium:574173
TEST=local run test
http://dshi.mtv/afe/#tab_id=view_job&object_id=3251

Change-Id: I10d357a34a024ca2b2d2058397f3e2927aa23c70
Reviewed-on: https://chromium-review.googlesource.com/320591
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
216389cfb1c687a90581cfdd62cbff0535bb6c1f 22-Dec-2015 Dan Shi <dshi@google.com> [autotest] Locate devserver in restricted subnets

Add a new config (CROS/restricted_subnets) to specify a list of subnets that
requires devserver within the same subnet.

In devserver.ImageServer.resolve function, always pass in the hostname to check
subnet restriction. This does add a bit overhead to do IP lookup.

BUG=chromium:571651
TEST=local test

Change-Id: Id3e47c315523d6bc7d40e1c5fbedd1733147b8b9
Reviewed-on: https://chromium-review.googlesource.com/319612
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
3994260114ebb551ed259e39a29efd4aba871cd2 17-Dec-2015 Roshan Pius <rpius@google.com> adb_host: Invoke |close| on the associated teststation

When |AbdHost.close()| is invoked, it should also close the associated
teststation object. This ensures that all RPC servers, etc created on
the teststation is cleaned up as well.

BUG=chromium:570802
TEST=`test_that --autotest_dir=../third_party/autotest/files
chromeos3-row1-rack1-host3.cros
network_WiFi_ChaosConnectDisconnect.open`

Change-Id: I7f50a69170669f167bdf7ce7ece34d6988d601d3
Reviewed-on: https://chromium-review.googlesource.com/319160
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
49f7b81b92c6a82c4d609ab492360fa0eee392c6 16-Dec-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Update atest to handle testbed creation.

Update cli/atest to create a testbed if more than 1 serial is passed in.

BUG=chromium:548739
TEST=Added a testbed with multiple devices (shamu,hammerhead,angler) via
atest and saw proper labels get added.

Change-Id: I056736f600606770ff1430165206f1cfc9b6220a
Reviewed-on: https://chromium-review.googlesource.com/318770
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
de8f9d11cd3c71cdbcb588091f0616f3f2eb295a 16-Dec-2015 Kris Rambish <krisr@chromium.org> When doing an ADB reboot make sure device is ready.

Check that device state before returning that the device
reboot is complete. A test should have to pool for the device
waiting for the correct state.

I was also unclear why adb_host does not take advantage of
adb 'wait-for-device' as this is only used in initialize, but
tests will want to reboot a device in the middle of a test.

TEST=Manual; Ran it
BUG=chromium:570437

Change-Id: I6f6bc6ff137d7b501c20e75d88b265695bf37ce4
Reviewed-on: https://chromium-review.googlesource.com/318653
Commit-Ready: Kris Rambish <krisr@chromium.org>
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
64e130fab5c0ef4c59bdff4cd52159cc635bc45f 16-Dec-2015 Dan Shi <dshi@google.com> [autotest] Only check host.user if it's set.

BUG=None
TEST=local

Change-Id: I7ba7936c01413bb3c4ccc2ed04796fee946cd9c1
Reviewed-on: https://chromium-review.googlesource.com/318842
Commit-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
4d7540cdcd4b423c41b36044ca1aabaf3cdcf784 16-Dec-2015 Roshan Pius <rpius@google.com> adb_host: Retsart adbd with root on every reboot

Ensure that we restart adb with root permissions on every reboot of the
DUT. This property is not persistent on userdebug builds.
Add a helper method to reset adbd connection after very device
reset/initialization.

BUG=b:26230536
TEST=`test_that --autotest_dir=../third_party/autotest/files
android1758-wifi-test-station-2.cros network_WiFi_MissingBeacons
--args use_wpa_cli=false`

Change-Id: I10549f9638d2f2d31025cbf1b140d25e92614c4a
Reviewed-on: https://chromium-review.googlesource.com/318851
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
14622bb8249c2200e5258ea6d40b3362229e90a7 25-Nov-2015 Simran Basi <sbasi@google.com> [autotest] test_droid V1.

This CL introduces test_droid, a script to launch autotest
tests against local Android DUTs connected to the host
computer via USB.

Much of the logic is similar to test_that, so this has all
been pulled into a new script test_utils.py

Pending work:

* Moving of generate_test_report to somewhere it is accesible
outside of the chroot.
* Add in support for remote adb hosts (i.e. the DUT is
connected to a remote computer).
* Sequences support.

BUG=b:25748759
TEST=./test_droid.py 7d52318 brillo_WhitelistedGtests
CQ-DEPEND=CL:315230

Change-Id: Idab3805f7921173fbc706354b322f37244240fa2
Reviewed-on: https://chromium-review.googlesource.com/314870
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
/external/autotest/server/hosts/adb_host.py
e4e807bb6769ca7a4c497a710ca9a369c5fef5ba 10-Dec-2015 Dan Shi <dshi@google.com> [autotest] Increase wait time to 900s for Android device provision.

Also default device wipe to True to wipe all user data during provision.

BUG=chromium:568395
TEST=local verify

Change-Id: I6f3805f0743645d8a4feda96201978b4f866647a
Reviewed-on: https://chromium-review.googlesource.com/317268
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
/external/autotest/server/hosts/adb_host.py
ab999721eeb8ddddf42bfa49cc25da1233238535 04-Dec-2015 Dan Shi <dshi@google.com> [autotest] Enable provisioning Brillo device from autotest

This change adds the support of provision Brillo device from autotest. Methods
are added to adb_host, so machine_install knows how to provision a Brillo
device with given build, e.g., git_mnc-brillo-dev/dragonboard-userdebug/LATEST.

BUG=chromium:548881
TEST=moblab setup, set build to git_mnc-brillo-dev/dragonboard-userdebug/LATEST
http://dshi.mtv/afe/#tab_id=view_job&object_id=3066
also make sure the change doesn't break Android provision
http://dshi.mtv/afe/#tab_id=view_job&object_id=3027

Change-Id: I299349301067572e7f4ee6792e19da3853e657f3
Reviewed-on: https://chromium-review.googlesource.com/315775
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
85e864a0b6e00c2c2de0bbb698ff927822916a0e 30-Nov-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Add in teststation host class.

Add in the teststation host class to reduce the duplicated test station
init code spread out among ADBHost and TestBed.

BUG=chromium:548739
TEST=Verified locally on moblab with moblab/angler and
moblab/[beaglebone-dragon]

Change-Id: Id3d9733fe3bdcf88ac82fb5a73d1b1d2296a1610
Reviewed-on: https://chromium-review.googlesource.com/314825
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
1bf60eb788365f083d0ee8045a6556f906149dec 02-Dec-2015 Simran Basi <sbasi@google.com> [autotest] autoserv add --lab & --host_attributes arguments

Added two new flags to autoserv.

--lab indicates that autoserv is running in the lab and has
the full Autotest infrastructure at its disposal.

--host_attributes allows host attribute information that is
usually in the database to be retrievable from the command
line arguments.

If --lab is pulled in, autoserv will request the host attributes
from the database at test runtime.

From here this change, then updates the concept of the "machines"
list that test control files receive to now be a list of dicts
that contain the machine hostname and host attributes. This will
enable identifing information the hosts library needs to create
host objects to be available whether or not there is a database
present.

BUG=chromium:564343
TEST=local autoserv runs. Also verified scheduler changes work
via MobLab. waiting on trybot results.
DEPLOY=scheduler

Change-Id: I6021de11317e29e2e6c084d863405910c7d1a71d
Reviewed-on: https://chromium-review.googlesource.com/315230
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
ba943535dbec910f88b29e112039fe92ddac4d71 03-Dec-2015 Dan Shi <dshi@google.com> [autotest] Add support of LATEST for android build.

With this change, android build can have LATEST as build id.

BUG=chromium:548881
TEST=local
http://dshi/afe/#tab_id=view_job&object_id=3017

Change-Id: I54b416548be5003f592e68fa6cb2d91034e14a5b
Reviewed-on: https://chromium-review.googlesource.com/315680
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Fang Deng <fdeng@chromium.org>
/external/autotest/server/hosts/adb_host.py
f2fd076129a5fba2aea50711e15c70e3e3a0fdc3 01-Dec-2015 Dan Shi <dshi@google.com> [autotest] Minor bug fix in adb_host

BUG=None
TEST=local run test

Change-Id: Id88371b08f7b300aa3a6756338d01c87cecaaad3
Reviewed-on: https://chromium-review.googlesource.com/314886
Commit-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
50c1f9c9b2b8a90157ec66dd54db338b5d100182 30-Nov-2015 Roshan Pius <rpius@google.com> adb_host: Restart adbd daemon as root on init

Restart the adb daemon as root on AdbHost initialization. Many adb
commands like 'iw', etc requires root permissions to run on the
Brillo/Android device.

BUG=b:25890386
TEST=`test_that --board=panther android1758-wifi-test-station-2.cros
network_WiFi_SimpleConnect.wifi_checkWEP104 --args use_wpa_cli=false`

Change-Id: Ie0a3b4ae9d65e276d25ef7cffb1920e3ca7255ab
Reviewed-on: https://chromium-review.googlesource.com/314822
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
/external/autotest/server/hosts/adb_host.py
549beb41550bf954394ca8c3a611397c97745759 18-Nov-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Add in testbed class and creation method in host factory.

The testbed class for now will assume all devices are accessible via ADB
and that there is only 1 test station. It will not create the ADBHost
like in factory and mix in a bunch of other host types with the host
(mostly because it's unnecessary).

The current abilities of the testbed class is just to retrieve the host
types within it.
- get_all_hosts
- get_test_station
- get_adb_devices

BUG=chromium:548739
TEST=With a moblab and 3 adb devices (shamu, hammerhead, angler),
ensured successful creation of testbed object as well as successful run of
ADBHost methods for each adb devices (get_board and run).

Change-Id: I9045f94050ad29421b64924679891a7a5906e294
Reviewed-on: https://chromium-review.googlesource.com/313223
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
d19e6c6fa3e51bbf04526d0d9dc8af71ae6d3670 29-Oct-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Minor cleanup of adb_host.

Mostly a comment cleanup of s/host/test station/ with some side code
fixes.

- Added verify_connectivity and list_files_glob so repair works on
ADBHost.
- Added get_tmp_dir to LocalHost
- Fixed ADBHost get_tmp_dir to create the tmp dir on the device (instead
of the teststation).

BUG=chromium:548739
TEST=Locally ran dummy test on a moblab/(beaglebone,dragon) and
moblab/angler.

Change-Id: I618ba1debbf1523b73ba48f507b1769ef3d0fa8d
Reviewed-on: https://chromium-review.googlesource.com/312508
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
/external/autotest/server/hosts/adb_host.py
225b90414c570404a1f71e6b12d2402ef2e32a20 18-Nov-2015 Dan Shi <dshi@google.com> [autotest] Add a dummy test for android device.

With this change, user can create a test from AFE to run the dummy test on an
Android device. Image specified in "image" box with format
branch/target/build_id will be installed in the android device during the test.

BUG=chromium:548881
TEST=local create test from AFE.

Change-Id: I2ca444c1824a838f4f4f9c5d3691d2a20288798a
Reviewed-on: https://chromium-review.googlesource.com/312976
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
b45eb6710be595ef6ceb4594a8d2c2151fd5d2df 19-Nov-2015 Ralph Nathan <ralphnathan@google.com> adb_host: Add remount command.

Add a remount command to adb_host.py to remount the /system, /vendor,
and /oem to be read-write.

BUG=25692295
TEST=manual test

Change-Id: Ie5b037a33c3cfcab78baae7ff76d256f51ff8218
Reviewed-on: https://chromium-review.googlesource.com/313178
Commit-Ready: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
Reviewed-by: David Pursell <dpursell@chromium.org>
/external/autotest/server/hosts/adb_host.py
f17f6fd0c2065a74c89c2b87199b34399d882e30 12-Nov-2015 Gilad Arnold <garnold@google.com> adb_host: Simpler forwarding of kwargs to ADBHost._device_run().

Currently, ADBHost.{adb,fastboot}_run() list all their kwargs with
identical values to the delegate method ADBHost._device_run(), which is
redundant. Then they launch the delegate without naming kwargs and
relying on their placement instead, which is dangerous; one example is
the omission of require_sudo in adb_run().

Instead, we capture and forward all kwargs to _device_run() as is. This
way:

* We don't need to restate the interface complete with default values,
so less maintenance overhead and less room for error moving forward.

* We delegate error checking, both implicit (unknown arg) and explicit
(unexpected values) to the underlying method. However, this does mean
that the wrappers may accept kwargs that were not previously
supported, for example adb_run() now accepts require_sudo. In this
case, this doesn't seem to be a problem but in general the
_device_run() implementation must be cautious toward possible abuses.

BUG=None
TEST=brillo_test_launcher.py control.brillo_pts

Change-Id: I16fb9c945ec97c502ac5547e7641d31f023906cc
Reviewed-on: https://chromium-review.googlesource.com/312580
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
5f6ed6aa0771d26879bfba378f2dc5a97dec7e3b 28-Oct-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Create teststation attribute for ADBHost.

This is the first step towards breaking down ADBHost into
more logical pieces. This CL will just focus on creating the
teststation attribute and swapping out host_run for teststation.run()
The teststation attribute will either be a LocalHost or SSHHost.
A subsequent cl will move over the existing methods to utilize
the teststation attribute.

Also took out the _local_adb checks since 'ssh localhost' is the
same as running the command locally.

Also updated LocalHost to have a {get,send}_file method so that
it can be used interchangeably with SSHHost as a teststation attribute.

BUG=chromium:548739, chromium:538793
TEST=Locally tested on moblab with a beaglebone and dragonboard.

Change-Id: I7b8168d669de9811523175d02c80dacce8875128
Reviewed-on: https://chromium-review.googlesource.com/310980
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
aaabd0cc969a6ce6eca9fe43c64bd60a51fa9f89 11-Nov-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] ADBHost get_file_info updated to work on android devices.

The private _get_file_info method was using 'ls -lgo' to grab the file
info. That works on dragon but the flags 'go' isn't supported on the
nexus devices.

BUG=chromium:536096
TEST=Checked that get_file preserved symlinks and perms through modified
server dummy pass test on a dragon and an angler.

Change-Id: I3415a32c191fe7e6f8becbebd1b8c7ff309ab816
Reviewed-on: https://chromium-review.googlesource.com/311799
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Bindu Mahadev <bmahadev@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
d6a2a3bc06fc2b09a18ca2d36ce218c35ba80788 28-Oct-2015 David Zeuthen <zeuthen@google.com> brillo_BootLoader: New test for A/B and Brillo bootloaders.

Currently this test only work 100% on edison and doesn't yet do
everything we need it to do. This restriction will be lifted once AOSP
fastboot gains support for the set_active command.

Also bump DEFAULT_WAIT_UP_TIME_SECONDS in ADBHost method since I've
observed edison sometimes taking up to 35 seconds to come back (most of
the time it's 25ish seconds).

BUG=24939237
TEST=Test passes on edison.

Change-Id: I49abdec44cc46e5695ea3158d9381c3cf4745a7e
Reviewed-on: https://chromium-review.googlesource.com/309611
Commit-Ready: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
a2872177cf3032112954640c6c1b7f36d6caf731 31-Oct-2015 Dan Shi <dshi@chromium.org> [autotest] Add machine_install method to install build to an Android device.

BUG=chromium:548881
CQ-DEPEND=CL:310550
TEST=local verify,
stage images:
curl http://100.107.160.5:8082/stage?target=shamu-userdebug\&build_id=2284311\&artifacts=bootloader_image,radio_image,zip_images\&branch=git_master

test script:
import common
from autotest_lib.server import hosts
build_url = 'http://100.107.160.5:8082/static/git_master/shamu-userdebug/2284311/'
build_local_path = '/mnt/moblab/tmp/tmp.IiN2SSexVl/'
h=hosts.create_host('172.27.215.241')
h.ensure_adb_mode()
h.machine_install(build_url=build_url, build_local_path=build_local_path)
if not h.is_up():
raise Exception('device is down.')

Change-Id: I52968d411e2c48e509e58165023d77d553abad26
Reviewed-on: https://chromium-review.googlesource.com/309995
Commit-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
/external/autotest/server/hosts/adb_host.py
955671461a7756ad3af38ee751f9911233828e21 03-Nov-2015 Roshan Pius <rpius@google.com> [autotest] Fix a stale |_adb_run| invocation in |get_file|.

Fixing a missed |_adb_run| to |adb_run| conversion from previous commit
'6ea3e1c82.

BUG=chromium:548881
TEST=`test_that --board=$board $host network_WiFi_Reassociate`

Change-Id: I2e424965031b7b34bf9e9352d58cbfe7a72b1e18
Reviewed-on: https://chromium-review.googlesource.com/310266
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
3b017bb3b35e7a5db8c1c5bc2112184c0634fc9f 03-Nov-2015 Gilad Arnold <garnold@chromium.org> adb_host.py: Fix argument handling when running commands.

This removes redundant (and buggy) addition of command arguments in
ADBHost._device_run(). These arguments are being added correctly by
underlying calls.

BUG=b:25395612
TEST=Call to fastboot_run() with args handled correctly.

Change-Id: I0d5bc72ce7f3703e926da140b72944b10c64ffe8
Reviewed-on: https://chromium-review.googlesource.com/310418
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
2cfa552ade359ca2d7780dd886f5767344499aa5 30-Oct-2015 Gilad Arnold <garnold@chromium.org> adb_host: Revised handling of device serials.

* Drop support for multiple serials: a single ADBHost controls a single
device, either using an explicitly provided serial, or without
specifying any serial when running command.

* In the latter case, we raise an exception whenever a command lists
more than one device. While this doesn't quite guarantee that the test
environment is sane, it will probably decrease the number of false
positives.

* Allow to distinguish between ADB vs fastboot serials: we're seeing
cases where they are actually distinct. If no fastboot serial
provided, default to the ADB one.

* Don't pass an explicit use_serial argument between methods: if
a serial's provided, use that. If not, either use a TCP/IP device
hostname (if given) or don't add a device specifier at all.

* Some adjustments around TCP/IP vs USB (serial) mode enforcement.

BUG=chromium:548881
TEST=Test successfully switches devices to fastboot and back.

Change-Id: I5ce3781cb397d8a5a5ac15a960d680625f32a585
Reviewed-on: https://chromium-review.googlesource.com/309974
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
6ea3e1c826eb9e99210b55c06663826726c1725f 28-Oct-2015 Dan Shi <dshi@chromium.org> [autotest] Update adb_host module with calls needed for fastboot command

The change adds several helper functions needed to run fastboot commands.

BUG=chromium:548881
TEST=local verify, secript:
import common
from autotest_lib.server import hosts
h=hosts.create_host('172.27.215.241')
h.adb_devices()
h.reboot()
h.adb_run('devices').stdout
h.ensure_bootloader_mode()
h.fastboot_devices()
h.is_up(command='fastboot')
h.ensure_adb_mode()

Change-Id: I908baed897b6161dc8e3dc8fcd60b0f37d572b2d
Reviewed-on: https://chromium-review.googlesource.com/309554
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
5ba5d180daac4d2b4b685aff467c93c8e7aadb94 28-Oct-2015 Roshan Pius <rpius@google.com> autotest: Ignore exit status parse errors in _adb_run.

There seems to be some commands which don't yield the exit status
using the "<COMMAND>; echo ADB_CMD_OUTPUT:$?" method we use in
|_adb_run| like "pkill -f $pid". If the |ignore_status| flag is set in
such invocations, ignore the stdout parse errors. This is the case in
|RpcServerTracker.disconnect|.

BUG=brillo:25340428
TEST=test_that $host --board=$BOARD network_WiFi_RetryConnectHidden` on
dragonboard.

Change-Id: I0da85a651f374b0b569bed55f8cb9b14e00262c5
Reviewed-on: https://chromium-review.googlesource.com/309520
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Roshan Pius <rpius@chromium.org>
/external/autotest/server/hosts/adb_host.py
92fe6ae6be21820885b7164c3f54149594a47786 21-Oct-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Implement preserve symlinks and perms for {get,send}_file on adbhost.

get_file:
If preserve_symlinks is True, then check if the source file is a symlink
and create the symlink on the drone. If perms is True, chmod the same
perms on the source file once it's back on the drone.

send_file:
Create the symlink on the device if the source file is a symlink itself.

BUG=chromium:538793
TEST=Checked that get_file preserved symlinks and perms through modified
server dummy pass test.

Change-Id: I47b9bd31de7681549adfcdacc00668a0108395a0
Reviewed-on: https://chromium-review.googlesource.com/308197
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
21abf29d7fa054cde7c5b87a0734abb7136e5405 26-Oct-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Update ADBHost to use parent's collect_logs method.

There's no need to reimplement the collect_logs method since the
inherited method calls the class get_file method which works just fine.

BUG=chromium:536120
TEST=Tried out the changes and it properly collected the dir of logs.

Change-Id: I74fd8d5344ffacad542cb442d4d122d2c4d80cf9
Reviewed-on: https://chromium-review.googlesource.com/308951
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
58e5dd3b600081607d5ecb514d9bf3ebea83c533 17-Oct-2015 Roshan Pius <rpius@google.com> autotest: Create RpcServerTracker for Host objects.

Create a generic RpcServerTracker which can be used by any host object
to start and manage RPC server connections. The RPCServerTracker uses
the associated host object to start the required XML/JSON RPC server on the
DUT and forwards the port from the AutoTest Server to Brillo/Cros DUT.
This CL basically ports over most of the RPC server connection
management code from CrosHost into a separate class so that it can be
reused by AdbHost as well.
AdbHost modifies the |host.rpc_port_forward/disconnect| method to forward the
RPC connection from the AdbHost to Brillo DUT using 'adb forward'.

Related Change:
1. Add a |verbose| flag to the |host.run| method in AdbHost so that we can
reuse the |host.run_background| method already implemented by SshHost.

BUG=brillo:24338381
TEST=Ran network_WiFi_SimpleConnect.wifi_check11g on both dragonboard
and cros DUT.
`test_that $host --board=panther network_WiFi_SimpleConnect.wifi_check11g`

Change-Id: I7e44cbd5897871f01f320cb57377a28491571478
Reviewed-on: https://chromium-review.googlesource.com/307163
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Roshan Pius <rpius@chromium.org>
/external/autotest/server/hosts/adb_host.py
a58163a1e71e1b96b19ce828541368dc17eab24e 14-Oct-2015 Roshan Pius <rpius@google.com> autotest: Flag to indicate if host supports client install.

Add a |is_client_install_supported| flag to bypass autotest client
install checks for Brillo ADBhosts.

BUG=brillo:24338381
Change-Id: I0dacbb4cef6f02d56bb6d1481beb4fdce90c3fd1
Reviewed-on: https://chromium-review.googlesource.com/305569
Commit-Ready: Roshan Pius <rpius@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Reviewed-by: Roshan Pius <rpius@chromium.org>
/external/autotest/server/hosts/adb_host.py
1621c631812eb4e6cd2a91979499570f99faf325 14-Oct-2015 Simran Basi <sbasi@google.com> adb_host: Support login as user adb.

Some adb_host systems might not allow ssh'ing in as root. When
this occurs, adb_host will try to use user 'adb' instead.

BUG=chromium:538641
TEST=host.create_host returns an adb_host for a machine which it
does not have root access for.

Change-Id: I70f88a64e8ad931021f6e7ed0a8af47fe91f93f3
Reviewed-on: https://chromium-review.googlesource.com/305507
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
a5522a35b55c7cac915cf0b4efc69ead32e26d35 06-Oct-2015 Simran Basi <sbasi@google.com> Brillo Tier 1 PTS: Initial Script.

Here is the starting point for the Brillo Tier 1 PTS.

Currently it does the following:

* Connects to a MobLab instance.
* Adds the ADB Host to the MobLab host list.
* Stages an update payload (not yet used).
* Launches the Brillo PTS Sequence.

Added the Brillo PTS Sequence. Currently is just runs the
whitelisted Gtests twice.

Updated sequences to support using the local control file
and not the template.

BUG=b:24774860
TEST=Ran against a local moblab, payload is staged and
whitelisted Gtests run twice.

Change-Id: I421d5d9c659ca654494e10cb37456de6fdd9752d
Reviewed-on: https://chromium-review.googlesource.com/304792
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
e452b1f31b3d320039a288c0f2988dfceb6d33b9 06-Oct-2015 Gilad Arnold <garnold@chromium.org> adb_host: Add support for port forwarding.

This adds two new methods for adding and removing port forwarding
between an ADB host and a target device, or vice verse (aka reverse
forwarding).

BUG=b:24158510
TEST=None

Change-Id: Ia28134d5d420f071341217acd3f1fed412c81f7f
Reviewed-on: https://chromium-review.googlesource.com/304144
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
3a4a57a7704ab15136286628f465dbb2d1a56171 30-Sep-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Add serial flag for adb_host support in cli/atest.

User should be able to specify serials to pass to adb_host and
the board label will be autodetected and the serial will be
added as a host attribute. Currently only works only for 1
serial, a later cl will enable multiple serials.

Also refactored the label decorator logic into site_utils
and remote.RemoteHost.

BUG=chromium:535352
TEST=manually added hosts using the serial flag using cli/atest
and checking the host was correctly detected on a moblab.

Change-Id: I4c95377eaee4529ea99add4387be6dcf56a529fb
Reviewed-on: https://chromium-review.googlesource.com/303214
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
/external/autotest/server/hosts/adb_host.py
a76bef0c3790e890b62c306b886d0d9be32e8dd2 29-Sep-2015 Gilad Arnold <garnold@chromium.org> Add an OS type getter for CrOS and ADB hosts.

This is needed for tests to be able to distinguish between the two host
flavors.

BUG=b:24505378
TEST=None

Change-Id: I9eb94c3c4b675693463c9c635b93339e3f157a56
Reviewed-on: https://chromium-review.googlesource.com/303024
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
1b023765567ae44a111ee1781686cc3a06a90f29 25-Sep-2015 Simran Basi <sbasi@google.com> adb_host: Minor fixes and method stubs.

Added a few minor fixes to adb_host and stubbed out methods
that need to be implemented still.

BUG=None
TEST=test run on Moblab.

Change-Id: I335f5d62039a596db5588fb617a7befff22acf46
Reviewed-on: https://chromium-review.googlesource.com/302459
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
38f7ddff84138d99b3b77698b345bf6322be9722 18-Sep-2015 Simran Basi <sbasi@google.com> Autotest: Add brillo_Gtests test.

Adds a new test to run all the gTest Suites on a DUT.

BUG=chromium:533118
TEST=ran locally on Moblab.

Change-Id: I84eee2506a38dfc19c0630992f8b129bded4a70e
Reviewed-on: https://chromium-review.googlesource.com/300615
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
018db35c2f2ce941d4e044aea576f0241496c65a 20-Sep-2015 Kevin Cheng <kevcheng@chromium.org> [autotest] Implement several adb_host functions.

Add in:
- send_file()
- get_file()
- get_release_version()

BUG=chromium:532226
TEST=Extend dummy pass server test on moblab to {get,send}file and
get the version successfully from/to a beaglebone/dragonboard.

Change-Id: I1342ce39042517c03b9de1a39f7b810db01dcbbc
Reviewed-on: https://chromium-review.googlesource.com/301143
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
d3ba3fbed434a475e28b4cee0dedcc68d26561ae 11-Sep-2015 Simran Basi <sbasi@google.com> autotest: minor adb_host modifications.

* Point autotest to use /data/autodir for the autodir of
adb_host.
* Stub out verify_software and verify_job_repo_url for
adb_host.
* Update moblab_host so that a MobLab can use the
.android_tester file flag to specify if it is a
MobLab under test or an adb_host.

BUG=None
TEST=local run.

Change-Id: Ice45ec65735ae78b1df8e21b49d9f52c546f465b
Reviewed-on: https://chromium-review.googlesource.com/299951
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@google.com>
Reviewed-by: Dan Shi <dshi@chromium.org>
/external/autotest/server/hosts/adb_host.py
34363392b65cd80c707998d934c04ac23e7cd570 13-Aug-2015 Filipe Brandenburger <filbranden@chromium.org> autotest: Support adb host without serial

The current code assumes `adb devices` will always return valid serial
numbers, but there are cases where serial numbers are not available.

We have one such device where this is often the case, particularly when
we re-flash the firmware.

This should not prevent the tests from running, particularly when there
is only a single device attached, in which case `adb shell` command does
not really require a `-s` parameter with the serial number.

Tested on a device without serial number:

$ adb devices
List of devices attached
(no serial number) device

Autotest did not fail with error.AutoservError('No ADB devices attached.')

The code also checks for whether a device without serial number is
present when there are multiple devices attached and raises an exception
in that case. Right now the code would raise an exception anyways,
error.AutoservError('Multiple ADB devices attached.'), but once that
check is lifted and we support multiple adb devices attached to the same
host, we will want to check for that particular case.

BUG=None
TEST=Tested on a device without serial number.

Change-Id: I9f456d222b5eef226c4f343491aac4645dad3e68
Reviewed-on: https://chromium-review.googlesource.com/293552
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Filipe Brandenburger <filbranden@chromium.org>
Tested-by: Filipe Brandenburger <filbranden@chromium.org>
/external/autotest/server/hosts/adb_host.py
68a80074108f58e9d60c56bddd601125373f93c7 14-Jul-2015 Filipe Brandenburger <filbranden@chromium.org> autotest: Escape commands run under `adb shell`

This fixes problems such as checking the pid of commands put in
background by echoing the value of "$!". Without the proper escaping,
the value of "$!" would be expanded on the adb_host instead.

Correct an instance in WpaCliProxy running the set_network which tries
to insert literal double quotes and goes to some lengths trying to
"work around" the poor escaping.

The correct way of doing shell escaping would be to use single quotes
(which bypass all expansions and is safe for characters such as "$",
"`", backslash and double quotes) and replace existing instances of "'"
with the expression "'\''", which terminates the current string, inserts
a literal single quote (using backslash for escaping) and then starts a
new string.

However, such a change is too complex for this scope, so I will try to
propose that in a follow up instead.

BUG=chrome-os-partner:42310
TEST=Ran network_WiFi_SimpleConnect through adb successfully.
Ran suite:wifi_matfunc against a Samus in a wifi cage.

Change-Id: I260a20f2a344754790d509ea801d868965f2fe05
Reviewed-on: https://chromium-review.googlesource.com/285641
Reviewed-by: Filipe Brandenburger <filbranden@chromium.org>
Commit-Queue: Filipe Brandenburger <filbranden@chromium.org>
Tested-by: Filipe Brandenburger <filbranden@chromium.org>
/external/autotest/server/hosts/adb_host.py
933c8af9c6e8c919bd7fee7c31812d0ac65b17c2 29-Apr-2015 Simran Basi <sbasi@google.com> [autotest] Change adb_host check_host logic.

adb is about to be installed on all Chrome OS images. We want to
be able to determine if this device is a cros DUT or a host
testing an Android DUT. So now we require a magic file:
'/mnt/stateful_partition/.android_tester' to determine if we
want to use as an adb_host.

BUG=None
TEST=ran test_that locally and ensured the correct host type was
created.

Change-Id: I3948177b47e1a3c45b0bfe85525f2cd1fe057d76
Reviewed-on: https://chromium-review.googlesource.com/268355
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
cc58969d8af706b043a1a0c3982078966e928ed3 22-Apr-2014 Alex Miller <milleral@chromium.org> [autotest] All host.reboot() methods should do the same thing.

Where the same thing is return None on succes, and raise on failure.
Because that is what remote does.

BUG=chromium:318306
TEST=Ran generic_RebootTest on a cros host

Change-Id: I83e7cbdd97c8691897441b344363359122ae260a
Reviewed-on: https://chromium-review.googlesource.com/196166
Reviewed-by: Alex Miller <milleral@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
Tested-by: Alex Miller <milleral@chromium.org>
/external/autotest/server/hosts/adb_host.py
60461dc248068c5d8df1d398d11c0a212d3f0c3a 11-Mar-2014 Kris Rambish <krisr@chromium.org> Add syslog to ADBHost

This patch is pulled in from toshik@google.com

BUG=chromium:348249
TEST=None

Change-Id: Ia3a6b63abd4319a61eb1ee76280eafa1ab210431
Reviewed-on: https://chromium-review.googlesource.com/189581
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
/external/autotest/server/hosts/adb_host.py
08849d5920fd6a73bcf546406a6c4fe017950228 22-Nov-2013 Christopher Wiley <wiley@chromium.org> autotest: Run tests against ADBHosts with less complaining

Fix a race between adb server restart and the next test that sometimes
causes test_that failure/hangs when the Android device doesn't come
online fast enough after the debug daemon is killed. Also skip log
collection entirely on Android hosts, since this always fails due to
the lack of a /var/log/messages.

While here, fix some obvious pylint problems with undefined variables in
host_run().

TEST=Tests run more smoothly against ADB hosts.
BUG=chromium:305427

Change-Id: Id6750efb3aa723a41f87cad64dc37c9322b4ae29
Reviewed-on: https://chromium-review.googlesource.com/177623
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
/external/autotest/server/hosts/adb_host.py
46dadc9439355f72d394dcc4700902001bd797ff 07-Nov-2013 beeps <beeps@chromium.org> [autotest] Eureka host.

Creates a eureka host capable of verifying, cleanup, reboot
and machine_install. Also implements the following chagnes:
1. Pipes a base command through is_up, since different ssh
hosts are bound to have different things pre-installed.
2. Changes some timeouts to integers to avoid asserts.
3. Make host factory a little more generic, and check
for chromeos host first.
4. Adds a method to remote wget to server/site_utils.

TEST=Tried verify, cleanup, reoboot and machine_install.
BUG=chromium:292629, chromium:273843

Change-Id: I62a700614838569c6d77184b3c3339e914f4b456
Reviewed-on: https://chromium-review.googlesource.com/176303
Tested-by: Prashanth B <beeps@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Prashanth B <beeps@chromium.org>
/external/autotest/server/hosts/adb_host.py
8e6b08e2f8124c1c21a2d63c4d4aa45c9c762469 11-Oct-2013 Christopher Wiley <wiley@chromium.org> autotest: Depend on built in board detection

BUG=None
TEST=WiFi performance tests that use this in perf key making still pass.

Change-Id: I7560b1b76cf38d57c9e8c3609dc5bcbe69041d52
Reviewed-on: https://chromium-review.googlesource.com/173237
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
/external/autotest/server/hosts/adb_host.py
724b8a50f34b85dda9f1990e3e8c5b68edbdb37b 30-Sep-2013 Simran Basi <sbasi@chromium.org> Autotest: Autodetect ADB Host.

Allow tests to run on either ADBHost or CrosHost without requiring
the host type to be specified. If the 'adb' command exists on the
device it will use ADBHost otherwise it will use CrosHost.

Measured the cost of creating an SSHHost instance and running
'which adb' on editted control file in the AFE and it added roughly
500 milliseconds to the test completion time.

BUG=chromium:294328
TEST=Ran locally and tested with a try-bot to verify VMTests still
work.

Change-Id: I0ca2a15e8473284e4e52c3176b933a136b341d79
Reviewed-on: https://chromium-review.googlesource.com/171092
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py
431010f31bceddcf92f36e1b82397b9a56ffee54 04-Sep-2013 Simran Basi <sbasi@chromium.org> Autotest: Add ADBHost and simple server side test.

This change adds a ADBHost, which represents a machine running ADB
with an android device connected. ADBHost may be either the local
machine or a repote IP addressable host with adb installed. In
either setup, all the ADB interactions can be done via USB or TCP/IP
though USB is more stable and the perferred interaction.

So far ADBHost only allows for server-side testing of the android
device. Included is a simple reboot test. Note interacting with the
device over TCP/IP after rebooting multiple times can run into
some flake. This should be resolved with verify/repair methods to
ensure/get us to a good state.

Also refactored ignore_timeout all the way into base_utils.

BUG=chromium:294308
TEST=$ ./autoserv -s site_tests/adb_Reboot/control -m localhost
--disable_sysinfo --no_collect_crashinfo Ran with localhost, remote
beaglebone running as an ADB Host and both over usb/tcpip. Tests
for tcp_ip used --args="device_hostname=172.22.50.232"
Also works with test_that --board=daisy [ip] adb_Reboot --fast

Change-Id: I504492ff3fb67c97d37b5e4376b7257ed1dd4ca5
Reviewed-on: https://chromium-review.googlesource.com/169884
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Alex Miller <milleral@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
/external/autotest/server/hosts/adb_host.py