adb: make shell protocol work again.

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 commit is contained in:
David Pursell
2015-09-30 17:13:40 -07:00
parent b9184809e7
commit 46e268e990
2 changed files with 13 additions and 1 deletions

View File

@@ -215,12 +215,24 @@ class ShellTest(DeviceTest):
if self.device.SHELL_PROTOCOL_FEATURE not in self.device.features:
raise unittest.SkipTest('shell protocol unsupported on this device')
# Shell protocol should be used by default.
result = self.device.shell_nocheck(
shlex.split('echo foo; echo bar >&2; exit 17'))
self.assertEqual(17, result[0])
self.assertEqual('foo' + self.device.linesep, result[1])
self.assertEqual('bar' + self.device.linesep, result[2])
self.assertEqual(17, self._interactive_shell([], 'exit 17'))
# -x flag should disable shell protocol.
result = self.device.shell_nocheck(
shlex.split('-x echo foo; echo bar >&2; exit 17'))
self.assertEqual(0, result[0])
self.assertEqual('foo{0}bar{0}'.format(self.device.linesep), result[1])
self.assertEqual('', result[2])
self.assertEqual(0, self._interactive_shell(['-x'], 'exit 17'))
def test_non_interactive_sigint(self):
"""Tests that SIGINT in a non-interactive shell kills the process.