summaryrefslogtreecommitdiffstats
path: root/meta/classes/testimage.bbclass
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-26 14:00:50 +0100
commit4ae71d667d9ddd88180577c1ab64b2c96edfaeb3 (patch)
tree1da9ab30c5309152a48e722ba24f23966f31e712 /meta/classes/testimage.bbclass
parent594c9392e924d5dd90b3a16e28ca5c56c6bcc7b5 (diff)
downloadpoky-4ae71d667d9ddd88180577c1ab64b2c96edfaeb3.tar.gz
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). (From OE-Core rev: 06568a06ca22ee279d1829d26d4c38738233c06a) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/testimage.bbclass')
-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 c1669f133d..53945478af 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -204,7 +204,7 @@ def testimage_main(d):
204 """ 204 """
205 Catch SIGTERM from worker in order to stop qemu. 205 Catch SIGTERM from worker in order to stop qemu.
206 """ 206 """
207 raise RuntimeError 207 os.kill(os.getpid(), signal.SIGINT)
208 208
209 testimage_sanity(d) 209 testimage_sanity(d)
210 210
@@ -364,9 +364,9 @@ def testimage_main(d):
364 # or if the worker send us a SIGTERM 364 # or if the worker send us a SIGTERM
365 tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS")) 365 tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS"))
366 results = tc.runTests() 366 results = tc.runTests()
367 except (RuntimeError, BlockingIOError) as err: 367 except (KeyboardInterrupt, BlockingIOError) as err:
368 if isinstance(err, RuntimeError): 368 if isinstance(err, KeyboardInterrupt):
369 bb.error('testimage received SIGTERM, shutting down...') 369 bb.error('testimage interrupted, shutting down...')
370 else: 370 else:
371 bb.error('runqemu failed, shutting down...') 371 bb.error('runqemu failed, shutting down...')
372 if results: 372 if results: