diff options
Diffstat (limited to 'poky/meta/lib/oeqa/runtime/cases')
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/apt.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/buildcpio.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/date.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/dnf.py | 3 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/logrotate.py | 62 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/ltp.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/opkg.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/parselogs.py | 17 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/ptest.py | 23 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/weston.py | 69 |
10 files changed, 155 insertions, 39 deletions
diff --git a/poky/meta/lib/oeqa/runtime/cases/apt.py b/poky/meta/lib/oeqa/runtime/cases/apt.py index 74a940d80f..c5378d90c3 100644 --- a/poky/meta/lib/oeqa/runtime/cases/apt.py +++ b/poky/meta/lib/oeqa/runtime/cases/apt.py @@ -22,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/poky/meta/lib/oeqa/runtime/cases/buildcpio.py b/poky/meta/lib/oeqa/runtime/cases/buildcpio.py index f4e871e421..d0f91668b2 100644 --- a/poky/meta/lib/oeqa/runtime/cases/buildcpio.py +++ b/poky/meta/lib/oeqa/runtime/cases/buildcpio.py @@ -12,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']) @@ -27,6 +27,6 @@ class BuildCpioTest(OERuntimeTestCase): @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/poky/meta/lib/oeqa/runtime/cases/date.py b/poky/meta/lib/oeqa/runtime/cases/date.py index 7750a7293f..fdd2a6ae58 100644 --- a/poky/meta/lib/oeqa/runtime/cases/date.py +++ b/poky/meta/lib/oeqa/runtime/cases/date.py @@ -13,12 +13,12 @@ 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') @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['coreutils', 'busybox']) diff --git a/poky/meta/lib/oeqa/runtime/cases/dnf.py b/poky/meta/lib/oeqa/runtime/cases/dnf.py index de3759995e..f40c63026e 100644 --- a/poky/meta/lib/oeqa/runtime/cases/dnf.py +++ b/poky/meta/lib/oeqa/runtime/cases/dnf.py @@ -53,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 diff --git a/poky/meta/lib/oeqa/runtime/cases/logrotate.py b/poky/meta/lib/oeqa/runtime/cases/logrotate.py index bfa57c534a..3938e91993 100644 --- a/poky/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/poky/meta/lib/oeqa/runtime/cases/logrotate.py @@ -18,32 +18,58 @@ 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') @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) + + 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) + + status, output = self.target.run('echo "/var/log/logrotate_test {\\n missingok \\n monthly \\n rotate 1" > /etc/logrotate.d/logrotate_test') + msg = ('Could not write to /etc/logrotate.d/logrotate_test') + 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) - 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/logrotate_testfile" > /tmp/logrotate-test2.conf') + msg = ('Could not write to /tmp/logrotate_test2.conf') self.assertEqual(status, 0, msg = msg) - @OETestDepends(['logrotate.LogrotateTest.test_1_logrotate_setup']) - def test_2_logrotate(self): - status, output = self.target.run('echo "create \n include /etc/logrotate.d" > /tmp/logrotate-test.conf') - status, output = self.target.run('logrotate -f /tmp/logrotate-test.conf') + 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) - msg = ('logrotate service could not be reloaded. Status and output: ' - '%s and %s' % (status, output)) + # 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) - _, 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) + diff --git a/poky/meta/lib/oeqa/runtime/cases/ltp.py b/poky/meta/lib/oeqa/runtime/cases/ltp.py index 30548640bc..6dc5ef22ad 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ltp.py +++ b/poky/meta/lib/oeqa/runtime/cases/ltp.py @@ -57,9 +57,9 @@ class LtpTestBase(OERuntimeTestCase): class LtpTest(LtpTestBase): - ltp_groups = ["math", "syscalls", "dio", "io", "mm", "ipc", "sched", "nptl", "pty", "containers", "controllers", "filecaps", "cap_bounds", "fcntl-locktests", "connectors","timers", "commands", "net.ipv6_lib", "input","fs_perms_simple"] + 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", "fs_ext4"] + ltp_fs = ["fs", "fsx", "fs_bind"] # skip kernel cpuhotplug ltp_kernel = ["power_management_tests", "hyperthreading ", "kernel_misc", "hugetlb"] ltp_groups += ltp_fs diff --git a/poky/meta/lib/oeqa/runtime/cases/opkg.py b/poky/meta/lib/oeqa/runtime/cases/opkg.py index 750706161b..9cfee1cd88 100644 --- a/poky/meta/lib/oeqa/runtime/cases/opkg.py +++ b/poky/meta/lib/oeqa/runtime/cases/opkg.py @@ -25,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 diff --git a/poky/meta/lib/oeqa/runtime/cases/parselogs.py b/poky/meta/lib/oeqa/runtime/cases/parselogs.py index 15343d7abb..a1791b5cca 100644 --- a/poky/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/poky/meta/lib/oeqa/runtime/cases/parselogs.py @@ -55,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 = [ @@ -81,11 +85,8 @@ 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", - "uvesafb: cannot reserve video memory at", - "uvesafb: probe of uvesafb.0 failed with error", "glamor initialization failed", ] + common_errors @@ -133,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', @@ -184,11 +186,6 @@ ignore_errors = { 'Failed to make EGL context current', 'glamor initialization failed', ] + common_errors, - 'mpc8315e-rdb' : [ - 'of_irq_parse_pci: failed with', - 'Fatal server error:', - 'Server terminated with error', - ] + common_errors, } log_locations = ["/var/log/","/var/log/dmesg", "/tmp/dmesg_output.log"] diff --git a/poky/meta/lib/oeqa/runtime/cases/ptest.py b/poky/meta/lib/oeqa/runtime/cases/ptest.py index d8d1e1b344..99a44f0767 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ptest.py +++ b/poky/meta/lib/oeqa/runtime/cases/ptest.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: MIT # +import os import unittest import pprint import datetime @@ -18,7 +19,20 @@ class PtestRunnerTest(OERuntimeTestCase): @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") @@ -67,8 +81,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/poky/meta/lib/oeqa/runtime/cases/weston.py b/poky/meta/lib/oeqa/runtime/cases/weston.py new file mode 100644 index 0000000000..ac29eca6e4 --- /dev/null +++ b/poky/meta/lib/oeqa/runtime/cases/weston.py @@ -0,0 +1,69 @@ +# +# 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 +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']) + 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) + + 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)) |