testimage.bbclass: check that root-login-with-empty-password image features are present

More or less all of testimage relies on logging in as root, without password,
both on console and over ssh. Previously this was enabled by default in poky
and core, but now that it isn't, testimage will error out on timeouts in
both console and ssh login attempts. This commit adds an earlier check and
provides a hint to the users about what they should do.

(From OE-Core rev: c0ac4a4b694a7550bda0b6c14e42f3705ca0a499)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin 2025-10-30 10:22:47 +01:00 committed by Richard Purdie
parent 7eefb05a15
commit bf11301154

View File

@ -131,12 +131,22 @@ do_testimage[depends] += "${TESTIMAGEDEPENDS}"
do_testimage[lockfiles] += "${TESTIMAGELOCK}"
def testimage_sanity(d):
if (d.getVar('TEST_TARGET') == 'simpleremote'
test_target = d.getVar('TEST_TARGET')
if (test_target == 'simpleremote'
and (not d.getVar('TEST_TARGET_IP')
or not d.getVar('TEST_SERVER_IP'))):
bb.fatal('When TEST_TARGET is set to "simpleremote" '
'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
image_features = d.getVar('IMAGE_FEATURES')
needed_features = "allow-empty-password empty-root-password allow-root-login"
present_features = set(image_features.split()) & set(needed_features.split())
if (test_target in ('simpleremote', 'qemu')
and (len(present_features) < len(needed_features.split()))):
bb.fatal("When TEST_TARGET is '{}', IMAGE_FEATURES need to include '{}', and they are currently set to '{}'. This can be done for all images in a local build by running\n\nbitbake-config-build enable-fragment core/yocto/root-login-with-empty-password\n\nand rebuilding the image-under-test."
.format(test_target, needed_features, image_features))
def get_testimage_configuration(d, test_type, machine):
import platform
from oeqa.utils.metadata import get_layers