History log of /system/core/adb/test_device.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
79ce3fe7db2a947d59218d446f356a9ab4c96800 19-Nov-2016 Josh Gao <jmgao@google.com> adb: be more permissive in test_push_error_reporting.

Be agnostic to whether /system is writable when testing push error
reporting.

Test: python test_device.py
Change-Id: I1d03564fa35442c20e2c96a7f5b56d39868efc52
/system/core/adb/test_device.py
63660add3fb8d3c2cee143fb0c27ef01f487b41f 24-Oct-2016 Josh Gao <jmgao@google.com> Merge changes I34ba5757,Ie65a762a

* changes:
adb: fix test_sighup.
adb: fix race condition in test_non_interactive_sigint.
470622f064a777e86f14079ff2864d3166980c16 21-Oct-2016 Josh Gao <jmgao@google.com> adb: fix test_sighup.

Bug: http://b/32336914
Test: python test_device.py
Change-Id: I34ba5757b5e650d79327dc6779064acd850ce28e
/system/core/adb/test_device.py
e76b9f3dde800b44c4151ebee9ff469b6714d8aa 21-Oct-2016 Josh Gao <jmgao@google.com> adb: fix race condition in test_non_interactive_sigint.

Fix race condition in the test_non_interactive_sigint test by
looping for a while.

Bug: http://b/32336914
Test: python test_device.py
Change-Id: Ie65a762ad6f04815231add5444762c4c0ffd31cb
/system/core/adb/test_device.py
cabfa1177f11772e29229135d08b1034518cad93 19-Oct-2016 Elliott Hughes <enh@google.com> Move "adb shell" over to getopt(3), and allow -tt on old devices.

From the bug:

Say we run a new adb against an old device (like KitKat). Even with a new
client ADB, in this configuration, "adb shell" will create a remove tty
unconditionally. So if the user runs "adb shell -t -t", we shouldn't fail
with a message about the remote device not supporting -tT options --- the
user asked to create a tty unconditionally, and since we're going to create
a tty unconditionally, we should just succeed. (That it's going to succeed
due to protocol inadequacy instead of succeeding on purpose is irrelevant.)

That adb fails in this case makes scripts more complicated, since they can't
just pass "-t -t" unconditionally if they want a tty and to work on all
device versions, even if the script requires a new-ish adb locally.

Bug: http://b/32216152
Bug: http://b/32219151
Test: test_device.py
Change-Id: I8ab7c8dfa212209a7ab43c1f0832eeac26d2e42f
/system/core/adb/test_device.py
94dc19ff57a2c5a09d74362d0c1a1231cc027d7f 15-Sep-2016 Josh Gao <jmgao@google.com> adb: let `adb push` follow symlinks.

Bug: http://b/31491920
Test: touch foo; ln -s foo bar; adb push bar /data/local/tmp
Test: python test_device.py
Change-Id: I0a00b3d49fdf7206e27d66ac110b56e22449a1ad
/system/core/adb/test_device.py
fe50bb713bdd281dfc92b8bb826cebd088d46dff 23-Jun-2016 Josh Gao <jmgao@google.com> adb: add test for SIGHUP behavior.

This keeps regressing, so add a test to keep this from happening.

Bug: http://b/23603716
Bug: http://b/25965770
Bug: http://b/29565233
Test: Ran test with/without commit cd5d737, fails before, passes after
Change-Id: I8c431e10fc76da5a9fd404dd70f17bb8a8df24e6
/system/core/adb/test_device.py
eaae97e127717750b4264d9b6617b845f9bc701f 07-Apr-2016 David Pursell <dpursell@google.com> adb: support forwarding TCP port 0.

This CL adds support to forward or reverse TCP port 0 to allow the
system to automatically select an open port. The resolved port number
will be printed to stdout:
$ adb forward tcp:0 tcp:8000
12345
$ adb reverse tcp:0 tcp:9000
23456
This allows testing to be more robust by not hardcoding TCP ports which
may already be in use.

Forwarding port 0 is a host-only change and will work with any device,
but reversing port 0 requires the device to be updated with a new adbd
binary.

This CL also does a little bit of cleanup such as moving the alistener
class out of adb.h, and adds some error checking and additional tests.

Bug: 28051746
Test: python -m unittest discover
Test: adb_test
Test: `adb forward` and `adb reverse` with tcp:0
Change-Id: Icaa87346685b403ab5da7f0e6aa186aa091da572
/system/core/adb/test_device.py
cf46741b4fe9c9d62aa16635bee7680c853b31a8 26-Apr-2016 David Pursell <dpursell@google.com> adb: fix test_device.py shell protocol checks.

