Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: devil/devil/android/device_utils_test.py

Issue 3016623002: devil: Fix exit code handling when greping through lsof.
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/android/device_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/device_utils_test.py
diff --git a/devil/devil/android/device_utils_test.py b/devil/devil/android/device_utils_test.py
index 3d1cbff250812be83a5064bb5498deffd7a52215..af3bc10db6252ddfbc7939c2bf87d15d6f7dfd32 100755
--- a/devil/devil/android/device_utils_test.py
+++ b/devil/devil/android/device_utils_test.py
@@ -1122,7 +1122,7 @@ class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
with self.assertCall(
self.call.device.RunShellCommand(
'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
- shell=True, check_return=True),
+ shell=True),
['This line contains foo', 'PIPESTATUS: 0 0']):
self.assertEquals(['This line contains foo'],
self.device._RunPipedShellCommand('ps | grep foo'))
@@ -1131,7 +1131,7 @@ class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
with self.assertCall(
self.call.device.RunShellCommand(
'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
- shell=True, check_return=True),
+ shell=True),
['PIPESTATUS: 1 0']):
with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
self.device._RunPipedShellCommand('ps | grep foo')
@@ -1141,7 +1141,7 @@ class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
with self.assertCall(
self.call.device.RunShellCommand(
'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
- shell=True, check_return=True),
+ shell=True),
['PIPESTATUS: 0 1']):
with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
self.device._RunPipedShellCommand('ps | grep foo')
@@ -1151,12 +1151,22 @@ class DeviceUtilsRunPipedShellCommandTest(DeviceUtilsTest):
with self.assertCall(
self.call.device.RunShellCommand(
'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
- shell=True, check_return=True),
+ shell=True),
['foo.bar'] * 256 + ['foo.ba']):
with self.assertRaises(device_errors.AdbShellCommandFailedError) as ec:
self.device._RunPipedShellCommand('ps | grep foo')
self.assertIs(None, ec.exception.status)
+ def testRunPipedShellCommand_noCheckReturn(self):
+ with self.assertCall(
+ self.call.device.RunShellCommand(
+ 'ps | grep foo; echo "PIPESTATUS: ${PIPESTATUS[@]}"',
+ shell=True),
+ ['foo.exe', 'PIPESTATUS: 1 0']):
+ out = self.device._RunPipedShellCommand(
+ 'ps | grep foo', check_return=False)
+ self.assertEquals(['foo.exe'], out)
+
@mock.patch('time.sleep', mock.Mock())
class DeviceUtilsKillAllTest(DeviceUtilsTest):
« no previous file with comments | « devil/devil/android/device_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698