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.

(From OE-Core rev: 3f45ce6d2b1dfde8bc3d554397d55f81846c52d5)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2022-03-31 19:29:08 +01:00
committed by Richard Purdie
parent 4e5f84902e
commit 416cce968d
8 changed files with 32 additions and 6 deletions

View File

@@ -9,10 +9,10 @@ import tempfile
import glob import glob
import fnmatch import fnmatch
import oeqa.utils.ftools as ftools
from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer 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.utils.commands import get_bb_vars, runqemu, get_test_layer
from oeqa.core.decorator import OETestTag
oldmetapath = None oldmetapath = None
@@ -1351,6 +1351,7 @@ class DevtoolExtractTests(DevtoolBase):
matches2 = glob.glob(stampprefix2 + '*') matches2 = glob.glob(stampprefix2 + '*')
self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2)
@OETestTag("runqemu")
def test_devtool_deploy_target(self): def test_devtool_deploy_target(self):
# NOTE: Whilst this test would seemingly be better placed as a runtime test, # 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 # unfortunately the runtime tests run under bitbake and you can't run

View File

@@ -114,37 +114,44 @@ class GccLibItmSelfTest(GccSelfTestBase):
self.run_check("libitm") self.run_check("libitm")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccCrossSelfTestSystemEmulated(GccSelfTestBase): class GccCrossSelfTestSystemEmulated(GccSelfTestBase):
def test_cross_gcc(self): def test_cross_gcc(self):
self.run_check_emulated("gcc") self.run_check_emulated("gcc")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GxxCrossSelfTestSystemEmulated(GccSelfTestBase): class GxxCrossSelfTestSystemEmulated(GccSelfTestBase):
def test_cross_gxx(self): def test_cross_gxx(self):
self.run_check_emulated("g++") self.run_check_emulated("g++")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccLibAtomicSelfTestSystemEmulated(GccSelfTestBase): class GccLibAtomicSelfTestSystemEmulated(GccSelfTestBase):
def test_libatomic(self): def test_libatomic(self):
self.run_check_emulated("libatomic") self.run_check_emulated("libatomic")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccLibGompSelfTestSystemEmulated(GccSelfTestBase): class GccLibGompSelfTestSystemEmulated(GccSelfTestBase):
def test_libgomp(self): def test_libgomp(self):
self.run_check_emulated("libgomp") self.run_check_emulated("libgomp")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccLibStdCxxSelfTestSystemEmulated(GccSelfTestBase): class GccLibStdCxxSelfTestSystemEmulated(GccSelfTestBase):
def test_libstdcxx(self): def test_libstdcxx(self):
self.run_check_emulated("libstdc++-v3") self.run_check_emulated("libstdc++-v3")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccLibSspSelfTestSystemEmulated(GccSelfTestBase): class GccLibSspSelfTestSystemEmulated(GccSelfTestBase):
def test_libssp(self): def test_libssp(self):
self.check_skip("libssp") self.check_skip("libssp")
self.run_check_emulated("libssp") self.run_check_emulated("libssp")
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GccLibItmSelfTestSystemEmulated(GccSelfTestBase): class GccLibItmSelfTestSystemEmulated(GccSelfTestBase):
def test_libitm(self): def test_libitm(self):
self.check_skip("libitm") self.check_skip("libitm")

View File

@@ -83,6 +83,7 @@ class GlibcSelfTest(GlibcSelfTestBase):
self.run_check() self.run_check()
@OETestTag("toolchain-system") @OETestTag("toolchain-system")
@OETestTag("runqemu")
class GlibcSelfTestSystemEmulated(GlibcSelfTestBase): class GlibcSelfTestSystemEmulated(GlibcSelfTestBase):
def test_glibc(self): def test_glibc(self):
self.run_check_emulated() self.run_check_emulated()

View File

@@ -3,6 +3,7 @@
# #
from oeqa.selftest.case import OESelftestTestCase 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.commands import runCmd, bitbake, get_bb_var, runqemu
from oeqa.utils.sshcontrol import SSHControl from oeqa.utils.sshcontrol import SSHControl
import glob import glob
@@ -14,6 +15,7 @@ class ImageFeatures(OESelftestTestCase):
test_user = 'tester' test_user = 'tester'
root_user = 'root' root_user = 'root'
@OETestTag("runqemu")
def test_non_root_user_can_connect_via_ssh_without_password(self): def test_non_root_user_can_connect_via_ssh_without_password(self):
""" """
Summary: Check if non root user can connect via ssh without password Summary: Check if non root user can connect via ssh without password
@@ -39,6 +41,7 @@ class ImageFeatures(OESelftestTestCase):
status, output = ssh.run("true") status, output = ssh.run("true")
self.assertEqual(status, 0, 'ssh to user %s failed with %s' % (user, output)) 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): def test_all_users_can_connect_via_ssh_without_password(self):
""" """
Summary: Check if all users can connect via ssh without password Summary: Check if all users can connect via ssh without password

View File

@@ -3,7 +3,8 @@
# #
from oeqa.selftest.case import OESelftestTestCase 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): def getline_qemu(out, line):
for l in out.split('\n'): for l in out.split('\n'):
@@ -185,6 +186,7 @@ EOT
line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount") line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount")
self.assertTrue(line and line.startswith("overlay"), msg=output) self.assertTrue(line and line.startswith("overlay"), msg=output)
@OETestTag("runqemu")
def test_correct_image_fstab(self): def test_correct_image_fstab(self):
""" """
Summary: Check that we can create an image when all parameters are 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) self._test_correct_image('base-files', base_files_append)
@OETestTag("runqemu")
def test_correct_image_unit(self): def test_correct_image_unit(self):
""" """
Summary: Check that we can create an image when all parameters are 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) self._test_correct_image('systemd-machine-units', systemd_machine_unit_append)
@OETestTag("runqemu")
class OverlayFSEtcRunTimeTests(OESelftestTestCase): class OverlayFSEtcRunTimeTests(OESelftestTestCase):
"""overlayfs-etc class tests""" """overlayfs-etc class tests"""

