diff options
Diffstat (limited to 'meta/classes/testimage.bbclass')
| -rw-r--r-- | meta/classes/testimage.bbclass | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index c6e4cec426..fb214604a9 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass @@ -35,8 +35,8 @@ TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages" TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted" TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged" -RPMTESTSUITE = "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'smart rpm', '', d)}" -SYSTEMDSUITE = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" +RPMTESTSUITE = "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf rpm', '', d)}" +SYSTEMDSUITE = "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" MINTESTSUITE = "ping" NETTESTSUITE = "${MINTESTSUITE} ssh df date scp oe_syslog ${SYSTEMDSUITE}" DEVTESTSUITE = "gcc kernelmodule ldd" @@ -49,10 +49,10 @@ DEFAULT_TEST_SUITES_pn-core-image-x11 = "${MINTESTSUITE}" DEFAULT_TEST_SUITES_pn-core-image-lsb = "${NETTESTSUITE} pam parselogs ${RPMTESTSUITE}" DEFAULT_TEST_SUITES_pn-core-image-sato = "${NETTESTSUITE} connman xorg parselogs ${RPMTESTSUITE} \ ${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'python', '', d)}" -DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "${NETTESTSUITE} buildcvs buildiptables buildgalculator \ +DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "${NETTESTSUITE} buildcpio buildiptables buildgalculator \ connman ${DEVTESTSUITE} logrotate perl parselogs python ${RPMTESTSUITE} xorg" DEFAULT_TEST_SUITES_pn-core-image-lsb-dev = "${NETTESTSUITE} pam perl python parselogs ${RPMTESTSUITE}" -DEFAULT_TEST_SUITES_pn-core-image-lsb-sdk = "${NETTESTSUITE} buildcvs buildiptables buildgalculator \ +DEFAULT_TEST_SUITES_pn-core-image-lsb-sdk = "${NETTESTSUITE} buildcpio buildiptables buildgalculator \ connman ${DEVTESTSUITE} logrotate pam parselogs perl python ${RPMTESTSUITE}" DEFAULT_TEST_SUITES_pn-meta-toolchain = "auto" @@ -61,7 +61,7 @@ DEFAULT_TEST_SUITES_remove_aarch64 = "xorg" # qemumips is quite slow and has reached the timeout limit several times on the YP build cluster, # mitigate this by removing build tests for qemumips machines. -MIPSREMOVE ??= "buildcvs buildiptables buildgalculator" +MIPSREMOVE ??= "buildcpio buildiptables buildgalculator" DEFAULT_TEST_SUITES_remove_qemumips = "${MIPSREMOVE}" DEFAULT_TEST_SUITES_remove_qemumips64 = "${MIPSREMOVE}" @@ -71,15 +71,14 @@ TEST_QEMUBOOT_TIMEOUT ?= "1000" TEST_TARGET ?= "qemu" TESTIMAGEDEPENDS = "" -TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot" +TESTIMAGEDEPENDS_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_qemuall += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS_qemuall += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'python-smartpm-native:do_populate_sysroot', '', d)}" +TESTIMAGEDEPENDS_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', 'ipk', 'opkg-utils-native:do_populate_sysroot', '', d)}" TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'python-smartpm-native:do_populate_sysroot', '', d)}" -TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-native:do_populate_sysroot', '', d)}" +TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}" TESTIMAGELOCK = "${TMPDIR}/testimage.lock" TESTIMAGELOCK_qemuall = "" @@ -120,7 +119,7 @@ python do_testimage() { testimage_sanity(d) if (d.getVar('IMAGE_PKGTYPE') == 'rpm' - and 'smart' in d.getVar('TEST_SUITES')): + and 'dnf' in d.getVar('TEST_SUITES')): create_rpm_index(d) testimage_main(d) @@ -149,6 +148,7 @@ def testimage_main(d): from oeqa.runtime.context import OERuntimeTestContext from oeqa.runtime.context import OERuntimeTestContextExecutor from oeqa.core.target.qemu import supported_fstypes + from oeqa.core.utils.test import getSuiteCases from oeqa.utils import make_logger_bitbake_compatible def sigterm_exception(signum, stackframe): @@ -166,7 +166,11 @@ def testimage_main(d): d.getVar('IMAGE_LINK_NAME'))) tdname = "%s.testdata.json" % image_name - td = json.load(open(tdname, "r")) + try: + td = json.load(open(tdname, "r")) + except (FileNotFoundError) as err: + bb.fatal('File %s Not Found. Have you built the image with INHERIT+="testimage" in the conf/local.conf?' % tdname) + # Some variables need to be updates (mostly paths) with the # ones of the current environment because some tests require them. updateTestData(d, td, d.getVar('TESTIMAGE_UPDATE_VARS').split()) @@ -210,7 +214,9 @@ def testimage_main(d): # Get use_kvm qemu_use_kvm = d.getVar("QEMU_USE_KVM") - if qemu_use_kvm and qemu_use_kvm == 'True' and 'x86' in machine: + if qemu_use_kvm and \ + (qemu_use_kvm == 'True' and 'x86' in machine or \ + d.getVar('MACHINE') in qemu_use_kvm.split()): kvm = True else: kvm = False @@ -228,6 +234,10 @@ def testimage_main(d): 'kvm' : kvm, } + # TODO: Currently BBPATH is needed for custom loading of targets. + # It would be better to find these modules using instrospection. + target_kwargs['target_modules_path'] = d.getVar('BBPATH') + # runtime use network for download projects for build export_proxies(d) @@ -250,11 +260,15 @@ def testimage_main(d): test_modules = d.getVar('TEST_SUITES') tc.loadTests(test_paths, modules=test_modules) + if not getSuiteCases(tc.suites): + bb.fatal('Empty test suite, please verify TEST_SUITES variable') + package_extraction(d, tc.suites) bootparams = None if d.getVar('VIRTUAL-RUNTIME_init_manager', '') == 'systemd': - bootparams = 'systemd.log_level=debug systemd.log_target=console' + # 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) @@ -316,30 +330,26 @@ def create_index(arg): def create_rpm_index(d): # Index RPMs - rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") + rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c") index_cmds = [] archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_') for arch in archs.split(): rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch) - idx_path = os.path.join(d.getVar('WORKDIR'), 'rpm', arch) - db_path = os.path.join(d.getVar('WORKDIR'), 'rpmdb', arch) + idx_path = os.path.join(d.getVar('WORKDIR'), 'oe-testimage-repo', arch) if not os.path.isdir(rpm_dir): continue - if os.path.exists(db_path): - bb.utils.remove(dbpath, True) lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock') lf = bb.utils.lockfile(lockfilename, False) oe.path.copyhardlinktree(rpm_dir, idx_path) # Full indexes overload a 256MB image so reduce the number of rpms - # in the feed. Filter to p* since we use the psplash packages and + # in the feed. Filter to r* since we use the run-postinst packages and # this leaves some allarch and machine arch packages too. - bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm") + bb.utils.remove(idx_path + "*/[a-qs-z]*.rpm") bb.utils.unlockfile(lf) - cmd = '%s --dbpath %s --update -q %s' % (rpm_createrepo, - db_path, idx_path) + cmd = '%s --update -q %s' % (rpm_createrepo, idx_path) # Create repodata result = create_index(cmd) |
