diff mbox series

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

Message ID 20250203122851.1161503-1-mikko.rapeli@linaro.org
State New
Headers show
Series testimage.bbclass: fix logDetails() call on error path | expand

Commit Message

Mikko Rapeli Feb. 3, 2025, 12:28 p.m. UTC
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

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 meta/classes-recipe/testimage.bbclass | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass
index 97ed4223c4..e090b1ef4b 100644
--- a/meta/classes-recipe/testimage.bbclass
+++ b/meta/classes-recipe/testimage.bbclass
@@ -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):