This test actually belongs with the adb python wrapper, since it's not
affected by changes to adb itself.
Bug: http://b/64260633
Test: python test.py
Change-Id: Ia70a5529e30d91ea6232c65c9d50b2dabd07b925
Not sure exactly why this happens, but it keeps cropping up on my JB
nakasi when running the NDK tests.
Change-Id: Ic5c35f9ab01c0a83f98a6d074220c89ec765a812
Previously, to pass a subprocess cmdline args with Unicode characters,
we'd write the command line to a batch file and run it with cmd.exe. The
problem was that the batch file used chcp to get cmd.exe to be able to
read UTF-8 from the batch file, but this had the side-effect of changing
the codepage of the user's console window.
Instead of saving & restoring the codepage (which would always have the
risk of somehow leaving the console in the wrong codepage if a Ctrl-C
handler somehow wasn't called, or if Task Manager was used manually,
etc.), we use Windows PowerShell as the helper instead of cmd.exe.
PowerShell is installed on every version of Windows since Windows 7 and
is a separate free download for Windows XP and Windows Vista, but
realistically Windows XP is no longer supported by Microsoft and
probably no one chooses to run Windows Vista over Windows 7. Plus, this
change only uses PowerShell if Unicode args are passed.
Switching to PowerShell allows us to get rid of the temp file, context
manager, and messy __del__ that caused a variety of problems in the
past.
Change-Id: Ia3df533f7747f7b9b28a093f8ca24117371e5e59
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
After pushing to a Unicode path, use 'adb shell ls' to verify that the
path was created with the right name. This verifies that the UTF-16 to
UTF-8 conversion is done properly.
When pulling to a Unicode path, verify that the local file has been
created with the expected name. This should test UTF-16 to UTF-8
(command line to internal data structures) and UTF-8 to UTF-16 (internal
data structures to CreateFileW()).
Change-Id: I8b80aae731cf0d058cb0c3259e7f58256e86b771
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
The device.py module was incorrectly querying the return code when the
shell_v2 return code isn't available.
This CL fixes it by specifying the return code probe as an argument
list rather than a single string argument. This means that before the
device was executing something like this:
/system/bin/sh getprop '; echo $?'
which didn't do what we wanted. Now it does something like this:
/system/bin/sh getprop ; echo $?
Bug: http://b/25470461
Change-Id: I5e20da31ec7ecc782c6146d8b38d752d52082860
adb PTY behavior has been updated to match ssh more closely. This CL
updates the PTY tests accordingly.
Bug: http://b/24565284
Change-Id: I01208eac62c54eba1c2f97b334a18c4c19d77ea2
Every time gdbclient.py finishes it's giving this error:
Exception TypeError: 'must be type, not None' in <bound method
_subprocess_Popen.__del__ of <adb.device._subprocess_Popen object at
0x7fdd48e76850>> ignored
Basically super(_subprocess_Popen, self) was failing because at that
point _subprocess_Popen is None since global teardown had already
deleted the reference.
This fix saves local references to required global objects so that they
stick around until we're done with them. We may want to start looking
into making _subprocess_Popen a context manager instead, usage won't be
as convenient but __del__() does not scale to general use well. For now
though this CL seems to solve the problem for gdbclient.py.
Change-Id: I6c2a9fe0c108ae600cf05eb3b887d56959c7308e
adb.shell() was recently changed to use subprocess.Popen(), which
doesn't work properly with Unicode on Windows. The fix is to use the
same work-around that I did for subprocess.check_output(): write UTF-8
to a batch file and run it. The change is primarily refactoring to
enable code reuse.
Change-Id: I88e9b9b35e5318533c0cd932d92e13bc9e734092
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Add a test to send stdin to non-interactive `adb shell`.
This new test will hang on ToT devices that support shell_v2 until they
are rebuilt with the corresponding adb CL. A new feature could be added
instead to filter those devices out, but it doesn't seem worth it as no
devices have yet been released with shell_v2.
This CL also fixes a mistake I made earlier with device.linesep; this
is used to check device output, not separate device input. Using it
added unnecessary newline characters on Windows.
Bug: http://b/24565284
Change-Id: Ic123402975033d74688f56a36acac993af6815e6
http://r.android.com/173810 changed the shell feature name. This CL
updates the python scripts to re-enable shell protocol tests, and adds
an additional test for `adb shell -x`.
Change-Id: I961adf7abd1782ea98f3f82d8af11dcaa02f9570
This is mostly to allow backgrounding of processes run through adb
(gdbserver in particular).
Bug: http://b/23715403
Change-Id: I47fbebbd05d58044b4c447ffa86e0ab97d920278
The install escaping test fails if the device supports exit codes. This
fixes the test to ignore the exit code since we expect the install to
fail.
Change-Id: I37bb39552a6e9068ac088a25d831f45d81b28155
Adds python tests to check that -T (disable PTY) and -t (force PTY)
arguments work as expected for `adb shell`.
Bug: http://b/23825231
Change-Id: I5343fae35b2be8459a9b95125f66def46c26adf4
This really ought to be maintained as a separate project. Also adds a
setup.py for distribution.
Bug: http://b/22881740
Change-Id: I8e11e4154fac21d3196a533613822b236b2b73e6