adb: fix race condition in test_non_interactive_sigint. am: e76b9f3dde am: a06580956e

am: af9613732f

Change-Id: I3ea0261629ef747c41eca9f6af30b871d2182d59
This commit is contained in:
Josh Gao 2016-10-24 21:26:22 +00:00 committed by android-build-merger
commit 1ba3df9860

View file

@ -484,8 +484,12 @@ class ShellTest(DeviceTest):
self.device.shell(proc_query)
os.kill(sleep_proc.pid, signal.SIGINT)
sleep_proc.communicate()
self.assertEqual(1, self.device.shell_nocheck(proc_query)[0],
'subprocess failed to terminate')
# It can take some time for the process to receive the signal and die.
end_time = time.time() + 3
while self.device.shell_nocheck(proc_query)[0] != 1:
self.assertFalse(time.time() > end_time,
'subprocess failed to terminate in time')
def test_non_interactive_stdin(self):
"""Tests that non-interactive shells send stdin."""