diff options
Diffstat (limited to 'external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py')
-rw-r--r-- | external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py | 86 |
1 files changed, 72 insertions, 14 deletions
diff --git a/external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py index 8c95432e..2b9c4998 100644 --- a/external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/external/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu -from oeqa.core.decorator.oeid import OETestID from oeqa.utils.sshcontrol import SSHControl import os import json @@ -10,7 +13,6 @@ class ImageFeatures(OESelftestTestCase): test_user = 'tester' root_user = 'root' - @OETestID(1107) def test_non_root_user_can_connect_via_ssh_without_password(self): """ Summary: Check if non root user can connect via ssh without password @@ -36,7 +38,6 @@ class ImageFeatures(OESelftestTestCase): status, output = ssh.run("true") self.assertEqual(status, 0, 'ssh to user %s failed with %s' % (user, output)) - @OETestID(1115) def test_all_users_can_connect_via_ssh_without_password(self): """ Summary: Check if all users can connect via ssh without password @@ -66,7 +67,6 @@ class ImageFeatures(OESelftestTestCase): self.assertEqual(status, 0, 'ssh to user tester failed with %s' % output) - @OETestID(1116) def test_clutter_image_can_be_built(self): """ Summary: Check if clutter image can be built @@ -79,7 +79,6 @@ class ImageFeatures(OESelftestTestCase): # Build a core-image-clutter bitbake('core-image-clutter') - @OETestID(1117) def test_wayland_support_in_image(self): """ Summary: Check Wayland support in image @@ -97,7 +96,6 @@ class ImageFeatures(OESelftestTestCase): # Build a core-image-weston bitbake('core-image-weston') - @OETestID(1497) def test_bmap(self): """ Summary: Check bmap support @@ -126,12 +124,11 @@ class ImageFeatures(OESelftestTestCase): # check if result image is sparse image_stat = os.stat(image_path) - self.assertTrue(image_stat.st_size > image_stat.st_blocks * 512) + self.assertGreater(image_stat.st_size, image_stat.st_blocks * 512) # check if the resulting gzip is valid self.assertTrue(runCmd('gzip -t %s' % gzip_path)) - @OETestID(1903) def test_hypervisor_fmts(self): """ Summary: Check various hypervisor formats @@ -164,9 +161,13 @@ class ImageFeatures(OESelftestTestCase): sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') result = runCmd('qemu-img info --output json %s' % image_path, native_sysroot=sysroot) - self.assertTrue(json.loads(result.output).get('format') == itype) + try: + data = json.loads(result.output) + self.assertEqual(data.get('format'), itype, + msg="Unexpected format in '%s'" % (result.output)) + except json.decoder.JSONDecodeError: + self.fail("Could not parse '%ss'" % result.output) - @OETestID(1905) def test_long_chain_conversion(self): """ Summary: Check for chaining many CONVERSION_CMDs together @@ -198,7 +199,6 @@ class ImageFeatures(OESelftestTestCase): self.assertTrue(runCmd('cd %s;sha256sum -c %s.%s.sha256sum' % (deploy_dir_image, link_name, conv))) - @OETestID(1904) def test_image_fstypes(self): """ Summary: Check if image of supported image fstypes can be built @@ -208,13 +208,13 @@ class ImageFeatures(OESelftestTestCase): """ image_name = 'core-image-minimal' - img_types = [itype for itype in get_bb_var("IMAGE_TYPES", image_name).split() \ - if itype not in ('container', 'elf', 'f2fs', 'multiubi')] + all_image_types = set(get_bb_var("IMAGE_TYPES", image_name).split()) + blacklist = set(('container', 'elf', 'f2fs', 'multiubi', 'tar.zst')) + img_types = all_image_types - blacklist config = 'IMAGE_FSTYPES += "%s"\n'\ 'MKUBIFS_ARGS ?= "-m 2048 -e 129024 -c 2047"\n'\ 'UBINIZE_ARGS ?= "-m 2048 -p 128KiB -s 512"' % ' '.join(img_types) - self.write_config(config) bitbake(image_name) @@ -236,3 +236,61 @@ USERADD_GID_TABLES += "files/static-group" """ self.write_config(config) bitbake("core-image-base") + + def test_no_busybox_base_utils(self): + config = """ +# Enable x11 +DISTRO_FEATURES_append += "x11" + +# Switch to systemd +DISTRO_FEATURES += "systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" +VIRTUAL-RUNTIME_initscripts = "" +VIRTUAL-RUNTIME_syslog = "" +VIRTUAL-RUNTIME_login_manager = "shadow-base" +DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" + +# Replace busybox +PREFERRED_PROVIDER_virtual/base-utils = "packagegroup-core-base-utils" +VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils" +VIRTUAL-RUNTIME_base-utils-hwclock = "util-linux-hwclock" +VIRTUAL-RUNTIME_base-utils-syslog = "" + +# Blacklist busybox +PNBLACKLIST[busybox] = "Don't build this" +""" + self.write_config(config) + + bitbake("--graphviz core-image-sato") + + def test_image_gen_debugfs(self): + """ + Summary: Check debugfs generation + Expected: 1. core-image-minimal can be build with IMAGE_GEN_DEBUGFS variable set + 2. debug filesystem is created when variable set + 3. debug symbols available + Product: oe-core + Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com> + Yeoh Ee Peng <ee.peng.yeoh@intel.com> + """ + import glob + image_name = 'core-image-minimal' + features = 'IMAGE_GEN_DEBUGFS = "1"\n' + features += 'IMAGE_FSTYPES_DEBUGFS = "tar.bz2"\n' + features += 'MACHINE = "genericx86-64"\n' + self.write_config(features) + + bitbake(image_name) + deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') + dbg_tar_file = os.path.join(deploy_dir_image, "*-dbg.rootfs.tar.bz2") + debug_files = glob.glob(dbg_tar_file) + self.assertNotEqual(len(debug_files), 0, 'debug filesystem not generated at %s' % dbg_tar_file) + result = runCmd('cd %s; tar xvf %s' % (deploy_dir_image, dbg_tar_file)) + self.assertEqual(result.status, 0, msg='Failed to extract %s: %s' % (dbg_tar_file, result.output)) + result = runCmd('find %s -name %s' % (deploy_dir_image, "udevadm")) + self.assertTrue("udevadm" in result.output, msg='Failed to find udevadm: %s' % result.output) + dbg_symbols_targets = result.output.splitlines() + self.assertTrue(dbg_symbols_targets, msg='Failed to split udevadm: %s' % dbg_symbols_targets) + for t in dbg_symbols_targets: + result = runCmd('objdump --syms %s | grep debug' % t) + self.assertTrue("debug" in result.output, msg='Failed to find debug symbol: %s' % result.output) |