testimage.bbclass: fix logDetails() call on error path

This happens when testimage task runs and bitbake is interupted
twice with ctrl-c/SIGINT:

QMP Available for connection at /home/builder/src/base/repo/meta-arm/build/tmp/.xjik9srq
QMP connected to QEMU at 01/31/25 10:36:19 and took 0.55 seconds
QMP released QEMU at 01/31/25 10:36:19 and took 0.07 seconds from connect

Keyboard Interrupt, closing down...

Second Keyboard Interrupt, stopping...

WARNING: Exiting due to interrupt.
NOTE: Sending SIGTERM to remaining 1 tasks
ERROR: core-image-base-1.0-r0 do_testimage: testimage interrupted, shutting down...
Output from runqemu:
runqemu - INFO - Received signal: 15
runqemu - INFO - Cleaning up
runqemu - INFO - Host uptime: 6230788.40

tput: No value for $TERM and no -T specified

ERROR: core-image-base-1.0-r0 do_testimage: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_testimage(d)
     0003:
File: '/home/builder/src/base/repo/meta-arm/build/../poky/meta/classes-recipe/testimage.bbclass', lineno: 122, function: do_testimage
     0118:    dump-guest-memory {"paging":false,"protocol":"file:%s.img"}
     0119:}
     0120:
     0121:python do_testimage() {
 *** 0122:    testimage_main(d)
     0123:}
     0124:
     0125:addtask testimage
     0126:do_testimage[nostamp] = "1"
File: '/home/builder/src/base/repo/meta-arm/build/../poky/meta/classes-recipe/testimage.bbclass', lineno: 389, function: testimage_main
     0385:
     0386:    # Show results (if we have them)
     0387:    if results:
     0388:        configuration = get_testimage_configuration(d, 'runtime', machine)
 *** 0389:        results.logDetails(get_json_result_dir(d),
     0390:                        configuration,
     0391:                        get_testimage_result_id(configuration),
     0392:                        dump_streams=d.getVar('TESTREPORT_FULLLOGS'))
     0393:        results.logSummary(pn)
Exception: AttributeError: 'TestResult' object has no attribute 'logDetails'

ERROR: Logfile of failure stored in: /home/builder/src/base/repo/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/core-image-base/1.0/temp/log.do_testimage.2771735

Summary: 1 task failed:
  /home/builder/src/base/repo/meta-arm/build/../poky/meta/recipes-core/images/core-image-base.bb:do_testimage

(From OE-Core rev: c0d864a7007adbdf332da62e89c73630b3e01639)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mikko Rapeli 2025-02-03 14:28:51 +02:00 committed by Richard Purdie
parent d16b82e7ca
commit 908be6fd24

View File

@ -378,7 +378,6 @@ def testimage_main(d):
bb.error('runqemu failed, shutting down...')
if results:
results.stop()
results = tc.results
finally:
signal.signal(signal.SIGTERM, orig_sigterm_handler)
tc.target.stop()
@ -400,7 +399,7 @@ def testimage_main(d):
if not results or not complete:
bb.error('%s - FAILED - tests were interrupted during execution, check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
if not results.wasSuccessful():
if results and not results.wasSuccessful():
bb.error('%s - FAILED - also check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
def get_runtime_paths(d):