From fea3c445a9ccb803468b83ea4e8fa92fe442b8e0 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois-Briand Date: Thu, 8 Jan 2026 14:54:04 +0100 Subject: [PATCH] testimage: Print last lines of kernel log on test fail Testimage test fails are often a consequence of issues inside of the virtual machine, such as the OOM killer firing. Showing the last kernel log lines on the main log output should help to debug these fails. Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/classes-recipe/testimage.bbclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass index 844c0f19ad..b8685bc2b1 100644 --- a/meta/classes-recipe/testimage.bbclass +++ b/meta/classes-recipe/testimage.bbclass @@ -412,6 +412,9 @@ 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 results and not results.wasSuccessful(): + with open(bootlog, 'r') as bootlogfile: + bootlines = "".join(bootlogfile.readlines()[-20:]) + bb.plain('%s - FAILED - Last lines of QEMU boot log:\n%s' % (pn, bootlines)) bb.error('%s - FAILED - also check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True) def get_runtime_paths(d): -- 2.47.3