adb: fix test_sighup.

am: 470622f064

Change-Id: I342cbd04804e3d8d92d04ab088c6980d67bbc8e8
This commit is contained in:
Josh Gao 2016-10-24 21:18:58 +00:00 committed by android-build-merger
commit 8baf1198ee

View file

@ -522,13 +522,14 @@ class ShellTest(DeviceTest):
trap "echo SIGINT > {path}; exit 0" SIGINT
trap "echo SIGHUP > {path}; exit 0" SIGHUP
echo Waiting
while true; do sleep 100; done
read
""".format(path=log_path)
script = ";".join([x.strip() for x in script.strip().splitlines()])
process = self.device.shell_popen(
["sh", "-c", "'{}'".format(script)], kill_atexit=False, stdout=subprocess.PIPE)
process = self.device.shell_popen([script], kill_atexit=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
self.assertEqual("Waiting\n", process.stdout.readline())
process.send_signal(signal.SIGINT)
@ -536,7 +537,7 @@ class ShellTest(DeviceTest):
# Waiting for the local adb to finish is insufficient, since it hangs
# up immediately.
time.sleep(0.25)
time.sleep(1)
stdout, _ = self.device.shell(["cat", log_path])
self.assertEqual(stdout.strip(), "SIGHUP")