From: Alexander Kanavin <[email protected]> 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 <[email protected]> Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: Steve Sakoman <[email protected]> --- meta/classes/testimage.bbclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 01d8598604..deb81bc256 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) @@ -360,9 +360,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: -- 2.17.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#137862): https://lists.openembedded.org/g/openembedded-core/message/137862 Mute This Topic: https://lists.openembedded.org/mt/73990989/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/leave/8023207/1426099254/xyzzy [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
