diff options
Diffstat (limited to 'poky/meta/classes/testimage.bbclass')
-rw-r--r-- | poky/meta/classes/testimage.bbclass | 74 |
1 files changed, 26 insertions, 48 deletions
diff --git a/poky/meta/classes/testimage.bbclass b/poky/meta/classes/testimage.bbclass index f2ff91da9d..cb8c12acce 100644 --- a/poky/meta/classes/testimage.bbclass +++ b/poky/meta/classes/testimage.bbclass @@ -31,6 +31,7 @@ TESTIMAGE_AUTO ??= "0" # TEST_LOG_DIR contains a command ssh log and may contain infromation about what command is running, output and return codes and for qemu a boot log till login. # Booting is handled by this class, and it's not a test in itself. # TEST_QEMUBOOT_TIMEOUT can be used to set the maximum time in seconds the launch code will wait for the login prompt. +# TEST_QEMUPARAMS can be used to pass extra parameters to qemu, e.g. "-m 1024" for setting the amount of ram to 1 GB. TEST_LOG_DIR ?= "${WORKDIR}/testimage" @@ -40,31 +41,13 @@ TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages" TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted" TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged" -PKGMANTESTSUITE = "\ - ${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf rpm', '', d)} \ - ${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 'opkg', '', d)} \ - ${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt', '', d)} \ - " -SYSTEMDSUITE = "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" -MINTESTSUITE = "ping" -NETTESTSUITE = "${MINTESTSUITE} ssh df date scp oe_syslog ${SYSTEMDSUITE}" -DEVTESTSUITE = "gcc kernelmodule ldd" -PTESTTESTSUITE = "${MINTESTSUITE} ssh scp ptest" - -DEFAULT_TEST_SUITES = "${MINTESTSUITE} auto" -DEFAULT_TEST_SUITES_pn-core-image-minimal = "${MINTESTSUITE}" -DEFAULT_TEST_SUITES_pn-core-image-minimal-dev = "${MINTESTSUITE}" -DEFAULT_TEST_SUITES_pn-core-image-full-cmdline = "${NETTESTSUITE} perl python logrotate ptest" -DEFAULT_TEST_SUITES_pn-core-image-x11 = "${MINTESTSUITE}" -DEFAULT_TEST_SUITES_pn-core-image-lsb = "${NETTESTSUITE} pam parselogs ${PKGMANTESTSUITE} ptest" -DEFAULT_TEST_SUITES_pn-core-image-sato = "${NETTESTSUITE} connman xorg parselogs ${PKGMANTESTSUITE} \ - ${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'python', '', d)} ptest gi" -DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "${NETTESTSUITE} buildcpio buildlzip buildgalculator \ - connman ${DEVTESTSUITE} logrotate perl parselogs python ${PKGMANTESTSUITE} xorg ptest gi stap" -DEFAULT_TEST_SUITES_pn-core-image-lsb-dev = "${NETTESTSUITE} pam perl python parselogs ${PKGMANTESTSUITE} ptest gi" -DEFAULT_TEST_SUITES_pn-core-image-lsb-sdk = "${NETTESTSUITE} buildcpio buildlzip buildgalculator \ - connman ${DEVTESTSUITE} logrotate pam parselogs perl python ${PKGMANTESTSUITE} ptest gi stap" -DEFAULT_TEST_SUITES_pn-meta-toolchain = "auto" +BASICTESTSUITE = "\ + ping date df ssh scp python perl gi ptest parselogs \ + logrotate connman systemd oe_syslog pam stap ldd xorg \ + kernelmodule gcc buildcpio buildlzip buildgalculator \ + dnf rpm opkg apt" + +DEFAULT_TEST_SUITES = "${BASICTESTSUITE}" # aarch64 has no graphics DEFAULT_TEST_SUITES_remove_aarch64 = "xorg" @@ -81,21 +64,20 @@ TEST_SUITES ?= "${DEFAULT_TEST_SUITES}" TEST_QEMUBOOT_TIMEOUT ?= "1000" TEST_TARGET ?= "qemu" +TEST_QEMUPARAMS ?= "" TESTIMAGEDEPENDS = "" TESTIMAGEDEPENDS_append_qemuall = " qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot qemu-helper-native:do_addto_recipe_sysroot" TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS_append_qemuall = " ${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS_append_qemuall = " ${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}" TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf-native:do_populate_sysroot', '', d)}" +TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}" TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 'opkg-utils-native:do_populate_sysroot package-index:do_package_index', '', d)}" TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt-native:do_populate_sysroot package-index:do_package_index', '', d)}" -TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}" TESTIMAGELOCK = "${TMPDIR}/testimage.lock" TESTIMAGELOCK_qemuall = "" -TESTIMAGE_DUMP_DIR ?= "/tmp/oe-saved-tests/" +TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/" TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR" @@ -219,12 +201,13 @@ def testimage_main(d): machine = d.getVar("MACHINE") # Get rootfs - fstypes = [fs for fs in d.getVar('IMAGE_FSTYPES').split(' ') - if fs in supported_fstypes] - if not fstypes: - bb.fatal('Unsupported image type built. Add a comptible image to ' - 'IMAGE_FSTYPES. Supported types: %s' % - ', '.join(supported_fstypes)) + fstypes = d.getVar('IMAGE_FSTYPES').split() + if d.getVar("TEST_TARGET") == "qemu": + fstypes = [fs for fs in fstypes if fs in supported_fstypes] + if not fstypes: + bb.fatal('Unsupported image type built. Add a comptible image to ' + 'IMAGE_FSTYPES. Supported types: %s' % + ', '.join(supported_fstypes)) rootfs = '%s.%s' % (image_name, fstypes[0]) # Get tmpdir (not really used, just for compatibility) @@ -248,13 +231,11 @@ def testimage_main(d): boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT")) # Get use_kvm - qemu_use_kvm = d.getVar("QEMU_USE_KVM") - if qemu_use_kvm and \ - (d.getVar('MACHINE') in qemu_use_kvm.split() or \ - oe.types.boolean(qemu_use_kvm) and 'x86' in machine): - kvm = True - else: - kvm = False + kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH')) + + slirp = False + if d.getVar("QEMU_USE_SLIRP"): + slirp = True # TODO: We use the current implementatin of qemu runner because of # time constrains, qemu runner really needs a refactor too. @@ -267,6 +248,8 @@ def testimage_main(d): 'boottime' : boottime, 'bootlog' : bootlog, 'kvm' : kvm, + 'slirp' : slirp, + 'dump_dir' : d.getVar("TESTIMAGE_DUMP_DIR"), } # TODO: Currently BBPATH is needed for custom loading of targets. @@ -306,17 +289,12 @@ def testimage_main(d): package_extraction(d, tc.suites) - bootparams = None - if d.getVar('VIRTUAL-RUNTIME_init_manager', '') == 'systemd': - # Add systemd.log_level=debug to enable systemd debug logging - bootparams = 'systemd.log_target=console' - results = None orig_sigterm_handler = signal.signal(signal.SIGTERM, sigterm_exception) try: # We need to check if runqemu ends unexpectedly # or if the worker send us a SIGTERM - tc.target.start(extra_bootparams=bootparams) + tc.target.start(params=d.getVar("TEST_QEMUPARAMS")) results = tc.runTests() except (RuntimeError, BlockingIOError) as err: if isinstance(err, RuntimeError): |