View File

@@ -12,6 +12,7 @@ from oeqa.core.decorator import OETestTag
from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd
@OETestTag("runqemu")
class RunqemuTests(OESelftestTestCase): class RunqemuTests(OESelftestTestCase):
"""Runqemu test class""" """Runqemu test class"""
@@ -149,6 +150,7 @@ SYSLINUX_TIMEOUT = "10"
# bootup various filesystem types, including live image(iso and hddimg) # bootup various filesystem types, including live image(iso and hddimg)
# where live image was not supported on all qemu architecture. # where live image was not supported on all qemu architecture.
@OETestTag("machine") @OETestTag("machine")
@OETestTag("runqemu")
class QemuTest(OESelftestTestCase): class QemuTest(OESelftestTestCase):
@classmethod @classmethod

View File

@@ -4,16 +4,15 @@
from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu 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 os
import re
import tempfile import tempfile
import shutil
import oe.lsb import oe.lsb
from oeqa.core.decorator.data import skipIfNotQemu from oeqa.core.decorator.data import skipIfNotQemu
class TestExport(OESelftestTestCase): class TestExport(OESelftestTestCase):
@OETestTag("runqemu")
def test_testexport_basic(self): def test_testexport_basic(self):
""" """
Summary: Check basic testexport functionality with only ping test enabled. 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") self.assertEqual(0, result.status, "Couldn't run tar from SDK")
@OETestTag("runqemu")
class TestImage(OESelftestTestCase): class TestImage(OESelftestTestCase):
def test_testimage_install(self): def test_testimage_install(self):
@@ -240,6 +240,7 @@ class TestImage(OESelftestTestCase):
bitbake('core-image-minimal') bitbake('core-image-minimal')
bitbake('-c testimage core-image-minimal') bitbake('-c testimage core-image-minimal')
@OETestTag("runqemu")
class Postinst(OESelftestTestCase): class Postinst(OESelftestTestCase):
def init_manager_loop(self, init_manager): 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")), self.assertFalse(os.path.isfile(os.path.join(hosttestdir, "rootfs-after-failure")),
"rootfs-after-failure file was created") "rootfs-after-failure file was created")
@OETestTag("runqemu")
class SystemTap(OESelftestTestCase): class SystemTap(OESelftestTestCase):
""" """
Summary: The purpose of this test case is to verify native crosstap 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 cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples
result = runCmd(cmd) result = runCmd(cmd)
self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output) self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output)

View File

@@ -19,6 +19,7 @@ from functools import wraps, lru_cache
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from oeqa.selftest.case import OESelftestTestCase 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 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 # TODO this should work on aarch64
@only_for_arch(['i586', 'i686', 'x86_64']) @only_for_arch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_qemu(self): def test_qemu(self):
"""Test wic-image-minimal under qemu""" """Test wic-image-minimal under qemu"""
config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ 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') self.assertEqual(output, 'UUID=2c71ef06-a81d-4735-9d3a-379b69c6bdba\t/media\text4\tdefaults\t0\t0')
@only_for_arch(['i586', 'i686', 'x86_64']) @only_for_arch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_qemu_efi(self): def test_qemu_efi(self):
"""Test core-image-minimal efi image under qemu""" """Test core-image-minimal efi image under qemu"""
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "mkefidisk.wks"\n' config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "mkefidisk.wks"\n'
@@ -1046,6 +1049,7 @@ class Wic2(WicTestCase):
self.assertGreaterEqual(size, 204800) self.assertGreaterEqual(size, 204800)
@only_for_arch(['i586', 'i686', 'x86_64', 'aarch64']) @only_for_arch(['i586', 'i686', 'x86_64', 'aarch64'])
@OETestTag("runqemu")
def test_rawcopy_plugin_qemu(self): def test_rawcopy_plugin_qemu(self):
"""Test rawcopy plugin in qemu""" """Test rawcopy plugin in qemu"""
# build ext4 and then use it for a wic image # build ext4 and then use it for a wic image
@@ -1113,6 +1117,7 @@ class Wic2(WicTestCase):
self.assertEqual('1', result.output) self.assertEqual('1', result.output)
@only_for_arch(['i586', 'i686', 'x86_64']) @only_for_arch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_biosplusefi_plugin_qemu(self): def test_biosplusefi_plugin_qemu(self):
"""Test biosplusefi plugin in qemu""" """Test biosplusefi plugin in qemu"""
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_biosplusefi_plugin.wks"\nMACHINE_FEATURES:append = " efi"\n' 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 # TODO this test could also work on aarch64
@only_for_arch(['i586', 'i686', 'x86_64']) @only_for_arch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_efi_plugin_unified_kernel_image_qemu(self): def test_efi_plugin_unified_kernel_image_qemu(self):
"""Test efi plugin's Unified Kernel Image feature in qemu""" """Test efi plugin's Unified Kernel Image feature in qemu"""
config = 'IMAGE_FSTYPES = "wic"\n'\ config = 'IMAGE_FSTYPES = "wic"\n'\
@@ -1381,6 +1387,7 @@ class Wic2(WicTestCase):
self.assertEqual(1, len(out)) self.assertEqual(1, len(out))
@only_for_arch(['i586', 'i686', 'x86_64']) @only_for_arch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_expand_mbr_image(self): def test_expand_mbr_image(self):
"""Test wic write --expand command for mbr image""" """Test wic write --expand command for mbr image"""
# build an image # build an image