selftest/runqemu: Handle SystemExit

The sigchld handler in runqemu can raise a SystemExit when qemu shuts down.
Rather than backtracing, accept this as a successful test result.

ERROR: runqemu.QemuTest.test_qemu_can_shutdown (subunit.RemotedTestCase)
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/cases/runqemu.py", line 183, in test_qemu_can_shutdown
    qemu_shutdown_succeeded = self._start_qemu_shutdown_check_if_shutdown_succeeded(qemu, shutdown_timeout)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/cases/runqemu.py", line 175, in _start_qemu_shutdown_check_if_shutdown_succeeded
    time.sleep(1)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/utils/qemurunner.py", line 100, in handleSIGCHLD
    raise SystemExit
SystemExit

(From OE-Core rev: 417245923c1c2c35a60d6db29cbe5a78548860d2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-10-05 19:30:08 +01:00
parent b1b23359a3
commit d1a3f5098b

View File

@@ -166,14 +166,17 @@ class QemuTest(OESelftestTestCase):
# when qemu was shutdown by the above shutdown command
qemu.runner.stop_thread()
time_track = 0
while True:
is_alive = qemu.check()
if not is_alive:
return True
if time_track > timeout:
return False
time.sleep(1)
time_track += 1
try:
while True:
is_alive = qemu.check()
if not is_alive:
return True
if time_track > timeout:
return False
time.sleep(1)
time_track += 1
except SystemExit:
return True
def test_qemu_can_shutdown(self):
self.assertExists(self.qemuboot_conf)