aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2020-04-17 16:18:44 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-04-25 16:34:13 +0100
commit06568a06ca22ee279d1829d26d4c38738233c06a (patch)
tree93537dc76c81e6b790d110482d66b1e1d663f919
parentf97a6d241d1ad1a2cb03ced05202f615223d3a32 (diff)
downloadopenembedded-core-contrib-06568a06ca22ee279d1829d26d4c38738233c06a.tar.gz
openembedded-core-contrib-06568a06ca22ee279d1829d26d4c38738233c06a.tar.bz2
openembedded-core-contrib-06568a06ca22ee279d1829d26d4c38738233c06a.zip
testimage.bbclass: correctly process SIGTERM
Python's unittest will not propagate exceptions upside of itself, but rather will just catch and print them. The working way to make it stop is to send a SIGINT (e.g. simulate a ctrl-c press), which will make it exit with a KeyboardInterrupt exception. This also makes pressing ctrl-c twice from bitbake work again (previously hanging instances of bitbake and qemu were left around, and bitbake would no longer start until they were killed manually). Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/testimage.bbclass8
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index c1669f133d3..53945478af6 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -204,7 +204,7 @@ def testimage_main(d):
"""
Catch SIGTERM from worker in order to stop qemu.
"""
- raise RuntimeError
+ os.kill(os.getpid(), signal.SIGINT)
testimage_sanity(d)
@@ -364,9 +364,9 @@ def testimage_main(d):
# or if the worker send us a SIGTERM
tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS"))
results = tc.runTests()
- except (RuntimeError, BlockingIOError) as err:
- if isinstance(err, RuntimeError):
- bb.error('testimage received SIGTERM, shutting down...')
+ except (KeyboardInterrupt, BlockingIOError) as err:
+ if isinstance(err, KeyboardInterrupt):
+ bb.error('testimage interrupted, shutting down...')
else:
bb.error('runqemu failed, shutting down...')
if results: