From 3f45ce6d2b1dfde8bc3d554397d55f81846c52d5 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 31 Mar 2022 19:29:08 +0100 Subject: oeqa/selftest: tag tests that use runqemu There may be environments or machines which don't have working runqemu, so tag all of the tests which use runqemu() so that they can be skipped. Signed-off-by: Ross Burton Signed-off-by: Alexandre Belloni --- meta/lib/oeqa/selftest/cases/devtool.py | 3 ++- meta/lib/oeqa/selftest/cases/gcc.py | 7 +++++++ meta/lib/oeqa/selftest/cases/glibc.py | 1 + meta/lib/oeqa/selftest/cases/imagefeatures.py | 3 +++ meta/lib/oeqa/selftest/cases/overlayfs.py | 6 +++++- meta/lib/oeqa/selftest/cases/runqemu.py | 2 ++ meta/lib/oeqa/selftest/cases/runtime_test.py | 9 +++++---- meta/lib/oeqa/selftest/cases/wic.py | 7 +++++++ 8 files changed, 32 insertions(+), 6 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 9c69585a88..ba5dca0359 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -9,10 +9,10 @@ import tempfile import glob import fnmatch -import oeqa.utils.ftools as ftools from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer +from oeqa.core.decorator import OETestTag oldmetapath = None @@ -1351,6 +1351,7 @@ class DevtoolExtractTests(DevtoolBase): matches2 = glob.glob(stampprefix2 + '*') self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) + @OETestTag("runqemu") def test_devtool_deploy_target(self): # NOTE: Whilst this test would seemingly be better placed as a runtime test, # unfortunately the runtime tests run under bitbake and you can't run diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py index 9308724ce5..b9ea03ae62 100644 --- a/meta/lib/oeqa/selftest/cases/gcc.py +++ b/meta/lib/oeqa/selftest/cases/gcc.py @@ -114,37 +114,44 @@ class GccLibItmSelfTest(GccSelfTestBase): self.run_check("libitm") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccCrossSelfTestSystemEmulated(GccSelfTestBase): def test_cross_gcc(self): self.run_check_emulated("gcc") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GxxCrossSelfTestSystemEmulated(GccSelfTestBase): def test_cross_gxx(self): self.run_check_emulated("g++") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccLibAtomicSelfTestSystemEmulated(GccSelfTestBase): def test_libatomic(self): self.run_check_emulated("libatomic") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccLibGompSelfTestSystemEmulated(GccSelfTestBase): def test_libgomp(self): self.run_check_emulated("libgomp") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccLibStdCxxSelfTestSystemEmulated(GccSelfTestBase): def test_libstdcxx(self): self.run_check_emulated("libstdc++-v3") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccLibSspSelfTestSystemEmulated(GccSelfTestBase): def test_libssp(self): self.check_skip("libssp") self.run_check_emulated("libssp") @OETestTag("toolchain-system") +@OETestTag("runqemu") class GccLibItmSelfTestSystemEmulated(GccSelfTestBase): def test_libitm(self): self.check_skip("libitm") diff --git a/meta/lib/oeqa/selftest/cases/glibc.py b/meta/lib/oeqa/selftest/cases/glibc.py index 4c149ab702..6fc98e9cb4 100644 --- a/meta/lib/oeqa/selftest/cases/glibc.py +++ b/meta/lib/oeqa/selftest/cases/glibc.py @@ -83,6 +83,7 @@ class GlibcSelfTest(GlibcSelfTestBase): self.run_check() @OETestTag("toolchain-system") +@OETestTag("runqemu") class GlibcSelfTestSystemEmulated(GlibcSelfTestBase): def test_glibc(self): self.run_check_emulated() diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py index d36d45c551..6b94ace4eb 100644 --- a/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -3,6 +3,7 @@ # from oeqa.selftest.case import OESelftestTestCase +from oeqa.core.decorator import OETestTag from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.sshcontrol import SSHControl import glob @@ -14,6 +15,7 @@ class ImageFeatures(OESelftestTestCase): test_user = 'tester' root_user = 'root' + @OETestTag("runqemu") def test_non_root_user_can_connect_via_ssh_without_password(self): """ Summary: Check if non root user can connect via ssh without password @@ -39,6 +41,7 @@ class ImageFeatures(OESelftestTestCase): status, output = ssh.run("true") self.assertEqual(status, 0, 'ssh to user %s failed with %s' % (user, output)) + @OETestTag("runqemu") def test_all_users_can_connect_via_ssh_without_password(self): """ Summary: Check if all users can connect via ssh without password diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index 56ae48ce64..472746a64f 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py @@ -3,7 +3,8 @@ # from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu +from oeqa.utils.commands import bitbake, runqemu +from oeqa.core.decorator import OETestTag def getline_qemu(out, line): for l in out.split('\n'): @@ -185,6 +186,7 @@ EOT line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount") self.assertTrue(line and line.startswith("overlay"), msg=output) + @OETestTag("runqemu") def test_correct_image_fstab(self): """ Summary: Check that we can create an image when all parameters are @@ -203,6 +205,7 @@ EOT self._test_correct_image('base-files', base_files_append) + @OETestTag("runqemu") def test_correct_image_unit(self): """ Summary: Check that we can create an image when all parameters are @@ -238,6 +241,7 @@ EOT self._test_correct_image('systemd-machine-units', systemd_machine_unit_append) +@OETestTag("runqemu") class OverlayFSEtcRunTimeTests(OESelftestTestCase): """overlayfs-etc class tests""" diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py index da22f77b27..c1d277a095 100644 --- a/meta/lib/oeqa/selftest/cases/runqemu.py +++ b/meta/lib/oeqa/selftest/cases/runqemu.py @@ -12,6 +12,7 @@ from oeqa.core.decorator import OETestTag from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd +@OETestTag("runqemu") class RunqemuTests(OESelftestTestCase): """Runqemu test class""" @@ -149,6 +150,7 @@ SYSLINUX_TIMEOUT = "10" # bootup various filesystem types, including live image(iso and hddimg) # where live image was not supported on all qemu architecture. @OETestTag("machine") +@OETestTag("runqemu") class QemuTest(OESelftestTestCase): @classmethod diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 642f0eb637..7b7371b6e0 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -4,16 +4,15 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu -from oeqa.utils.sshcontrol import SSHControl +from oeqa.core.decorator import OETestTag import os -import re import tempfile -import shutil import oe.lsb from oeqa.core.decorator.data import skipIfNotQemu class TestExport(OESelftestTestCase): + @OETestTag("runqemu") def test_testexport_basic(self): """ Summary: Check basic testexport functionality with only ping test enabled. @@ -106,6 +105,7 @@ class TestExport(OESelftestTestCase): self.assertEqual(0, result.status, "Couldn't run tar from SDK") +@OETestTag("runqemu") class TestImage(OESelftestTestCase): def test_testimage_install(self): @@ -240,6 +240,7 @@ class TestImage(OESelftestTestCase): bitbake('core-image-minimal') bitbake('-c testimage core-image-minimal') +@OETestTag("runqemu") class Postinst(OESelftestTestCase): def init_manager_loop(self, init_manager): @@ -357,6 +358,7 @@ class Postinst(OESelftestTestCase): self.assertFalse(os.path.isfile(os.path.join(hosttestdir, "rootfs-after-failure")), "rootfs-after-failure file was created") +@OETestTag("runqemu") class SystemTap(OESelftestTestCase): """ Summary: The purpose of this test case is to verify native crosstap @@ -433,4 +435,3 @@ IMAGE_INSTALL:append = " systemtap-runtime" cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples result = runCmd(cmd) self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output) - diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 325fb7776a..2eb80ac194 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -19,6 +19,7 @@ from functools import wraps, lru_cache from tempfile import NamedTemporaryFile from oeqa.selftest.case import OESelftestTestCase +from oeqa.core.decorator import OETestTag from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu @@ -843,6 +844,7 @@ class Wic2(WicTestCase): # TODO this should work on aarch64 @only_for_arch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") def test_qemu(self): """Test wic-image-minimal under qemu""" config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ @@ -863,6 +865,7 @@ class Wic2(WicTestCase): self.assertEqual(output, 'UUID=2c71ef06-a81d-4735-9d3a-379b69c6bdba\t/media\text4\tdefaults\t0\t0') @only_for_arch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") def test_qemu_efi(self): """Test core-image-minimal efi image under qemu""" config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "mkefidisk.wks"\n' @@ -1046,6 +1049,7 @@ class Wic2(WicTestCase): self.assertGreaterEqual(size, 204800) @only_for_arch(['i586', 'i686', 'x86_64', 'aarch64']) + @OETestTag("runqemu") def test_rawcopy_plugin_qemu(self): """Test rawcopy plugin in qemu""" # build ext4 and then use it for a wic image @@ -1113,6 +1117,7 @@ class Wic2(WicTestCase): self.assertEqual('1', result.output) @only_for_arch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") def test_biosplusefi_plugin_qemu(self): """Test biosplusefi plugin in qemu""" config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_biosplusefi_plugin.wks"\nMACHINE_FEATURES:append = " efi"\n' @@ -1172,6 +1177,7 @@ class Wic2(WicTestCase): # TODO this test could also work on aarch64 @only_for_arch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") def test_efi_plugin_unified_kernel_image_qemu(self): """Test efi plugin's Unified Kernel Image feature in qemu""" config = 'IMAGE_FSTYPES = "wic"\n'\ @@ -1381,6 +1387,7 @@ class Wic2(WicTestCase): self.assertEqual(1, len(out)) @only_for_arch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") def test_expand_mbr_image(self): """Test wic write --expand command for mbr image""" # build an image -- cgit 1.2.3-korg