summaryrefslogtreecommitdiff
path: root/poky/meta/lib/oeqa
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2020-05-26 20:25:03 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2020-05-26 20:25:03 +0300
commit35a774200999ac2fca48693c1c169bf99d2f63ea (patch)
tree0b2f65ce3a90f41d1c2542d0fd20b1604fd83fe5 /poky/meta/lib/oeqa
parent497a23ef6661ad6ca7b75009e48a592c1620d46c (diff)
downloadopenbmc-314c4ecc0c726599100089274ea2085e98a6691d.tar.xz
reset upstream subtrees to HEAD2.8.0-rc12.8.0
Reset the following subtrees on HEAD: poky: ed3bdd7fbc(dunfell) meta-raspberrypi: 8066fac91d(dunfell) meta-security: d83f7cb0c9(dunfell) meta-openembedded: e413c1ef62(dunfell) Change-Id: Ifd3228663b08911c890d7631310294cccb3dd232 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/lib/oeqa')
-rw-r--r--poky/meta/lib/oeqa/core/target/qemu.py6
-rw-r--r--poky/meta/lib/oeqa/runtime/cases/ptest.py6
-rw-r--r--poky/meta/lib/oeqa/runtime/cases/weston.py50
-rw-r--r--poky/meta/lib/oeqa/selftest/cases/imagefeatures.py32
-rw-r--r--poky/meta/lib/oeqa/selftest/cases/package.py23
-rw-r--r--poky/meta/lib/oeqa/selftest/cases/wic.py153
-rw-r--r--poky/meta/lib/oeqa/utils/qemurunner.py5
7 files changed, 37 insertions, 238 deletions
diff --git a/poky/meta/lib/oeqa/core/target/qemu.py b/poky/meta/lib/oeqa/core/target/qemu.py
index 295e8765e9..059106e915 100644
--- a/poky/meta/lib/oeqa/core/target/qemu.py
+++ b/poky/meta/lib/oeqa/core/target/qemu.py
@@ -20,7 +20,7 @@ class OEQemuTarget(OESSHTarget):
port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
dump_dir='', dump_host_cmds='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, serial_ports=2,
- boot_patterns = defaultdict(str), ovmf=False, **kwargs):
+ boot_patterns = defaultdict(str), **kwargs):
super(OEQemuTarget, self).__init__(logger, None, server_ip, timeout,
user, port)
@@ -31,7 +31,6 @@ class OEQemuTarget(OESSHTarget):
self.rootfs = rootfs
self.kernel = kernel
self.kvm = kvm
- self.ovmf = ovmf
self.use_slirp = slirp
self.boot_patterns = boot_patterns
@@ -40,8 +39,7 @@ class OEQemuTarget(OESSHTarget):
logfile=bootlog, boottime=boottime,
use_kvm=kvm, use_slirp=slirp, dump_dir=dump_dir,
dump_host_cmds=dump_host_cmds, logger=logger,
- serial_ports=serial_ports, boot_patterns = boot_patterns,
- use_ovmf=ovmf)
+ serial_ports=serial_ports, boot_patterns = boot_patterns)
def start(self, params=None, extra_bootparams=None, runqemuparams=''):
if self.use_slirp and not self.server_ip:
diff --git a/poky/meta/lib/oeqa/runtime/cases/ptest.py b/poky/meta/lib/oeqa/runtime/cases/ptest.py
index 1b1474adcf..99a44f0767 100644
--- a/poky/meta/lib/oeqa/runtime/cases/ptest.py
+++ b/poky/meta/lib/oeqa/runtime/cases/ptest.py
@@ -49,11 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase):
ptest_log_dir = '%s.%s' % (ptest_log_dir_link, timestamp)
ptest_runner_log = os.path.join(ptest_log_dir, 'ptest-runner.log')
- libdir = self.td.get('libdir', '')
- ptest_dirs = [ '/usr/lib' ]
- if not libdir in ptest_dirs:
- ptest_dirs.append(libdir)
- status, output = self.target.run('ptest-runner -d \"{}\"'.format(' '.join(ptest_dirs)), 0)
+ status, output = self.target.run('ptest-runner', 0)
os.makedirs(ptest_log_dir)
with open(ptest_runner_log, 'w') as f:
f.write(output)
diff --git a/poky/meta/lib/oeqa/runtime/cases/weston.py b/poky/meta/lib/oeqa/runtime/cases/weston.py
index ac29eca6e4..f32599afc3 100644
--- a/poky/meta/lib/oeqa/runtime/cases/weston.py
+++ b/poky/meta/lib/oeqa/runtime/cases/weston.py
@@ -6,15 +6,8 @@ from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
-import threading
-import time
class WestonTest(OERuntimeTestCase):
- weston_log_file = '/tmp/weston.log'
-
- @classmethod
- def tearDownClass(cls):
- cls.tc.target.run('rm %s' % cls.weston_log_file)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['weston'])
@@ -24,46 +17,3 @@ class WestonTest(OERuntimeTestCase):
msg = ('Weston does not appear to be running %s' %
self.target.run(self.tc.target_cmds['ps'])[1])
self.assertEqual(status, 0, msg=msg)
-
- def get_processes_of(self, target, error_msg):
- status, output = self.target.run('pidof %s' % target)
- self.assertEqual(status, 0, msg='Retrieve %s (%s) processes error: %s' % (target, error_msg, output))
- return output.split(" ")
-
- def get_weston_command(self, cmd):
- return 'export XDG_RUNTIME_DIR=/run/user/0; export WAYLAND_DISPLAY=wayland-0; %s' % cmd
-
- def run_weston_init(self):
- self.target.run(self.get_weston_command('weston --log=%s' % self.weston_log_file))
-
- def get_new_wayland_processes(self, existing_wl_processes):
- try_cnt = 0
- while try_cnt < 5:
- time.sleep(5 + 5*try_cnt)
- try_cnt += 1
- wl_processes = self.get_processes_of('weston-desktop-shell', 'existing and new')
- new_wl_processes = [x for x in wl_processes if x not in existing_wl_processes]
- if new_wl_processes:
- return new_wl_processes, try_cnt
-
- return new_wl_processes, try_cnt
-
- @OEHasPackage(['weston'])
- def test_weston_info(self):
- status, output = self.target.run(self.get_weston_command('weston-info'))
- self.assertEqual(status, 0, msg='weston-info error: %s' % output)
-
- @OEHasPackage(['weston'])
- def test_weston_can_initialize_new_wayland_compositor(self):
- existing_wl_processes = self.get_processes_of('weston-desktop-shell', 'existing')
- existing_weston_processes = self.get_processes_of('weston', 'existing')
-
- weston_thread = threading.Thread(target=self.run_weston_init)
- weston_thread.start()
- new_wl_processes, try_cnt = self.get_new_wayland_processes(existing_wl_processes)
- existing_and_new_weston_processes = self.get_processes_of('weston', 'existing and new')
- new_weston_processes = [x for x in existing_and_new_weston_processes if x not in existing_weston_processes]
- for w in new_weston_processes:
- self.target.run('kill -9 %s' % w)
- __, weston_log = self.target.run('cat %s' % self.weston_log_file)
- self.assertTrue(new_wl_processes, msg='Could not get new weston-desktop-shell processes (%s, try_cnt:%s) weston log: %s' % (new_wl_processes, try_cnt, weston_log))
diff --git a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py
index 5c519ac3d6..2b9c4998f7 100644
--- a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -262,3 +262,35 @@ 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)
diff --git a/poky/meta/lib/oeqa/selftest/cases/package.py b/poky/meta/lib/oeqa/selftest/cases/package.py
index 3010b1af49..b87f8dc3e2 100644
--- a/poky/meta/lib/oeqa/selftest/cases/package.py
+++ b/poky/meta/lib/oeqa/selftest/cases/package.py
@@ -148,26 +148,3 @@ class PackageTests(OESelftestTestCase):
'/usr/libexec/hello4']:
if not gdbtest(qemu, binary):
self.fail('GDB %s failed' % binary)
-
- def test_preserve_ownership(self):
- import os, stat, oe.cachedpath
- features = 'IMAGE_INSTALL_append = " selftest-chown"\n'
- self.write_config(features)
- bitbake("core-image-minimal")
-
- sysconfdir = get_bb_var('sysconfdir', 'selftest-chown')
- def check_ownership(qemu, gid, uid, path):
- self.logger.info("Check ownership of %s", path)
- status, output = qemu.run_serial(r'/bin/stat -c "%U %G" ' + path, timeout=60)
- output = output.split(" ")
- if output[0] != uid or output[1] != gid :
- self.logger.error("Incrrect ownership %s [%s:%s]", path, output[0], output[1])
- return False
- return True
-
- with runqemu('core-image-minimal') as qemu:
- for path in [ sysconfdir + "/selftest-chown/file",
- sysconfdir + "/selftest-chown/dir",
- sysconfdir + "/selftest-chown/symlink"]:
- if not check_ownership(qemu, "test", "test", path):
- self.fail('Test ownership %s failed' % path)
diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py
index c8765e5330..626a217e69 100644
--- a/poky/meta/lib/oeqa/selftest/cases/wic.py
+++ b/poky/meta/lib/oeqa/selftest/cases/wic.py
@@ -62,12 +62,6 @@ def extract_files(debugfs_output):
return [line.split('/')[5].strip() for line in \
debugfs_output.strip().split('/\n')]
-def files_own_by_root(debugfs_output):
- for line in debugfs_output.strip().split('/\n'):
- if line.split('/')[3:5] != ['0', '0']:
- print(debugfs_output)
- return False
- return True
class WicTestCase(OESelftestTestCase):
"""Wic test class."""
@@ -90,7 +84,6 @@ class WicTestCase(OESelftestTestCase):
self.skipTest('wic-tools cannot be built due its (intltool|gettext)-native dependency and NLS disable')
bitbake('core-image-minimal')
- bitbake('core-image-minimal-mtdutils')
WicTestCase.image_is_ready = True
rmtree(self.resultdir, ignore_errors=True)
@@ -486,76 +479,15 @@ part /part2 --source rootfs --ondisk mmcblk0 --fstype=ext4 --include-path %s"""
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
files = extract_files(res.output)
self.assertNotIn('test-file', files)
- self.assertEqual(True, files_own_by_root(res.output))
- # Test partition 2, should contain 'test-file'
+ # Test partition 2, should not contain 'test-file'
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part2))
files = extract_files(res.output)
self.assertIn('test-file', files)
- self.assertEqual(True, files_own_by_root(res.output))
finally:
os.environ['PATH'] = oldpath
- def test_include_path_embeded(self):
- """Test --include-path wks option."""
-
- oldpath = os.environ['PATH']
- os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
-
- try:
- include_path = os.path.join(self.resultdir, 'test-include')
- os.makedirs(include_path)
- with open(os.path.join(include_path, 'test-file'), 'w') as t:
- t.write("test\n")
- wks_file = os.path.join(include_path, 'temp.wks')
- with open(wks_file, 'w') as wks:
- wks.write("""
-part / --source rootfs --fstype=ext4 --include-path %s --include-path core-image-minimal-mtdutils export/"""
- % (include_path))
- runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir))
-
- part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
-
- res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
- files = extract_files(res.output)
- self.assertIn('test-file', files)
- self.assertEqual(True, files_own_by_root(res.output))
-
- res = runCmd("debugfs -R 'ls -p /export/etc/' %s 2>/dev/null" % (part1))
- files = extract_files(res.output)
- self.assertIn('passwd', files)
- self.assertEqual(True, files_own_by_root(res.output))
-
- finally:
- os.environ['PATH'] = oldpath
-
- def test_include_path_errors(self):
- """Test --include-path wks option error handling."""
- wks_file = 'temp.wks'
-
- # Absolute argument.
- with open(wks_file, 'w') as wks:
- wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils /export")
- self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir), ignore_status=True).status)
- os.remove(wks_file)
-
- # Argument pointing to parent directory.
- with open(wks_file, 'w') as wks:
- wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils ././..")
- self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir), ignore_status=True).status)
- os.remove(wks_file)
-
- # 3 Argument pointing to parent directory.
- with open(wks_file, 'w') as wks:
- wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils export/ dummy")
- self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir), ignore_status=True).status)
- os.remove(wks_file)
-
def test_exclude_path_errors(self):
"""Test --exclude-path wks option error handling."""
wks_file = 'temp.wks'
@@ -574,89 +506,6 @@ part / --source rootfs --fstype=ext4 --include-path %s --include-path core-imag
% (wks_file, self.resultdir), ignore_status=True).status)
os.remove(wks_file)
- def test_permissions(self):
- """Test permissions are respected"""
-
- oldpath = os.environ['PATH']
- os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
-
- t_normal = """
-part / --source rootfs --fstype=ext4
-"""
- t_exclude = """
-part / --source rootfs --fstype=ext4 --exclude-path=home
-"""
- t_multi = """
-part / --source rootfs --ondisk sda --fstype=ext4
-part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4
-"""
- t_change = """
-part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/   
-part /etc --source rootfs --fstype=ext4 --change-directory=etc
-"""
- tests = [t_normal, t_exclude, t_multi, t_change]
-
- try:
- for test in tests:
- include_path = os.path.join(self.resultdir, 'test-include')
- os.makedirs(include_path)
- wks_file = os.path.join(include_path, 'temp.wks')
- with open(wks_file, 'w') as wks:
- wks.write(test)
- runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir))
-
- for part in glob(os.path.join(self.resultdir, 'temp-*.direct.p*')):
- res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part))
- self.assertEqual(True, files_own_by_root(res.output))
-
- rmtree(self.resultdir, ignore_errors=True)
-
- finally:
- os.environ['PATH'] = oldpath
-
- def test_change_directory(self):
- """Test --change-directory wks option."""
-
- oldpath = os.environ['PATH']
- os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
-
- try:
- include_path = os.path.join(self.resultdir, 'test-include')
- os.makedirs(include_path)
- wks_file = os.path.join(include_path, 'temp.wks')
- with open(wks_file, 'w') as wks:
- wks.write("part /etc --source rootfs --fstype=ext4 --change-directory=etc")
- runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir))
-
- part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
-
- res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
- files = extract_files(res.output)
- self.assertIn('passwd', files)
-
- finally:
- os.environ['PATH'] = oldpath
-
- def test_change_directory_errors(self):
- """Test --change-directory wks option error handling."""
- wks_file = 'temp.wks'
-
- # Absolute argument.
- with open(wks_file, 'w') as wks:
- wks.write("part / --source rootfs --fstype=ext4 --change-directory /usr")
- self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir), ignore_status=True).status)
- os.remove(wks_file)
-
- # Argument pointing to parent directory.
- with open(wks_file, 'w') as wks:
- wks.write("part / --source rootfs --fstype=ext4 --change-directory ././..")
- self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
- % (wks_file, self.resultdir), ignore_status=True).status)
- os.remove(wks_file)
-
class Wic2(WicTestCase):
def test_bmap_short(self):
diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py
index 4b74337652..cd95d33bdc 100644
--- a/poky/meta/lib/oeqa/utils/qemurunner.py
+++ b/poky/meta/lib/oeqa/utils/qemurunner.py
@@ -32,7 +32,7 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
class QemuRunner:
def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
- use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False):
+ use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str)):
# Popen object for runqemu
self.runqemu = None
@@ -56,7 +56,6 @@ class QemuRunner:
self.logged = False
self.thread = None
self.use_kvm = use_kvm
- self.use_ovmf = use_ovmf
self.use_slirp = use_slirp
self.serial_ports = serial_ports
self.msg = ''
@@ -159,8 +158,6 @@ class QemuRunner:
launch_cmd += ' nographic'
if self.use_slirp:
launch_cmd += ' slirp'
- if self.use_ovmf:
- launch_cmd += ' ovmf'
launch_cmd += ' %s %s %s' % (runqemuparams, self.machine, self.rootfs)
return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env)