diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2020-04-17 16:18:44 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-05-07 13:03:30 +0100 |
commit | 37d12209851b80b1c86705b1bb510689fd6f8519 (patch) | |
tree | 2a40c3d1f88361dc9e97ce4bb52844ad7c14725a /meta/classes | |
parent | 447653f3408fe76e133957225bb0496394683366 (diff) | |
download | poky-37d12209851b80b1c86705b1bb510689fd6f8519.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: 72a19f5f0f4bc4472d13b29e46a5c1673977e37a)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/testimage.bbclass | 8 |
1 files 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): | |||
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 | ||
@@ -360,9 +360,9 @@ def testimage_main(d): | |||
360 | # or if the worker send us a SIGTERM | 360 | # or if the worker send us a SIGTERM |
361 | tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS")) | 361 | tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS")) |
362 | results = tc.runTests() | 362 | results = tc.runTests() |
363 | except (RuntimeError, BlockingIOError) as err: | 363 | except (KeyboardInterrupt, BlockingIOError) as err: |
364 | if isinstance(err, RuntimeError): | 364 | if isinstance(err, KeyboardInterrupt): |
365 | bb.error('testimage received SIGTERM, shutting down...') | 365 | bb.error('testimage interrupted, shutting down...') |
366 | else: | 366 | else: |
367 | bb.error('runqemu failed, shutting down...') | 367 | bb.error('runqemu failed, shutting down...') |
368 | if results: | 368 | if results: |