From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- external/poky/meta/lib/oeqa/runtime/case.py | 5 +- .../poky/meta/lib/oeqa/runtime/cases/_qemutiny.py | 4 + external/poky/meta/lib/oeqa/runtime/cases/apt.py | 8 +- external/poky/meta/lib/oeqa/runtime/cases/boot.py | 33 +++++ .../poky/meta/lib/oeqa/runtime/cases/buildcpio.py | 10 +- .../meta/lib/oeqa/runtime/cases/buildgalculator.py | 7 +- .../poky/meta/lib/oeqa/runtime/cases/buildlzip.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/connman.py | 7 +- external/poky/meta/lib/oeqa/runtime/cases/date.py | 10 +- external/poky/meta/lib/oeqa/runtime/cases/df.py | 8 +- external/poky/meta/lib/oeqa/runtime/cases/dnf.py | 58 +++++--- external/poky/meta/lib/oeqa/runtime/cases/gcc.py | 9 +- external/poky/meta/lib/oeqa/runtime/cases/gi.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/gstreamer.py | 18 +++ .../meta/lib/oeqa/runtime/cases/kernelmodule.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/ksample.py | 16 ++- external/poky/meta/lib/oeqa/runtime/cases/ldd.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/logrotate.py | 65 ++++++--- external/poky/meta/lib/oeqa/runtime/cases/ltp.py | 119 ++++++++++++++++ .../meta/lib/oeqa/runtime/cases/ltp_compliance.py | 97 ++++++++++++++ .../poky/meta/lib/oeqa/runtime/cases/ltp_stress.py | 98 ++++++++++++++ .../poky/meta/lib/oeqa/runtime/cases/multilib.py | 7 +- .../poky/meta/lib/oeqa/runtime/cases/oe_syslog.py | 91 +++++++++++-- external/poky/meta/lib/oeqa/runtime/cases/opkg.py | 12 +- external/poky/meta/lib/oeqa/runtime/cases/pam.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/parselogs.py | 34 ++++- external/poky/meta/lib/oeqa/runtime/cases/perl.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/ping.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/ptest.py | 33 ++++- .../poky/meta/lib/oeqa/runtime/cases/python.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/rpm.py | 85 +++++++----- external/poky/meta/lib/oeqa/runtime/cases/scons.py | 37 +++++ external/poky/meta/lib/oeqa/runtime/cases/scp.py | 6 +- .../meta/lib/oeqa/runtime/cases/skeletoninit.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/ssh.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/stap.py | 6 +- .../poky/meta/lib/oeqa/runtime/cases/storage.py | 149 +++++++++++++++++++++ .../poky/meta/lib/oeqa/runtime/cases/systemd.py | 25 +++- .../poky/meta/lib/oeqa/runtime/cases/weston.py | 19 +++ .../poky/meta/lib/oeqa/runtime/cases/x32lib.py | 6 +- external/poky/meta/lib/oeqa/runtime/cases/xorg.py | 6 +- external/poky/meta/lib/oeqa/runtime/context.py | 18 ++- .../meta/lib/oeqa/runtime/decorator/package.py | 5 +- .../poky/meta/lib/oeqa/runtime/files/SConstruct | 1 + external/poky/meta/lib/oeqa/runtime/files/hello.c | 5 + external/poky/meta/lib/oeqa/runtime/loader.py | 5 +- .../lib/oeqa/runtime/utils/targetbuildproject.py | 9 +- 47 files changed, 1022 insertions(+), 169 deletions(-) create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/boot.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/gstreamer.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/ltp.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/ltp_compliance.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/ltp_stress.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/scons.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/storage.py create mode 100644 external/poky/meta/lib/oeqa/runtime/cases/weston.py create mode 100644 external/poky/meta/lib/oeqa/runtime/files/SConstruct create mode 100644 external/poky/meta/lib/oeqa/runtime/files/hello.c (limited to 'external/poky/meta/lib/oeqa/runtime') diff --git a/external/poky/meta/lib/oeqa/runtime/case.py b/external/poky/meta/lib/oeqa/runtime/case.py index 2f190acf..f036982e 100644 --- a/external/poky/meta/lib/oeqa/runtime/case.py +++ b/external/poky/meta/lib/oeqa/runtime/case.py @@ -1,5 +1,8 @@ +# # Copyright (C) 2016 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# from oeqa.core.case import OETestCase from oeqa.utils.package_manager import install_package, uninstall_package diff --git a/external/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py b/external/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py index 7b5b4814..6886e365 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase class QemuTinyTest(OERuntimeTestCase): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/apt.py b/external/poky/meta/lib/oeqa/runtime/cases/apt.py index 793143f7..c5378d90 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/apt.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/apt.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.utils.httpserver import HTTPService from oeqa.runtime.case import OERuntimeTestCase @@ -18,7 +22,9 @@ class AptRepoTest(AptTest): @classmethod def setUpClass(cls): service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_DEB'], 'all') - cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip, logger=cls.tc.logger) + cls.repo_server = HTTPService(service_repo, + '0.0.0.0', port=cls.tc.target.server_port, + logger=cls.tc.logger) cls.repo_server.start() @classmethod diff --git a/external/poky/meta/lib/oeqa/runtime/cases/boot.py b/external/poky/meta/lib/oeqa/runtime/cases/boot.py new file mode 100644 index 00000000..2142f400 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/boot.py @@ -0,0 +1,33 @@ +# +# SPDX-License-Identifier: MIT +# + +from subprocess import Popen, PIPE +import time + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.oetimeout import OETimeout +from oeqa.core.decorator.data import skipIfQemu + +class BootTest(OERuntimeTestCase): + + @OETimeout(120) + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_reboot(self): + output = '' + count = 0 + (status, output) = self.target.run('reboot -h') + while count < 5: + time.sleep(5) + cmd = 'ping -c 1 %s' % self.target.ip + proc = Popen(cmd, shell=True, stdout=PIPE) + output += proc.communicate()[0].decode('utf-8') + if proc.poll() == 0: + count += 1 + else: + count = 0 + msg = ('Expected 5 consecutive, got %d.\n' + 'ping output is:\n%s' % (count,output)) + self.assertEqual(count, 5, msg = msg) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/buildcpio.py b/external/poky/meta/lib/oeqa/runtime/cases/buildcpio.py index a61d1e03..d0f91668 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/buildcpio.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/buildcpio.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage from oeqa.runtime.utils.targetbuildproject import TargetBuildProject @@ -9,7 +12,7 @@ class BuildCpioTest(OERuntimeTestCase): @classmethod def setUpClass(cls): - uri = 'https://downloads.yoctoproject.org/mirror/sources/cpio-2.12.tar.gz' + uri = 'https://downloads.yoctoproject.org/mirror/sources/cpio-2.13.tar.gz' cls.project = TargetBuildProject(cls.tc.target, uri, dl_dir = cls.tc.td['DL_DIR']) @@ -18,13 +21,12 @@ class BuildCpioTest(OERuntimeTestCase): def tearDownClass(cls): cls.project.clean() - @OETestID(205) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['gcc']) @OEHasPackage(['make']) @OEHasPackage(['autoconf']) def test_cpio(self): self.project.download_archive() - self.project.run_configure() + self.project.run_configure('--disable-maintainer-mode','') self.project.run_make() self.project.run_install() diff --git a/external/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py b/external/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py index a0a00320..e5cc3e28 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage from oeqa.runtime.utils.targetbuildproject import TargetBuildProject @@ -18,11 +21,11 @@ class GalculatorTest(OERuntimeTestCase): def tearDownClass(cls): cls.project.clean() - @OETestID(1526) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['gcc']) @OEHasPackage(['make']) @OEHasPackage(['autoconf']) + @OEHasPackage(['gtk+3']) def test_galculator(self): self.project.download_archive() self.project.run_configure() diff --git a/external/poky/meta/lib/oeqa/runtime/cases/buildlzip.py b/external/poky/meta/lib/oeqa/runtime/cases/buildlzip.py index 5b455a07..bc70b414 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/buildlzip.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/buildlzip.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage from oeqa.runtime.utils.targetbuildproject import TargetBuildProject @@ -19,7 +22,6 @@ class BuildLzipTest(OERuntimeTestCase): def tearDownClass(cls): cls.project.clean() - @OETestID(206) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['gcc']) @OEHasPackage(['make']) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/connman.py b/external/poky/meta/lib/oeqa/runtime/cases/connman.py index 12456b41..f0d15fac 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/connman.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/connman.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class ConnmanTest(OERuntimeTestCase): @@ -12,7 +15,6 @@ class ConnmanTest(OERuntimeTestCase): else: return "Unable to get status or logs for %s" % service - @OETestID(961) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(["connman"]) def test_connmand_help(self): @@ -20,7 +22,6 @@ class ConnmanTest(OERuntimeTestCase): msg = 'Failed to get connman help. Output: %s' % output self.assertEqual(status, 0, msg=msg) - @OETestID(221) @OETestDepends(['connman.ConnmanTest.test_connmand_help']) def test_connmand_running(self): cmd = '%s | grep [c]onnmand' % self.tc.target_cmds['ps'] diff --git a/external/poky/meta/lib/oeqa/runtime/cases/date.py b/external/poky/meta/lib/oeqa/runtime/cases/date.py index 0887b831..fdd2a6ae 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/date.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/date.py @@ -1,8 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + import re from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class DateTest(OERuntimeTestCase): @@ -10,14 +13,13 @@ class DateTest(OERuntimeTestCase): def setUp(self): if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': self.logger.debug('Stopping systemd-timesyncd daemon') - self.target.run('systemctl stop systemd-timesyncd') + self.target.run('systemctl disable --now systemd-timesyncd') def tearDown(self): if self.tc.td.get('VIRTUAL-RUNTIME_init_manager') == 'systemd': self.logger.debug('Starting systemd-timesyncd daemon') - self.target.run('systemctl start systemd-timesyncd') + self.target.run('systemctl enable --now systemd-timesyncd') - @OETestID(211) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['coreutils', 'busybox']) def test_date(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/df.py b/external/poky/meta/lib/oeqa/runtime/cases/df.py index e0b6bb83..89fd0fb9 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/df.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/df.py @@ -1,15 +1,17 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class DfTest(OERuntimeTestCase): - @OETestID(234) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['coreutils', 'busybox']) def test_df(self): - cmd = "df / | sed -n '2p' | awk '{print $4}'" + cmd = "df -P / | sed -n '2p' | awk '{print $4}'" (status,output) = self.target.run(cmd) msg = 'Not enough space on image. Current size is %s' % output self.assertTrue(int(output)>5120, msg=msg) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/dnf.py b/external/poky/meta/lib/oeqa/runtime/cases/dnf.py index c1ed39d7..f40c6302 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/dnf.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/dnf.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: MIT +# + import os import re import subprocess @@ -5,8 +9,7 @@ from oeqa.utils.httpserver import HTTPService from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID -from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature +from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature, skipIfInDataVar, skipIfNotInDataVar from oeqa.runtime.decorator.package import OEHasPackage class DnfTest(OERuntimeTestCase): @@ -26,27 +29,22 @@ class DnfBasicTest(DnfTest): 'RPM is not the primary package manager') @OEHasPackage(['dnf']) @OETestDepends(['ssh.SSHTest.test_ssh']) - @OETestID(1735) def test_dnf_help(self): self.dnf('--help') @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - @OETestID(1739) def test_dnf_version(self): self.dnf('--version') @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - @OETestID(1737) def test_dnf_info(self): self.dnf('info dnf') @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - @OETestID(1738) def test_dnf_search(self): self.dnf('search dnf') @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - @OETestID(1736) def test_dnf_history(self): self.dnf('history') @@ -55,7 +53,8 @@ class DnfRepoTest(DnfTest): @classmethod def setUpClass(cls): cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-testimage-repo'), - cls.tc.target.server_ip, logger=cls.tc.logger) + '0.0.0.0', port=cls.tc.target.server_port, + logger=cls.tc.logger) cls.repo_server.start() @classmethod @@ -71,7 +70,6 @@ class DnfRepoTest(DnfTest): return output @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) - @OETestID(1744) def test_dnf_makecache(self): self.dnf_with_repo('makecache') @@ -82,12 +80,10 @@ class DnfRepoTest(DnfTest): # self.dnf_with_repo('repolist') @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) - @OETestID(1746) def test_dnf_repoinfo(self): self.dnf_with_repo('repoinfo') @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) - @OETestID(1740) def test_dnf_install(self): output = self.dnf_with_repo('list run-postinsts-dev') if 'Installed Packages' in output: @@ -95,13 +91,11 @@ class DnfRepoTest(DnfTest): self.dnf_with_repo('install -y run-postinsts-dev') @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) - @OETestID(1741) def test_dnf_install_dependency(self): self.dnf_with_repo('remove -y run-postinsts') self.dnf_with_repo('install -y run-postinsts-dev') @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_dependency']) - @OETestID(1742) def test_dnf_install_from_disk(self): self.dnf_with_repo('remove -y run-postinsts-dev') self.dnf_with_repo('install -y --downloadonly run-postinsts-dev') @@ -110,7 +104,6 @@ class DnfRepoTest(DnfTest): self.dnf_with_repo('install -y %s' % output) @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_from_disk']) - @OETestID(1743) def test_dnf_install_from_http(self): output = subprocess.check_output('%s %s -name run-postinsts-dev*' % (bb.utils.which(os.getenv('PATH'), "find"), os.path.join(self.tc.td['WORKDIR'], 'oe-testimage-repo')), shell=True).decode("utf-8") @@ -120,12 +113,12 @@ class DnfRepoTest(DnfTest): self.dnf_with_repo('install -y %s' % url) @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) - @OETestID(1745) def test_dnf_reinstall(self): self.dnf_with_repo('reinstall -y run-postinsts-dev') @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) - @OETestID(1771) + @skipIfInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when not enable usrmerge') + @OEHasPackage('busybox') def test_dnf_installroot(self): rootpath = '/home/root/chroot/test' #Copy necessary files to avoid errors with not yet installed tools on @@ -151,7 +144,38 @@ class DnfRepoTest(DnfTest): self.assertEqual(0, status, output) @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) - @OETestID(1772) + @skipIfNotInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when enable usrmege') + @OEHasPackage('busybox') + def test_dnf_installroot_usrmerge(self): + rootpath = '/home/root/chroot/test' + #Copy necessary files to avoid errors with not yet installed tools on + #installroot directory. + self.target.run('mkdir -p %s/etc' % rootpath, 1500) + self.target.run('mkdir -p %s/usr/bin %s/usr/sbin' % (rootpath, rootpath), 1500) + self.target.run('ln -sf -r %s/usr/bin %s/bin' % (rootpath, rootpath), 1500) + self.target.run('ln -sf -r %s/usr/sbin %s/sbin' % (rootpath, rootpath), 1500) + self.target.run('mkdir -p %s/dev' % rootpath, 1500) + #Handle different architectures lib dirs + self.target.run('mkdir -p %s/usr/lib' % rootpath, 1500) + self.target.run('mkdir -p %s/usr/libx32' % rootpath, 1500) + self.target.run('mkdir -p %s/usr/lib64' % rootpath, 1500) + self.target.run('cp /lib/libtinfo.so.5 %s/usr/lib' % rootpath, 1500) + self.target.run('cp /libx32/libtinfo.so.5 %s/usr/libx32' % rootpath, 1500) + self.target.run('cp /lib64/libtinfo.so.5 %s/usr/lib64' % rootpath, 1500) + self.target.run('ln -sf -r %s/lib %s/usr/lib' % (rootpath,rootpath), 1500) + self.target.run('ln -sf -r %s/libx32 %s/usr/libx32' % (rootpath,rootpath), 1500) + self.target.run('ln -sf -r %s/lib64 %s/usr/lib64' % (rootpath,rootpath), 1500) + self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500) + self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500) + self.target.run('cp /bin/sh %s/bin' % rootpath, 1500) + self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500) + self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath) + status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500) + self.assertEqual(0, status, output) + status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500) + self.assertEqual(0, status, output) + + @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) def test_dnf_exclude(self): excludepkg = 'curl-dev' self.dnf_with_repo('install -y curl*') diff --git a/external/poky/meta/lib/oeqa/runtime/cases/gcc.py b/external/poky/meta/lib/oeqa/runtime/cases/gcc.py index 8265c59f..1b6e431b 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/gcc.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/gcc.py @@ -1,8 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class GccCompileTest(OERuntimeTestCase): @@ -24,7 +27,6 @@ class GccCompileTest(OERuntimeTestCase): files = '/tmp/test.c /tmp/test.o /tmp/test /tmp/testmakefile' cls.tc.target.run('rm %s' % files) - @OETestID(203) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['gcc']) def test_gcc_compile(self): @@ -36,7 +38,6 @@ class GccCompileTest(OERuntimeTestCase): msg = 'running compiled file failed, output: %s' % output self.assertEqual(status, 0, msg=msg) - @OETestID(200) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['g++']) def test_gpp_compile(self): @@ -48,7 +49,6 @@ class GccCompileTest(OERuntimeTestCase): msg = 'running compiled file failed, output: %s' % output self.assertEqual(status, 0, msg=msg) - @OETestID(1142) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['g++']) def test_gpp2_compile(self): @@ -60,7 +60,6 @@ class GccCompileTest(OERuntimeTestCase): msg = 'running compiled file failed, output: %s' % output self.assertEqual(status, 0, msg=msg) - @OETestID(204) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['gcc']) @OEHasPackage(['make']) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/gi.py b/external/poky/meta/lib/oeqa/runtime/cases/gi.py index 19073e52..42bd100a 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/gi.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/gi.py @@ -1,3 +1,7 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.runtime.case import OERuntimeTestCase @@ -9,7 +13,7 @@ class GObjectIntrospectionTest(OERuntimeTestCase): @OETestDepends(["ssh.SSHTest.test_ssh"]) @OEHasPackage(["python3-pygobject"]) def test_python(self): - script = """from gi.repository import GObject; print(GObject.markup_escape_text(""))""" + script = """from gi.repository import GLib; print(GLib.markup_escape_text(""))""" status, output = self.target.run("python3 -c '%s'" % script) self.assertEqual(status, 0, msg="Python failed (%s)" % (output)) self.assertEqual(output, "<testing&testing>", msg="Unexpected output (%s)" % output) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/gstreamer.py b/external/poky/meta/lib/oeqa/runtime/cases/gstreamer.py new file mode 100644 index 00000000..f735f82e --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/gstreamer.py @@ -0,0 +1,18 @@ +# +# SPDX-License-Identifier: MIT +# + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.runtime.decorator.package import OEHasPackage + +class GstreamerCliTest(OERuntimeTestCase): + + @OEHasPackage(['gstreamer1.0']) + def test_gst_inspect_can_list_all_plugins(self): + status, output = self.target.run('gst-inspect-1.0') + self.assertEqual(status, 0, 'gst-inspect-1.0 does not appear to be running.') + + @OEHasPackage(['gstreamer1.0']) + def test_gst_launch_can_create_video_pipeline(self): + status, output = self.target.run('gst-launch-1.0 -v fakesrc silent=false num-buffers=3 ! fakesink silent=false') + self.assertEqual(status, 0, 'gst-launch-1.0 does not appear to be running.') diff --git a/external/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py b/external/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py index 27a2c35b..47fd2f85 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py @@ -1,8 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage @@ -23,7 +26,6 @@ class KernelModuleTest(OERuntimeTestCase): files = '/tmp/Makefile /tmp/hellomod.c' cls.tc.target.run('rm %s' % files) - @OETestID(1541) @skipIfNotFeature('tools-sdk', 'Test requires tools-sdk to be in IMAGE_FEATURES') @OETestDepends(['gcc.GccCompileTest.test_gcc_compile']) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ksample.py b/external/poky/meta/lib/oeqa/runtime/cases/ksample.py index 354cc976..a9a1620e 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/ksample.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/ksample.py @@ -1,9 +1,12 @@ +# +# SPDX-License-Identifier: MIT +# + import os import time from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature # need some kernel fragments @@ -22,6 +25,12 @@ class KSample(OERuntimeTestCase): self.assertTrue(result, msg) self.assertEqual(status, 0, cmd) + def check_arch(self, archset=''): + status, output = self.target.run("uname -m") + result = ("%s" % output) in archset + if not result: + self.skipTest("This case doesn't support %s" % output) + def check_config(self, config_opt=''): cmd = "zcat /proc/config.gz | grep %s" % config_opt status, output = self.target.run(cmd) @@ -99,6 +108,7 @@ class KSampleTest(KSample): # kprobe @OETestDepends(['ssh.SSHTest.test_ssh']) def test_kprobe_test(self): + self.check_arch("x86_64 i686 ppc") index = ["kprobe", "kretprobe"] for i in index: self.kprobe_func(i) @@ -166,9 +176,9 @@ class KSampleTest(KSample): def test_hw_breakpoint_example(self): # check arch status, output = self.target.run("uname -m") - result = ("x86" in output) or ("aarch64" in output) + result = ("x86_64" in output) or ("aarch64" in output) if not result: - self.skipTest("the arch doesn't support hw breakpoint" % output) + self.skipTest("the arch %s doesn't support hw breakpoint" % output) # check config self.check_config("CONFIG_KALLSYMS_ALL") # make sure if module exists diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ldd.py b/external/poky/meta/lib/oeqa/runtime/cases/ldd.py index 5bde1845..9c2caa8f 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/ldd.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/ldd.py @@ -1,12 +1,14 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage class LddTest(OERuntimeTestCase): - @OETestID(962) @OEHasPackage(["ldd"]) @OETestDepends(['ssh.SSHTest.test_ssh']) def test_ldd(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/logrotate.py b/external/poky/meta/lib/oeqa/runtime/cases/logrotate.py index d2666444..a4efcd07 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/logrotate.py @@ -1,9 +1,12 @@ +# +# SPDX-License-Identifier: MIT +# + # This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=289 testcase # Note that the image under test must have logrotate installed from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class LogrotateTest(OERuntimeTestCase): @@ -15,32 +18,54 @@ class LogrotateTest(OERuntimeTestCase): @classmethod def tearDownClass(cls): cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf $HOME/logrotate_dir') + cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') - @OETestID(1544) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['logrotate']) - def test_1_logrotate_setup(self): + def test_logrotate_wtmp(self): + + # /var/log/wtmp may not always exist initially, so use touch to ensure it is present + status, output = self.target.run('touch /var/log/wtmp') + msg = ('Could not create/update /var/log/wtmp with touch') + self.assertEqual(status, 0, msg = msg) + status, output = self.target.run('mkdir $HOME/logrotate_dir') - msg = 'Could not create logrotate_dir. Output: %s' % output + msg = ('Could not create logrotate_dir. Output: %s' % output) self.assertEqual(status, 0, msg = msg) - cmd = ('sed -i "s#wtmp {#wtmp {\\n olddir $HOME/logrotate_dir#"' - ' /etc/logrotate.d/wtmp') - status, output = self.target.run(cmd) - msg = ('Could not write to logrotate.d/wtmp file. Status and output: ' - ' %s and %s' % (status, output)) + status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/wtmp" > /tmp/logrotate-test.conf') + msg = ('Could not write to /tmp/logrotate-test.conf') + self.assertEqual(status, 0, msg = msg) + + # If logrotate fails to rotate the log, view the verbose output of logrotate to see what prevented it + _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test.conf') + status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep wtmp.1') + msg = ("logrotate did not successfully rotate the wtmp log. Output from logrotate -vf: \n%s" % (logrotate_output)) + self.assertEqual(status, 0, msg = msg) + + @OETestDepends(['logrotate.LogrotateTest.test_logrotate_wtmp']) + def test_logrotate_newlog(self): + + status, output = self.target.run('echo "oeqa logrotate test file" > /var/log/logrotate_testfile') + msg = ('Could not create logrotate test file in /var/log') + self.assertEqual(status, 0, msg = msg) + + status, output = self.target.run('echo "/var/log/logrotate_testfile {\n missingok \n monthly \n rotate 1" > /etc/logrotate.d/logrotate_testfile') + msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') self.assertEqual(status, 0, msg = msg) - @OETestID(1542) - @OETestDepends(['logrotate.LogrotateTest.test_1_logrotate_setup']) - def test_2_logrotate(self): - status, output = self.target.run('logrotate -f /etc/logrotate.conf') - msg = ('logrotate service could not be reloaded. Status and output: ' - '%s and %s' % (status, output)) + status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') + msg = ('Could not write to /tmp/logrotate_test2.conf') self.assertEqual(status, 0, msg = msg) - _, output = self.target.run('ls -la $HOME/logrotate_dir/ | wc -l') - msg = ('new logfile could not be created. List of files within log ' - 'directory: %s' % ( - self.target.run('ls -la $HOME/logrotate_dir')[1])) - self.assertTrue(int(output)>=3, msg = msg) + status, output = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') + msg = ('A rotated log for logrotate_testfile is already present in logrotate_dir') + self.assertEqual(status, 1, msg = msg) + + # If logrotate fails to rotate the log, view the verbose output of logrotate instead of just listing the files in olddir + _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test2.conf') + status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') + msg = ('logrotate did not successfully rotate the logrotate_test log. Output from logrotate -vf: \n%s' % (logrotate_output)) + self.assertEqual(status, 0, msg = msg) + + diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ltp.py b/external/poky/meta/lib/oeqa/runtime/cases/ltp.py new file mode 100644 index 00000000..a66d5d13 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/ltp.py @@ -0,0 +1,119 @@ +# LTP runtime +# +# Copyright (c) 2019 MontaVista Software, LLC +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import time +import datetime +import pprint + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage +from oeqa.utils.logparser import LtpParser + +class LtpTestBase(OERuntimeTestCase): + + @classmethod + def setUpClass(cls): + cls.ltp_startup() + + @classmethod + def tearDownClass(cls): + cls.ltp_finishup() + + @classmethod + def ltp_startup(cls): + cls.sections = {} + cls.failmsg = "" + test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage') + timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + + cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltp_log') + cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp) + os.makedirs(cls.ltptest_log_dir) + + cls.tc.target.run("mkdir -p /opt/ltp/results") + + if not hasattr(cls.tc, "extraresults"): + cls.tc.extraresults = {} + cls.extras = cls.tc.extraresults + cls.extras['ltpresult.rawlogs'] = {'log': ""} + + + @classmethod + def ltp_finishup(cls): + cls.extras['ltpresult.sections'] = cls.sections + + # update symlink to ltp_log + if os.path.exists(cls.ltptest_log_dir_link): + os.remove(cls.ltptest_log_dir_link) + os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link) + + if cls.failmsg: + cls.fail(cls.failmsg) + +class LtpTest(LtpTestBase): + + ltp_groups = ["math", "syscalls", "dio", "io", "mm", "ipc", "sched", "nptl", "pty", "containers", "controllers", "filecaps", "cap_bounds", "fcntl-locktests", "connectors", "commands", "net.ipv6_lib", "input","fs_perms_simple"] + + ltp_fs = ["fs", "fsx", "fs_bind"] + # skip kernel cpuhotplug + ltp_kernel = ["power_management_tests", "hyperthreading ", "kernel_misc", "hugetlb"] + ltp_groups += ltp_fs + + def runltp(self, ltp_group): + cmd = '/opt/ltp/runltp -f %s -p -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group) + starttime = time.time() + (status, output) = self.target.run(cmd) + endtime = time.time() + + with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f: + f.write(output) + + self.extras['ltpresult.rawlogs']['log'] = self.extras['ltpresult.rawlogs']['log'] + output + + # copy nice log from DUT + dst = os.path.join(self.ltptest_log_dir, "%s" % ltp_group ) + remote_src = "/opt/ltp/results/%s" % ltp_group + (status, output) = self.target.copyFrom(remote_src, dst, True) + msg = 'File could not be copied. Output: %s' % output + if status: + self.target.logger.warning(msg) + + parser = LtpParser() + results, sections = parser.parse(dst) + + runtime = int(endtime-starttime) + sections['duration'] = runtime + self.sections[ltp_group] = sections + + failed_tests = {} + for test in results: + result = results[test] + testname = ("ltpresult." + ltp_group + "." + test) + self.extras[testname] = {'status': result} + if result == 'FAILED': + failed_tests[ltp_group] = test + + if failed_tests: + self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests) + + # LTP runtime tests + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(["ltp"]) + def test_ltp_help(self): + (status, output) = self.target.run('/opt/ltp/runltp --help') + msg = 'Failed to get ltp help. Output: %s' % output + self.assertEqual(status, 0, msg=msg) + + @OETestDepends(['ltp.LtpTest.test_ltp_help']) + def test_ltp_groups(self): + for ltp_group in self.ltp_groups: + self.runltp(ltp_group) + + @OETestDepends(['ltp.LtpTest.test_ltp_groups']) + def test_ltp_runltp_cve(self): + self.runltp("cve") diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ltp_compliance.py b/external/poky/meta/lib/oeqa/runtime/cases/ltp_compliance.py new file mode 100644 index 00000000..ba47c78f --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/ltp_compliance.py @@ -0,0 +1,97 @@ +# LTP compliance runtime +# +# Copyright (c) 2019 MontaVista Software, LLC +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import time +import datetime +import pprint + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage +from oeqa.utils.logparser import LtpComplianceParser + +class LtpPosixBase(OERuntimeTestCase): + + @classmethod + def setUpClass(cls): + cls.ltp_startup() + + @classmethod + def tearDownClass(cls): + cls.ltp_finishup() + + @classmethod + def ltp_startup(cls): + cls.sections = {} + cls.failmsg = "" + test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage') + timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + + cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltpcomp_log') + cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp) + os.makedirs(cls.ltptest_log_dir) + + cls.tc.target.run("mkdir -p /opt/ltp/results") + + if not hasattr(cls.tc, "extraresults"): + cls.tc.extraresults = {} + cls.extras = cls.tc.extraresults + cls.extras['ltpposixresult.rawlogs'] = {'log': ""} + + + @classmethod + def ltp_finishup(cls): + cls.extras['ltpposixresult.sections'] = cls.sections + + # update symlink to ltp_log + if os.path.exists(cls.ltptest_log_dir_link): + os.remove(cls.ltptest_log_dir_link) + + os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link) + + if cls.failmsg: + cls.fail(cls.failmsg) + +class LtpPosixTest(LtpPosixBase): + posix_groups = ["AIO", "MEM", "MSG", "SEM", "SIG", "THR", "TMR", "TPS"] + + def runltp(self, posix_group): + cmd = "/opt/ltp/bin/run-posix-option-group-test.sh %s 2>@1 | tee /opt/ltp/results/%s" % (posix_group, posix_group) + starttime = time.time() + (status, output) = self.target.run(cmd) + endtime = time.time() + + with open(os.path.join(self.ltptest_log_dir, "%s" % posix_group), 'w') as f: + f.write(output) + + self.extras['ltpposixresult.rawlogs']['log'] = self.extras['ltpposixresult.rawlogs']['log'] + output + + parser = LtpComplianceParser() + results, sections = parser.parse(os.path.join(self.ltptest_log_dir, "%s" % posix_group)) + + runtime = int(endtime-starttime) + sections['duration'] = runtime + self.sections[posix_group] = sections + + failed_tests = {} + for test in results: + result = results[test] + testname = ("ltpposixresult." + posix_group + "." + test) + self.extras[testname] = {'status': result} + if result == 'FAILED': + failed_tests[posix_group] = test + + if failed_tests: + self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests) + + # LTP Posix compliance runtime tests + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(["ltp"]) + def test_posix_groups(self): + for posix_group in self.posix_groups: + self.runltp(posix_group) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ltp_stress.py b/external/poky/meta/lib/oeqa/runtime/cases/ltp_stress.py new file mode 100644 index 00000000..2445ffbc --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/ltp_stress.py @@ -0,0 +1,98 @@ +# LTP Stress runtime +# +# Copyright (c) 2019 MontaVista Software, LLC +# +# SPDX-License-Identifier: MIT +# + +import time +import datetime +import pprint + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage +from oeqa.core.decorator.data import skipIfQemu +from oeqa.utils.logparser import LtpParser + +class LtpStressBase(OERuntimeTestCase): + + @classmethod + def setUpClass(cls): + cls.ltp_startup() + + @classmethod + def tearDownClass(cls): + cls.ltp_finishup() + + @classmethod + def ltp_startup(cls): + cls.sections = {} + cls.failmsg = "" + test_log_dir = os.path.join(cls.td.get('WORKDIR', ''), 'testimage') + timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + + cls.ltptest_log_dir_link = os.path.join(test_log_dir, 'ltpstress_log') + cls.ltptest_log_dir = '%s.%s' % (cls.ltptest_log_dir_link, timestamp) + os.makedirs(cls.ltptest_log_dir) + + cls.tc.target.run("mkdir -p /opt/ltp/results") + + if not hasattr(cls.tc, "extraresults"): + cls.tc.extraresults = {} + cls.extras = cls.tc.extraresults + cls.extras['ltpstressresult.rawlogs'] = {'log': ""} + + + @classmethod + def ltp_finishup(cls): + cls.extras['ltpstressresult.sections'] = cls.sections + + # update symlink to ltp_log + if os.path.exists(cls.ltptest_log_dir_link): + os.remove(cls.ltptest_log_dir_link) + + os.symlink(os.path.basename(cls.ltptest_log_dir), cls.ltptest_log_dir_link) + + if cls.failmsg: + cls.fail(cls.failmsg) + +class LtpStressTest(LtpStressBase): + + def runltp(self, stress_group): + cmd = '/opt/ltp/runltp -f %s -p -q 2>@1 | tee /opt/ltp/results/%s' % (stress_group, stress_group) + starttime = time.time() + (status, output) = self.target.run(cmd) + endtime = time.time() + with open(os.path.join(self.ltptest_log_dir, "%s" % stress_group), 'w') as f: + f.write(output) + + self.extras['ltpstressresult.rawlogs']['log'] = self.extras['ltpstressresult.rawlogs']['log'] + output + + parser = LtpParser() + results, sections = parser.parse(os.path.join(self.ltptest_log_dir, "%s" % stress_group)) + + runtime = int(endtime-starttime) + sections['duration'] = runtime + self.sections[stress_group] = sections + + failed_tests = {} + for test in results: + result = results[test] + testname = ("ltpstressresult." + stress_group + "." + test) + self.extras[testname] = {'status': result} + if result == 'FAILED': + failed_tests[stress_group] = test + + if failed_tests: + self.failmsg = self.failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests) + + # LTP stress runtime tests + # + @skipIfQemu('qemuall', 'Test only runs on real hardware') + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(["ltp"]) + def test_ltp_stress(self): + self.tc.target.run("sed -i -r 's/^fork12.*//' /opt/ltp/runtest/crashme") + self.runltp('crashme') diff --git a/external/poky/meta/lib/oeqa/runtime/cases/multilib.py b/external/poky/meta/lib/oeqa/runtime/cases/multilib.py index 89020386..62e662b0 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/multilib.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/multilib.py @@ -1,6 +1,9 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotInDataVar from oeqa.runtime.decorator.package import OEHasPackage @@ -23,7 +26,6 @@ class MultilibTest(OERuntimeTestCase): msg = "%s isn't %s (is %s)" % (binary, arch, theclass) self.assertEqual(theclass, arch, msg=msg) - @OETestID(1593) @skipIfNotInDataVar('MULTILIBS', 'multilib:lib32', "This isn't a multilib:lib32 image") @OETestDepends(['ssh.SSHTest.test_ssh']) @@ -36,7 +38,6 @@ class MultilibTest(OERuntimeTestCase): self.archtest("/lib/libc.so.6", "ELF32") self.archtest("/lib64/libc.so.6", "ELF64") - @OETestID(279) @OETestDepends(['multilib.MultilibTest.test_check_multilib_libc']) @OEHasPackage(['lib32-connman', '!connman']) def test_file_connman(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py b/external/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py index a92a1f2b..f3c2bedb 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py @@ -1,12 +1,15 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfDataVar from oeqa.runtime.decorator.package import OEHasPackage +import time class SyslogTest(OERuntimeTestCase): - @OETestID(201) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(["busybox-syslog", "sysklogd", "rsyslog", "syslog-ng"]) def test_syslog_running(self): @@ -14,18 +17,77 @@ class SyslogTest(OERuntimeTestCase): msg = "Failed to execute %s" % self.tc.target_cmds['ps'] self.assertEqual(status, 0, msg=msg) msg = "No syslog daemon process; %s output:\n%s" % (self.tc.target_cmds['ps'], output) - hasdaemon = "syslogd" in output or "syslog-ng" in output + hasdaemon = "syslogd" in output or "syslog-ng" in output or "svlogd" in output self.assertTrue(hasdaemon, msg=msg) class SyslogTestConfig(OERuntimeTestCase): - @OETestID(1149) + def verif_not_running(self, pids): + for pid in pids: + status, err_output = self.target.run('kill -0 %s' %pid) + if not status: + self.logger.debug("previous %s is still running" %pid) + return 1 + + def verify_running(self, names): + pids = [] + for name in names: + status, pid = self.target.run('pidof %s' %name) + if status: + self.logger.debug("%s is not running" %name) + return 1, pids + pids.append(pid) + return 0, pids + + + def restart_sanity(self, names, restart_cmd, pidchange=True): + status, original_pids = self.verify_running(names) + if status: + return False + + status, output = self.target.run(restart_cmd) + + msg = ('Could not restart %s service. Status and output: %s and %s' % (names, status, output)) + self.assertEqual(status, 0, msg) + + if not pidchange: + return True + + # Always check for an error, most likely a race between shutting down and starting up + timeout = time.time() + 30 + + restarted = False + status = "" + while time.time() < timeout: + # Verify the previous ones are no longer running + status = self.verif_not_running(original_pids) + if status: + status = "Original syslog processes still running" + continue + + status, pids = self.verify_running(names) + if status: + status = "New syslog processes not running" + continue + + # Everything is fine now, so exit to continue the test + restarted = True + break + + msg = ('%s didn\'t appear to restart: %s' % (names, status)) + self.assertTrue(restarted, msg) + + return True + @OETestDepends(['oe_syslog.SyslogTest.test_syslog_running']) def test_syslog_logger(self): status, output = self.target.run('logger foobar') msg = "Can't log into syslog. Output: %s " % output self.assertEqual(status, 0, msg=msg) + # There is no way to flush the logger to disk in all cases + time.sleep(1) + status, output = self.target.run('grep foobar /var/log/messages') if status != 0: if self.tc.td.get("VIRTUAL-RUNTIME_init_manager") == "systemd": @@ -36,16 +98,19 @@ class SyslogTestConfig(OERuntimeTestCase): ' Output: %s ' % output) self.assertEqual(status, 0, msg=msg) - @OETestID(1150) + @OETestDepends(['oe_syslog.SyslogTest.test_syslog_running']) def test_syslog_restart(self): - if "systemd" != self.tc.td.get("VIRTUAL-RUNTIME_init_manager", ""): - (_, _) = self.target.run('/etc/init.d/syslog restart') + if self.restart_sanity(['systemd-journald'], 'systemctl restart syslog.service', pidchange=False): + pass + elif self.restart_sanity(['rsyslogd'], '/etc/init.d/rsyslog restart'): + pass + elif self.restart_sanity(['syslogd', 'klogd'], '/etc/init.d/syslog restart'): + pass else: - (_, _) = self.target.run('systemctl restart syslog.service') + self.logger.info("No syslog found to restart, ignoring") - @OETestID(202) @OETestDepends(['oe_syslog.SyslogTestConfig.test_syslog_logger']) @OEHasPackage(["busybox-syslog"]) @skipIfDataVar('VIRTUAL-RUNTIME_init_manager', 'systemd', @@ -53,10 +118,8 @@ class SyslogTestConfig(OERuntimeTestCase): def test_syslog_startup_config(self): cmd = 'echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf' self.target.run(cmd) - status, output = self.target.run('/etc/init.d/syslog restart') - msg = ('Could not restart syslog service. Status and output:' - ' %s and %s' % (status,output)) - self.assertEqual(status, 0, msg) + + self.test_syslog_restart() cmd = 'logger foobar && grep foobar /var/log/test' status,output = self.target.run(cmd) @@ -65,4 +128,4 @@ class SyslogTestConfig(OERuntimeTestCase): cmd = "sed -i 's#LOGFILE=/var/log/test##' /etc/syslog-startup.conf" self.target.run(cmd) - self.target.run('/etc/init.d/syslog restart') + self.test_syslog_restart() diff --git a/external/poky/meta/lib/oeqa/runtime/cases/opkg.py b/external/poky/meta/lib/oeqa/runtime/cases/opkg.py index 693f5d68..9cfee1cd 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/opkg.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/opkg.py @@ -1,7 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.utils.httpserver import HTTPService from oeqa.runtime.case import OERuntimeTestCase -from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature +from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature, skipIfFeature from oeqa.runtime.decorator.package import OEHasPackage class OpkgTest(OERuntimeTestCase): @@ -21,7 +25,9 @@ class OpkgRepoTest(OpkgTest): if cls.tc.td["MULTILIB_VARIANTS"]: allarchfeed = cls.tc.td["TUNE_PKGARCH"] service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], allarchfeed) - cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip, logger=cls.tc.logger) + cls.repo_server = HTTPService(service_repo, + '0.0.0.0', port=cls.tc.target.server_port, + logger=cls.tc.logger) cls.repo_server.start() @classmethod @@ -41,6 +47,8 @@ class OpkgRepoTest(OpkgTest): 'Test requires package-management to be in IMAGE_FEATURES') @skipIfNotDataVar('IMAGE_PKGTYPE', 'ipk', 'IPK is not the primary package manager') + @skipIfFeature('read-only-rootfs', + 'Test does not work with read-only-rootfs in IMAGE_FEATURES') @OEHasPackage(['opkg']) def test_opkg_install_from_repo(self): self.setup_source_config_for_package_install() diff --git a/external/poky/meta/lib/oeqa/runtime/cases/pam.py b/external/poky/meta/lib/oeqa/runtime/cases/pam.py index 3654cdc9..271a1943 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/pam.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/pam.py @@ -1,14 +1,16 @@ +# +# SPDX-License-Identifier: MIT +# + # This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=287 testcase # Note that the image under test must have "pam" in DISTRO_FEATURES from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature class PamBasicTest(OERuntimeTestCase): - @OETestID(1543) @skipIfNotFeature('pam', 'Test requires pam to be in DISTRO_FEATURES') @OETestDepends(['ssh.SSHTest.test_ssh']) def test_pam(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/parselogs.py b/external/poky/meta/lib/oeqa/runtime/cases/parselogs.py index f6e9820c..a1791b5c 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/parselogs.py @@ -1,10 +1,13 @@ +# +# SPDX-License-Identifier: MIT +# + import os from subprocess import check_output from shutil import rmtree from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfDataVar from oeqa.runtime.decorator.package import OEHasPackage @@ -52,11 +55,15 @@ common_errors = [ "Failed to read /var/lib/nfs/statd/state: Success", "error retry time-out =", "logind: cannot setup systemd-logind helper (-61), using legacy fallback", - "Error changing net interface name 'eth0' to " + "Failed to rename network interface", + "Failed to process device, ignoring: Device or resource busy", + "Cannot find a map file", + "[rdrand]: Initialization Failed", + "[pulseaudio] authkey.c: Failed to open cookie file", + "[pulseaudio] authkey.c: Failed to load authentication key", ] video_related = [ - "uvesafb", ] x86_common = [ @@ -69,6 +76,8 @@ x86_common = [ 'amd_nb: Cannot enumerate AMD northbridges', 'failed to retrieve link info, disabling eDP', 'Direct firmware load for iwlwifi', + 'Direct firmware load for regulatory.db', + 'failed to load regulatory.db', ] + common_errors qemux86_common = [ @@ -76,8 +85,9 @@ qemux86_common = [ "fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.", "can't claim BAR ", 'amd_nb: Cannot enumerate AMD northbridges', - 'uvesafb: 5000 ms task timeout, infinitely waiting', 'tsc: HPET/PMTIMER calibration failed', + "modeset(0): Failed to initialize the DRI2 extension", + "glamor initialization failed", ] + common_errors ignore_errors = { @@ -113,6 +123,7 @@ ignore_errors = { 'OF: amba_device_add() failed (-19) for /amba/sctl@101e0000', 'OF: amba_device_add() failed (-19) for /amba/watchdog@101e1000', 'OF: amba_device_add() failed (-19) for /amba/sci@101f0000', + 'OF: amba_device_add() failed (-19) for /amba/spi@101f4000', 'OF: amba_device_add() failed (-19) for /amba/ssp@101f4000', 'OF: amba_device_add() failed (-19) for /amba/fpga/sci@a000', 'Failed to initialize \'/amba/timer@101e3000\': -22', @@ -123,6 +134,7 @@ ignore_errors = { '(EE) Server terminated with error (1). Closing log file.', 'dmi: Firmware registration failed.', 'irq: type mismatch, failed to map hwirq-27 for /intc', + 'logind: failed to get session seat', ] + common_errors, 'intel-core2-32' : [ 'ACPI: No _BQC method, cannot determine initial brightness', @@ -161,7 +173,18 @@ ignore_errors = { 'The driver is built-in, so to load the firmware you need to', ] + x86_common, 'edgerouter' : [ + 'not creating \'/sys/firmware/fdt\'', + 'Failed to find cpu0 device node', 'Fatal server error:', + 'Server terminated with error', + ] + common_errors, + 'beaglebone-yocto' : [ + 'Direct firmware load for regulatory.db', + 'failed to load regulatory.db', + 'l4_wkup_cm', + 'Failed to load module "glx"', + 'Failed to make EGL context current', + 'glamor initialization failed', ] + common_errors, } @@ -270,7 +293,7 @@ class ParseLogsTest(OERuntimeTestCase): grepcmd = 'grep ' grepcmd += '-Ei "' for error in errors: - grepcmd += error + '|' + grepcmd += '\<' + error + '\>' + '|' grepcmd = grepcmd[:-1] grepcmd += '" ' + str(log) + " | grep -Eiv \'" @@ -332,7 +355,6 @@ class ParseLogsTest(OERuntimeTestCase): def write_dmesg(self): (status, dmesg) = self.target.run('dmesg > /tmp/dmesg_output.log') - @OETestID(1059) @OETestDepends(['ssh.SSHTest.test_ssh']) def test_parselogs(self): self.write_dmesg() diff --git a/external/poky/meta/lib/oeqa/runtime/cases/perl.py b/external/poky/meta/lib/oeqa/runtime/cases/perl.py index be3287f2..2c6b3b78 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/perl.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/perl.py @@ -1,12 +1,14 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class PerlTest(OERuntimeTestCase): - @OETestID(208) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['perl']) def test_perl_works(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ping.py b/external/poky/meta/lib/oeqa/runtime/cases/ping.py index 02f580ab..f6603f75 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/ping.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/ping.py @@ -1,13 +1,15 @@ +# +# SPDX-License-Identifier: MIT +# + from subprocess import Popen, PIPE from oeqa.runtime.case import OERuntimeTestCase -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.oetimeout import OETimeout class PingTest(OERuntimeTestCase): @OETimeout(30) - @OETestID(964) def test_ping(self): output = '' count = 0 diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ptest.py b/external/poky/meta/lib/oeqa/runtime/cases/ptest.py index 2a28ca59..ef0470da 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/ptest.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/ptest.py @@ -1,22 +1,38 @@ +# +# SPDX-License-Identifier: MIT +# + +import os import unittest import pprint import datetime from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage from oeqa.utils.logparser import PtestParser class PtestRunnerTest(OERuntimeTestCase): - @OETestID(1600) @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['ptest-runner']) @unittest.expectedFailure - def test_ptestrunner(self): + def test_ptestrunner_expectfail(self): + if not self.td.get('PTEST_EXPECT_FAILURE'): + self.skipTest('Cannot run ptests with @expectedFailure as ptests are required to pass') + self.do_ptestrunner() + + @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['ptest-runner']) + def test_ptestrunner_expectsuccess(self): + if self.td.get('PTEST_EXPECT_FAILURE'): + self.skipTest('Cannot run ptests without @expectedFailure as ptests are expected to fail') + self.do_ptestrunner() + + def do_ptestrunner(self): status, output = self.target.run('which ptest-runner', 0) if status != 0: self.skipTest("No -ptest packages are installed in the image") @@ -26,6 +42,10 @@ class PtestRunnerTest(OERuntimeTestCase): # testdata.json is generated. if not test_log_dir: test_log_dir = os.path.join(self.td.get('WORKDIR', ''), 'testimage') + # Make the test output path absolute, otherwise the output content will be + # created relative to current directory + if not os.path.isabs(test_log_dir): + test_log_dir = os.path.join(self.td.get('TOPDIR', ''), test_log_dir) # Don't use self.td.get('DATETIME'), it's from testdata.json, not # up-to-date, and may cause "File exists" when re-reun. timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') @@ -65,8 +85,13 @@ class PtestRunnerTest(OERuntimeTestCase): extras[testname] = {'status': result} failed_tests = {} + + for section in sections: + if 'exitcode' in sections[section].keys(): + failed_tests[section] = sections[section]["log"] + for section in results: - failed_testcases = [ "_".join(test.translate(trans).split()) for test in results[section] if results[section][test] == 'fail' ] + failed_testcases = [ "_".join(test.translate(trans).split()) for test in results[section] if results[section][test] == 'FAILED' ] if failed_testcases: failed_tests[section] = failed_testcases diff --git a/external/poky/meta/lib/oeqa/runtime/cases/python.py b/external/poky/meta/lib/oeqa/runtime/cases/python.py index 66ab4d25..ec54f1e1 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/python.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/python.py @@ -1,10 +1,12 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class PythonTest(OERuntimeTestCase): - @OETestID(965) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['python3-core']) def test_python3(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/rpm.py b/external/poky/meta/lib/oeqa/runtime/cases/rpm.py index de92157c..8e18b426 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/rpm.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/rpm.py @@ -1,16 +1,19 @@ +# +# SPDX-License-Identifier: MIT +# + import os import fnmatch +import time from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfDataVar from oeqa.runtime.decorator.package import OEHasPackage from oeqa.core.utils.path import findFile class RpmBasicTest(OERuntimeTestCase): - @OETestID(960) @OEHasPackage(['rpm']) @OETestDepends(['ssh.SSHTest.test_ssh']) def test_rpm_help(self): @@ -18,7 +21,6 @@ class RpmBasicTest(OERuntimeTestCase): msg = 'status and output: %s and %s' % (status, output) self.assertEqual(status, 0, msg=msg) - @OETestID(191) @OETestDepends(['rpm.RpmBasicTest.test_rpm_help']) def test_rpm_query(self): status, output = self.target.run('ls /var/lib/rpm/') @@ -28,38 +30,6 @@ class RpmBasicTest(OERuntimeTestCase): msg = 'status and output: %s and %s' % (status, output) self.assertEqual(status, 0, msg=msg) -class RpmInstallRemoveTest(OERuntimeTestCase): - - @classmethod - def setUpClass(cls): - pkgarch = cls.td['TUNE_PKGARCH'].replace('-', '_') - rpmdir = os.path.join(cls.tc.td['DEPLOY_DIR'], 'rpm', pkgarch) - # Pick base-passwd-doc as a test file to get installed, because it's small - # and it will always be built for standard targets - rpm_doc = 'base-passwd-doc-*.%s.rpm' % pkgarch - if not os.path.exists(rpmdir): - return - for f in fnmatch.filter(os.listdir(rpmdir), rpm_doc): - cls.test_file = os.path.join(rpmdir, f) - cls.dst = '/tmp/base-passwd-doc.rpm' - - @OETestID(192) - @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) - def test_rpm_install(self): - self.tc.target.copyTo(self.test_file, self.dst) - status, output = self.target.run('rpm -ivh /tmp/base-passwd-doc.rpm') - msg = 'Failed to install base-passwd-doc package: %s' % output - self.assertEqual(status, 0, msg=msg) - self.tc.target.run('rm -f %s' % self.dst) - - @OETestID(194) - @OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_install']) - def test_rpm_remove(self): - status,output = self.target.run('rpm -e base-passwd-doc') - msg = 'Failed to remove base-passwd-doc package: %s' % output - self.assertEqual(status, 0, msg=msg) - - @OETestID(1096) @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) def test_rpm_query_nonroot(self): @@ -79,7 +49,21 @@ class RpmInstallRemoveTest(OERuntimeTestCase): msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output) self.assertEqual(status, 0, msg=msg) + def check_no_process_for_user(u): + _, output = self.target.run(self.tc.target_cmds['ps']) + if u + ' ' in output: + return False + else: + return True + def unset_up_test_user(u): + # ensure no test1 process in running + timeout = time.time() + 30 + while time.time() < timeout: + if check_no_process_for_user(u): + break + else: + time.sleep(1) status, output = self.target.run('userdel -r %s' % u) msg = 'Failed to erase user: %s' % output self.assertTrue(status == 0, msg=msg) @@ -92,7 +76,36 @@ class RpmInstallRemoveTest(OERuntimeTestCase): finally: unset_up_test_user(tuser) - @OETestID(195) + +class RpmInstallRemoveTest(OERuntimeTestCase): + + @classmethod + def setUpClass(cls): + pkgarch = cls.td['TUNE_PKGARCH'].replace('-', '_') + rpmdir = os.path.join(cls.tc.td['DEPLOY_DIR'], 'rpm', pkgarch) + # Pick base-passwd-doc as a test file to get installed, because it's small + # and it will always be built for standard targets + rpm_doc = 'base-passwd-doc-*.%s.rpm' % pkgarch + if not os.path.exists(rpmdir): + return + for f in fnmatch.filter(os.listdir(rpmdir), rpm_doc): + cls.test_file = os.path.join(rpmdir, f) + cls.dst = '/tmp/base-passwd-doc.rpm' + + @OETestDepends(['rpm.RpmBasicTest.test_rpm_query']) + def test_rpm_install(self): + self.tc.target.copyTo(self.test_file, self.dst) + status, output = self.target.run('rpm -ivh /tmp/base-passwd-doc.rpm') + msg = 'Failed to install base-passwd-doc package: %s' % output + self.assertEqual(status, 0, msg=msg) + self.tc.target.run('rm -f %s' % self.dst) + + @OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_install']) + def test_rpm_remove(self): + status,output = self.target.run('rpm -e base-passwd-doc') + msg = 'Failed to remove base-passwd-doc package: %s' % output + self.assertEqual(status, 0, msg=msg) + @OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_remove']) def test_check_rpm_install_removal_log_file_size(self): """ diff --git a/external/poky/meta/lib/oeqa/runtime/cases/scons.py b/external/poky/meta/lib/oeqa/runtime/cases/scons.py new file mode 100644 index 00000000..3c7c7f72 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/scons.py @@ -0,0 +1,37 @@ +# +# SPDX-License-Identifier: MIT +# + +import os + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +class SconsCompileTest(OERuntimeTestCase): + + @classmethod + def setUp(cls): + dst = '/tmp/' + src = os.path.join(cls.tc.runtime_files_dir, 'hello.c') + cls.tc.target.copyTo(src, dst) + + src = os.path.join(cls.tc.runtime_files_dir, 'SConstruct') + cls.tc.target.copyTo(src, dst) + + @classmethod + def tearDown(cls): + files = '/tmp/hello.c /tmp/hello.o /tmp/hello /tmp/SConstruct' + cls.tc.target.run('rm %s' % files) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['gcc']) + @OEHasPackage(['python3-scons']) + def test_scons_compile(self): + status, output = self.target.run('cd /tmp/ && scons') + msg = 'scons compile failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('/tmp/hello') + msg = 'running compiled file failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/scp.py b/external/poky/meta/lib/oeqa/runtime/cases/scp.py index 8f895da9..3a5f2921 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/scp.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/scp.py @@ -1,9 +1,12 @@ +# +# SPDX-License-Identifier: MIT +# + import os from tempfile import mkstemp from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class ScpTest(OERuntimeTestCase): @@ -19,7 +22,6 @@ class ScpTest(OERuntimeTestCase): def tearDownClass(cls): os.remove(cls.tmp_path) - @OETestID(220) @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['openssh-scp', 'dropbear']) def test_scp_file(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py b/external/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py index 4fdcf033..4779cd6b 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py @@ -1,9 +1,12 @@ +# +# SPDX-License-Identifier: MIT +# + # This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=284 # testcase. Image under test must have meta-skeleton layer in bblayers and # IMAGE_INSTALL_append = " service" in local.conf from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfDataVar from oeqa.runtime.decorator.package import OEHasPackage @@ -22,7 +25,6 @@ class SkeletonBasicTest(OERuntimeTestCase): msg = 'skeleton-test not found. Output:\n%s' % output self.assertEqual(status, 0, msg=msg) - @OETestID(284) @OETestDepends(['skeletoninit.SkeletonBasicTest.test_skeleton_availability']) def test_skeleton_script(self): output1 = self.target.run("/etc/init.d/skeleton start")[1] diff --git a/external/poky/meta/lib/oeqa/runtime/cases/ssh.py b/external/poky/meta/lib/oeqa/runtime/cases/ssh.py index 0b1ea7bc..60a5fbbf 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/ssh.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/ssh.py @@ -1,11 +1,13 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class SSHTest(OERuntimeTestCase): - @OETestID(224) @OETestDepends(['ping.PingTest.test_ping']) @OEHasPackage(['dropbear', 'openssh-sshd']) def test_ssh(self): diff --git a/external/poky/meta/lib/oeqa/runtime/cases/stap.py b/external/poky/meta/lib/oeqa/runtime/cases/stap.py index c492caff..5342f6ac 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/stap.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/stap.py @@ -1,8 +1,11 @@ +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage @@ -19,7 +22,6 @@ class StapTest(OERuntimeTestCase): files = '/tmp/hello.stp' cls.tc.target.run('rm %s' % files) - @OETestID(1652) @skipIfNotFeature('tools-profile', 'Test requires tools-profile to be in IMAGE_FEATURES') @OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module']) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/storage.py b/external/poky/meta/lib/oeqa/runtime/cases/storage.py new file mode 100644 index 00000000..166d26b2 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/storage.py @@ -0,0 +1,149 @@ +# +# SPDX-License-Identifier: MIT +# + +import re +import time + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfQemu + +class StorageBase(OERuntimeTestCase): + def storage_mount(cls, tmo=1): + + (status, output) = cls.target.run('mkdir -p %s' % cls.mount_point) + (status, output) = cls.target.run('mount %s %s' % (cls.device, cls.mount_point)) + msg = ('Mount failed: %s.' % status) + cls.assertFalse(output, msg = msg) + time.sleep(tmo) + (status, output) = cls.target.run('cat /proc/mounts') + match = re.search('%s' % cls.device, output) + if match: + msg = ('Device %s not mounted.' % cls.device) + cls.assertTrue(match, msg = msg) + + (status, output) = cls.target.run('mkdir -p %s' % cls.test_dir) + + (status, output) = cls.target.run('rm -f %s/*' % cls.test_dir) + msg = ('Failed to cleanup files @ %s/*' % cls.test_dir) + cls.assertFalse(output, msg = msg) + + + def storage_basic(cls): + # create file on device + (status, output) = cls.target.run('touch %s/%s' % (cls.test_dir, cls.test_file)) + msg = ('File %s not created on %s' % (cls.test_file, cls.device)) + cls.assertFalse(status, msg = msg) + # move file + (status, output) = cls.target.run('mv %s/%s %s/%s1' % + (cls.test_dir, cls.test_file, cls.test_dir, cls.test_file)) + msg = ('File %s not moved to %s' % (cls.test_file, cls.device)) + cls.assertFalse(status, msg = msg) + # remove file + (status, output) = cls.target.run('rm %s/%s1' % (cls.test_dir, cls.test_file)) + msg = ('File %s not removed on %s' % (cls.test_file, cls.device)) + cls.assertFalse(status, msg = msg) + + def storage_read(cls): + # check if message is in file + (status, output) = cls.target.run('cat %s/%s' % + (cls.test_dir, cls.test_file)) + + match = re.search('%s' % cls.test_msg, output) + msg = ('Test message %s not in file %s.' % (cls.test_msg, cls.test_file)) + cls.assertEqual(status, 0, msg = msg) + + def storage_write(cls): + # create test message in file on device + (status, output) = cls.target.run('echo "%s" > %s/%s' % + (cls.test_msg, cls.test_dir, cls.test_file)) + msg = ('File %s not create test message on %s' % (cls.test_file, cls.device)) + cls.assertEqual(status, 0, msg = msg) + + def storage_umount(cls, tmo=1): + time.sleep(tmo) + (status, output) = cls.target.run('umount %s' % cls.mount_point) + + if status == 32: + # already unmounted, should it fail? + return + else: + msg = ('Device not unmount %s' % cls.mount_point) + cls.assertEqual(status, 0, msg = msg) + + (status, output) = cls.target.run('cat /proc/mounts') + match = re.search('%s' % cls.device, output) + if match: + msg = ('Device %s still mounted.' % cls.device) + cls.assertTrue(match, msg = msg) + + +class UsbTest(StorageBase): + ''' + This is to mimic the usb test previously done in manual bsp-hw.json + ''' + @classmethod + def setUpClass(self): + self.test_msg = "Hello World - USB" + self.mount_point = "/media/usb" + self.device = "/dev/sda1" + self.test_file = "usb.tst" + self.test_dir = os.path.join(self.mount_point, "oeqa") + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_usb_mount(self): + self.storage_umount(2) + self.storage_mount(5) + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.UsbTest.test_usb_mount']) + def test_usb_basic_operations(self): + self.storage_basic() + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.UsbTest.test_usb_basic_operations']) + def test_usb_basic_rw(self): + self.storage_write() + self.storage_read() + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.UsbTest.test_usb_mount']) + def test_usb_umount(self): + self.storage_umount(2) + + +class MMCTest(StorageBase): + ''' + This is to mimic the usb test previously done in manual bsp-hw.json + ''' + @classmethod + def setUpClass(self): + self.test_msg = "Hello World - MMC" + self.mount_point = "/media/mmc" + self.device = "/dev/mmcblk1p1" + self.test_file = "mmc.tst" + self.test_dir = os.path.join(self.mount_point, "oeqa") + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_mmc_mount(self): + self.storage_umount(2) + self.storage_mount() + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.MMCTest.test_mmc_mount']) + def test_mmc_basic_operations(self): + self.storage_basic() + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.MMCTest.test_mmc_basic_operations']) + def test_mmc_basic_rw(self): + self.storage_write() + self.storage_read() + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['storage.MMCTest.test_mmc_mount']) + def test_mmc_umount(self): + self.storage_umount(2) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/systemd.py b/external/poky/meta/lib/oeqa/runtime/cases/systemd.py index 460b8fc3..7c44abe8 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/systemd.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/systemd.py @@ -1,12 +1,15 @@ +# +# SPDX-License-Identifier: MIT +# + import re import time from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfDataVar, skipIfNotDataVar from oeqa.runtime.decorator.package import OEHasPackage -from oeqa.core.decorator.data import skipIfNotFeature +from oeqa.core.decorator.data import skipIfNotFeature, skipIfFeature class SystemdTest(OERuntimeTestCase): @@ -78,12 +81,10 @@ class SystemdBasicTests(SystemdTest): def test_systemd_basic(self): self.systemctl('--version') - @OETestID(551) @OETestDepends(['systemd.SystemdBasicTests.test_systemd_basic']) def test_systemd_list(self): self.systemctl('list-unit-files') - @OETestID(550) @OETestDepends(['systemd.SystemdBasicTests.test_systemd_basic']) def test_systemd_failed(self): settled, output = self.settle() @@ -104,7 +105,6 @@ class SystemdServiceTests(SystemdTest): def test_systemd_status(self): self.systemctl('status --full', 'avahi-daemon.service') - @OETestID(695) @OETestDepends(['systemd.SystemdServiceTests.test_systemd_status']) def test_systemd_stop_start(self): self.systemctl('stop', 'avahi-daemon.service') @@ -113,14 +113,27 @@ class SystemdServiceTests(SystemdTest): self.systemctl('start','avahi-daemon.service') self.systemctl('is-active', 'avahi-daemon.service', verbose=True) - @OETestID(696) @OETestDepends(['systemd.SystemdServiceTests.test_systemd_status']) + @skipIfFeature('read-only-rootfs', + 'Test is only meant to run without read-only-rootfs in IMAGE_FEATURES') def test_systemd_disable_enable(self): self.systemctl('disable', 'avahi-daemon.service') self.systemctl('is-enabled', 'avahi-daemon.service', expected=1) self.systemctl('enable', 'avahi-daemon.service') self.systemctl('is-enabled', 'avahi-daemon.service') + @OETestDepends(['systemd.SystemdServiceTests.test_systemd_status']) + @skipIfNotFeature('read-only-rootfs', + 'Test is only meant to run with read-only-rootfs in IMAGE_FEATURES') + def test_systemd_disable_enable_ro(self): + status = self.target.run('mount -orw,remount /')[0] + self.assertTrue(status == 0, msg='Remounting / as r/w failed') + try: + self.test_systemd_disable_enable() + finally: + status = self.target.run('mount -oro,remount /')[0] + self.assertTrue(status == 0, msg='Remounting / as r/o failed') + class SystemdJournalTests(SystemdTest): @OETestDepends(['systemd.SystemdBasicTests.test_systemd_basic']) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/weston.py b/external/poky/meta/lib/oeqa/runtime/cases/weston.py new file mode 100644 index 00000000..f32599af --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/cases/weston.py @@ -0,0 +1,19 @@ +# +# SPDX-License-Identifier: MIT +# + +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 + +class WestonTest(OERuntimeTestCase): + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['weston']) + def test_weston_running(self): + cmd ='%s | grep [w]eston-desktop-shell' % self.tc.target_cmds['ps'] + status, output = self.target.run(cmd) + msg = ('Weston does not appear to be running %s' % + self.target.run(self.tc.target_cmds['ps'])[1]) + self.assertEqual(status, 0, msg=msg) diff --git a/external/poky/meta/lib/oeqa/runtime/cases/x32lib.py b/external/poky/meta/lib/oeqa/runtime/cases/x32lib.py index 8da0154e..ddf22014 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/x32lib.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/x32lib.py @@ -1,13 +1,15 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotInDataVar class X32libTest(OERuntimeTestCase): @skipIfNotInDataVar('DEFAULTTUNE', 'x86-64-x32', 'DEFAULTTUNE is not set to x86-64-x32') - @OETestID(281) @OETestDepends(['ssh.SSHTest.test_ssh']) def test_x32_file(self): cmd = 'readelf -h /bin/ls | grep Class | grep ELF32' diff --git a/external/poky/meta/lib/oeqa/runtime/cases/xorg.py b/external/poky/meta/lib/oeqa/runtime/cases/xorg.py index 82521c69..d6845587 100644 --- a/external/poky/meta/lib/oeqa/runtime/cases/xorg.py +++ b/external/poky/meta/lib/oeqa/runtime/cases/xorg.py @@ -1,12 +1,14 @@ +# +# SPDX-License-Identifier: MIT +# + from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends -from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage class XorgTest(OERuntimeTestCase): - @OETestID(1151) @skipIfNotFeature('x11-base', 'Test requires x11 to be in IMAGE_FEATURES') @OETestDepends(['ssh.SSHTest.test_ssh']) diff --git a/external/poky/meta/lib/oeqa/runtime/context.py b/external/poky/meta/lib/oeqa/runtime/context.py index db0482d6..3826f276 100644 --- a/external/poky/meta/lib/oeqa/runtime/context.py +++ b/external/poky/meta/lib/oeqa/runtime/context.py @@ -1,5 +1,8 @@ +# # Copyright (C) 2016 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# import os @@ -44,6 +47,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): default_data = None default_test_data = 'data/testdata.json' default_tests = '' + default_json_result_dir = '%s-results' % name default_target_type = 'simpleremote' default_manifest = 'data/manifest' @@ -74,7 +78,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): runtime_group.add_argument('--packages-manifest', action='store', default=self.default_manifest, - help="Package manifest of the image under testi, default: %s" \ + help="Package manifest of the image under test, default: %s" \ % self.default_manifest) runtime_group.add_argument('--extract-dir', action='store', @@ -95,6 +99,12 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): target_ip = target_ip_port[0] kwargs['port'] = target_ip_port[1] + if server_ip: + server_ip_port = server_ip.split(':') + if len(server_ip_port) == 2: + server_ip = server_ip_port[0] + kwargs['server_port'] = int(server_ip_port[1]) + if target_type == 'simpleremote': target = OESSHTarget(logger, target_ip, server_ip, **kwargs) elif target_type == 'qemu': @@ -135,7 +145,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): def add_controller_list(path): if not os.path.exists(os.path.join(path, '__init__.py')): raise OSError('Controllers directory %s exists but is missing __init__.py' % path) - files = sorted([f for f in os.listdir(path) if f.endswith('.py') and not f.startswith('_')]) + files = sorted([f for f in os.listdir(path) if f.endswith('.py') and not f.startswith('_') and not f.startswith('.#')]) for f in files: module = 'oeqa.controllers.' + f[:-3] if module not in controllerslist: @@ -175,7 +185,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): except: obj = None return obj - + @staticmethod def readPackagesManifest(manifest): if not manifest or not os.path.exists(manifest): diff --git a/external/poky/meta/lib/oeqa/runtime/decorator/package.py b/external/poky/meta/lib/oeqa/runtime/decorator/package.py index aa6ecb68..4c5ca198 100644 --- a/external/poky/meta/lib/oeqa/runtime/decorator/package.py +++ b/external/poky/meta/lib/oeqa/runtime/decorator/package.py @@ -1,5 +1,8 @@ +# # Copyright (C) 2016 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# from oeqa.core.decorator import OETestDecorator, registerDecorator from oeqa.core.utils.misc import strToSet diff --git a/external/poky/meta/lib/oeqa/runtime/files/SConstruct b/external/poky/meta/lib/oeqa/runtime/files/SConstruct new file mode 100644 index 00000000..d2cb6dd1 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/files/SConstruct @@ -0,0 +1 @@ +Program('hello.c') diff --git a/external/poky/meta/lib/oeqa/runtime/files/hello.c b/external/poky/meta/lib/oeqa/runtime/files/hello.c new file mode 100644 index 00000000..b0697a33 --- /dev/null +++ b/external/poky/meta/lib/oeqa/runtime/files/hello.c @@ -0,0 +1,5 @@ +int + main() + { + printf("Hello, world!\n"); + } diff --git a/external/poky/meta/lib/oeqa/runtime/loader.py b/external/poky/meta/lib/oeqa/runtime/loader.py index 041ef976..7041ddfd 100644 --- a/external/poky/meta/lib/oeqa/runtime/loader.py +++ b/external/poky/meta/lib/oeqa/runtime/loader.py @@ -1,5 +1,8 @@ +# # Copyright (C) 2016 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# from oeqa.core.loader import OETestLoader from oeqa.runtime.case import OERuntimeTestCase diff --git a/external/poky/meta/lib/oeqa/runtime/utils/targetbuildproject.py b/external/poky/meta/lib/oeqa/runtime/utils/targetbuildproject.py index 5af55d73..f4f4816a 100644 --- a/external/poky/meta/lib/oeqa/runtime/utils/targetbuildproject.py +++ b/external/poky/meta/lib/oeqa/runtime/utils/targetbuildproject.py @@ -1,5 +1,8 @@ +# # Copyright (C) 2016 Intel Corporation -# Released under the MIT license (see COPYING.MIT) +# +# SPDX-License-Identifier: MIT +# from oeqa.utils.buildproject import BuildProject @@ -7,10 +10,12 @@ class TargetBuildProject(BuildProject): def __init__(self, target, uri, foldername=None, dl_dir=None): self.target = target - self.targetdir = "~/" + self.targetdir = "~/buildtest/" BuildProject.__init__(self, uri, foldername, dl_dir=dl_dir) def download_archive(self): + self.target.run("mkdir " + self.targetdir + " || true") + self._download_archive() status, output = self.target.copyTo(self.localarchive, self.targetdir) -- cgit 1.2.3-korg