https://android-review.googlesource.com/#/c/210646/ added a
has_shell_protocol() function but the test_device.py tests were still
trying to use the now-missing SHELL_PROTOCOL_FEATURE constant.

This CL just switches test_device.py to correctly use the
has_shell_protocol() method.

Change-Id: Ie0a2f0dc07529843d25051a01e08fb677551a4e1
Test: `python -m unittest discover -v` on devices with and without
the shell protocol.
/system/core/adb/test_device.py
255c5c80777da296499ce0644defc9337ebda785 03-Mar-2016 Josh Gao <jmgao@google.com> adb: clean up quotes in test_device.py.

Change-Id: I7fe7724578ad89a004665d1bbff0d5c02c34c35e
/system/core/adb/test_device.py
89ec3a8d0feac727257b428a91b6f84b6a4b1395 03-Mar-2016 Josh Gao <jmgao@google.com> adb: mkdir the correct directory name when pulling.

The directory name should be based off of the local path, not the remote
path.

Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
/system/core/adb/test_device.py
1e611a33d524a7c7a31181aca10d1f4a4c9fc1b2 26-Feb-2016 Josh Gao <jmgao@google.com> adb: symlinks to dirs count as dirs for pull destination.

This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.

Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
/system/core/adb/test_device.py
afcdcd703e3023dfc60638cf6b67b530ec18cb18 20-Feb-2016 Josh Gao <jmgao@google.com> adb: check for an error response from adbd between each write.

When sending a file, do a 0-timeout poll to check to see if an error has
occurred, so that we can immediately report failure.

Bug: http://b/26816782
Change-Id: I4a8aa8408a36940bfda7b0ecfa5d13755f4aa14d
/system/core/adb/test_device.py
f264224191793d754aff8937849cf956d689bdfa 09-Dec-2015 Josh Gao <jmgao@google.com> adb: make pulling symlinks and devices work.

Bug: http://b/25972989
Bug: http://b/26085751
Change-Id: I43842871522ea5f67a8c258dcb6ddafa8dd744c8
/system/core/adb/test_device.py
ce8f2cdcd09b24e3deb88ffefb071752f79ab1bb 09-Dec-2015 Josh Gao <jmgao@google.com> adb: make the test_pull_dir test actually test something.

Change-Id: I8b525377557528d5bc70c44d587891fad9f739bd
/system/core/adb/test_device.py
191c15483294ffe67be3ead880e788059b1c3e25 09-Dec-2015 Josh Gao <jmgao@google.com> Move adb tests to system/core/adb.

Change-Id: If240f45817a46d1e055a8e5173ee7191b9d6c8ea
/system/core/adb/test_device.py
885888338856f15347900cc7845546140011c24e 18-Sep-2015 Dan Albert <danalbert@google.com> Move python-adb to development/python-packages.

We want to be able to use this in the NDK without having to pull in
all of system core.

Also, this clarifies the separation of adb and its python interface.

Bug: http://b/22881740
Change-Id: I0b437d9bf621e371d4698d7f8e8828072c7ff347
/system/core/adb/test_device.py
1d758c90959225c76ed4d318290ad1bf11532409 17-Sep-2015 Elliott Hughes <enh@google.com> Merge "adb unittest: make test_sync properly cleanup after itself"
544e795fbb8a750f67796d7d0cad898f3f5f711c 15-Sep-2015 David Pursell <dpursell@google.com> adb: Kill subprocess when the client exits.

When the client exits (e.g. with Ctrl+C) the subprocess should be
notified as well so it can cleanup if needed.

Bug: http://b/23825725
Change-Id: Idb771710b293e0a9f7bebc9e2814b3a816e2c50e
/system/core/adb/test_device.py
80fdc0bf867cbfbbe4f1ce99e6e01ca4c5b26e3c 15-Sep-2015 Spencer Low <CompareAndSwap@gmail.com> adb unittest: make test_sync properly cleanup after itself

It wasn't deleting the tempfile.mkdtemp() dir that it made.

Change-Id: I59c5f98aa8297c7b28d38799dd21ffe9566f2145
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/test_device.py
606835ae5c4b9519009cdff8b1c33169cff32cb1 09-Sep-2015 David Pursell <dpursell@google.com> adb: add client side shell protocol and enable.

Adds the shell protocol functionality to the client side and enables it
if the transport supports the feature.

Bug:http://b/23031026
Change-Id: I9abe1c8b1d39f8dd09666321b1c761ad708a8854
/system/core/adb/test_device.py
a54f14eb95d73c91aaa2a4387a79d897a4731060 28-Aug-2015 Elliott Hughes <enh@google.com> Merge "adb unittest: get test_unicode_paths passing on win32"
d8cce1817b02c23124e85b138d85acd8fc24a757 28-Aug-2015 Spencer Low <CompareAndSwap@gmail.com> adb: fix adb install and adb push exit code, error handling, unittest

adb push was not returning a bad exit code when write_data_file() or
write_data_link() failed. I encountered this when running the unittest
on Windows which can get into situations where stat() succeeds, but
open() fails due to pre-existing exclusive file access (which typically
doesn't exist on unix).

The same code is used by adb install, so this also fixes its error
handling.

Fixed some fd leaks and propagation of errors when reading a file.

Fixed a unittest to close temp files before reading them.

Change-Id: Ieba0026fa4c79eb0484676e4f2faaac9603ef584
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/test_device.py
de4505f8196114a348d0735a940e507d630bbb63 28-Aug-2015 Spencer Low <CompareAndSwap@gmail.com> adb unittest: get test_unicode_paths passing on win32

The Python 2 subprocess class doesn't use Unicode, so as a work-around
write the command line to a UTF-8 batch file and run that.

I modified the test to use u'blah' without .encode('utf-8') because the
Python docs recommend dealing with string variables like that. When
formatting a string with a unicode parameter, use u'foo' on the constant
string to make it unicode.

I also tested this on Linux and it seems to work fine (I did ls in the
middle of the test to make sure the filenames came out right, etc.).

I had to close the temporary files before adb tries to read/write them
because filesystem semantics are different on Windows (technically I
might be able to modify adb to try to open files with more permissive
share flags, but then I'm not sure if Python uses the right share flags.
Basically, I'd be opening another can of worms.).

Fixed the test to delete a temp file on the device once it is done.

Change-Id: Id0c34e26d7697fbbb47a44ae45298bed5e8c59d6
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/test_device.py
d4093f191b3f23de30479c93be8c684b47505e44 10-Aug-2015 David Pursell <dpursell@google.com> adb: Fix PTY logic for non-interactive shells.

Change `adb shell` so that interactive sessions use a PTY but
non-interactive do not. This matches `ssh` functionality better
and also enables future work to split stdout/stderr for
non-interactive sessions.

A test to verify this behavior is added to test_device.py with
supporting modifications in device.py.

Bug: http://b/21215503
Change-Id: Ib4ba40df85f82ddef4e0dd557952271c859d1c7b
/system/core/adb/test_device.py
3841a9f7cb6f7f27667a02cde885f385ef848a5e 03-Aug-2015 Elliott Hughes <enh@google.com> Leave the evidence lying around if an adb test fails.

Not seeing the full output from the failed adb command is probably
the biggest issue when debugging a test failure, but this doesn't
help either.

Change-Id: Ic42cbced8be252185a799b27c210a744188a4201
/system/core/adb/test_device.py
3e7feda3c52864055b6f6cc640e746bbc5282932 30-Jul-2015 Spencer Low <CompareAndSwap@gmail.com> adb/test_device.py fixes for win32 and no use of ANDROID_SERIAL

If ANDROID_SERIAL was not set, test_device.py was failing.

Use posixpath.join instead of os.path.join for make_random_device_files.

Change-Id: I24bfa43ba2a89a9a768f505fc0bba9d873082b2f
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/test_device.py
e2b4a5fee020f4332390a47e68646b7558fe4185 28-Jul-2015 Dan Albert <danalbert@google.com> Fix AndroidDevice.get_prop, add tests.

Had messed this up while refactoring before I submitted and neglected
to add a test. Thanks to mazda@ for catching this.

Also disabled the root/unroot tests for user builds.

Change-Id: Icb819a820a2afa227d548d678ae471d5195f0b96
/system/core/adb/test_device.py
8e1fdd7806363af51d7bfa7134fcef66523bcc56 25-Jul-2015 Dan Albert <danalbert@google.com> Create adb Python package.

This is mostly just the AdbWrapper that we used in our tests, but I've
cleaned up the API to be a little more Pythonic (mostly in the sense
that commands are passed as lists rather than strings that are
shlex.split() by the shell command), and implemented the workaround
error checking for adb shell.

Move the tests up a directory. Having them buried a level down has
only been annoying.

There are now two files containing Python tests. test_device.py
contains tests specifically checking the AndroidDevice API, and
test_adb.py checks the ADB client program. To run both, use

python -m unittest discover [-v]

Change-Id: Ibd158c528d31126a5b048bd00bc93039dbc468bc
/system/core/adb/test_device.py