diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/lib/oeqa/runtime')
14 files changed, 155 insertions, 61 deletions
diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/__init__.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/__init__.py deleted file mode 100644 index 4cf3fa76b..000000000 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Enable other layers to have tests in the same named directory -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/_ptest.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/_ptest.py index 0621028b8..71324d3da 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/_ptest.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/_ptest.py @@ -11,7 +11,7 @@ import subprocess def setUpModule(): if not oeRuntimeTest.hasFeature("package-management"): skipModule("Image doesn't have package management feature") - if not oeRuntimeTest.hasPackage("smart"): + if not oeRuntimeTest.hasPackage("smartpm"): skipModule("Image doesn't have smart installed") if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]: skipModule("Rpm is not the primary package manager") @@ -105,7 +105,7 @@ class PtestRunnerTest(oeRuntimeTest): def test_ptestrunner(self): self.add_smart_channel() (runnerstatus, result) = self.target.run('which ptest-runner', 0) - cond = oeRuntimeTest.hasPackage("ptest-runner") and oeRuntimeTest.hasFeature("ptest") and oeRuntimeTest.hasPackage("-ptest") and (runnerstatus != 0) + cond = oeRuntimeTest.hasPackage("ptest-runner") and oeRuntimeTest.hasFeature("ptest") and oeRuntimeTest.hasPackageMatch("-ptest") and (runnerstatus != 0) if cond: self.install_packages(self.install_complementary("*-ptest")) self.install_packages(['ptest-runner']) diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildgalculator.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildgalculator.py new file mode 100644 index 000000000..28ba29e5c --- /dev/null +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildgalculator.py @@ -0,0 +1,23 @@ +from oeqa.oetest import oeRuntimeTest, skipModule +from oeqa.utils.decorators import * +from oeqa.utils.targetbuild import TargetBuildProject + +def setUpModule(): + if not oeRuntimeTest.hasFeature("tools-sdk"): + skipModule("Image doesn't have tools-sdk in IMAGE_FEATURES") + +class GalculatorTest(oeRuntimeTest): + @skipUnlessPassed("test_ssh") + def test_galculator(self): + try: + project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d, + "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") + project.download_archive() + + self.assertEqual(project.run_configure(), 0, + msg="Running configure failed") + + self.assertEqual(project.run_make(), 0, + msg="Running make failed") + finally: + project.clean() diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildiptables.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildiptables.py index 09e252df8..bc75d0a0c 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildiptables.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildiptables.py @@ -11,7 +11,7 @@ class BuildIptablesTest(oeRuntimeTest): @classmethod def setUpClass(self): self.project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d, - "http://netfilter.org/projects/iptables/files/iptables-1.4.13.tar.bz2") + "http://downloads.yoctoproject.org/mirror/sources/iptables-1.4.13.tar.bz2") self.project.download_archive() @testcase(206) diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildsudoku.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildsudoku.py deleted file mode 100644 index 802b06001..000000000 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/buildsudoku.py +++ /dev/null @@ -1,28 +0,0 @@ -from oeqa.oetest import oeRuntimeTest, skipModule -from oeqa.utils.decorators import * -from oeqa.utils.targetbuild import TargetBuildProject - -def setUpModule(): - if not oeRuntimeTest.hasFeature("tools-sdk"): - skipModule("Image doesn't have tools-sdk in IMAGE_FEATURES") - -class SudokuTest(oeRuntimeTest): - - @classmethod - def setUpClass(self): - self.project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d, - "http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2") - self.project.download_archive() - - @testcase(207) - @skipUnlessPassed("test_ssh") - def test_sudoku(self): - self.assertEqual(self.project.run_configure(), 0, - msg="Running configure failed") - - self.assertEqual(self.project.run_make(), 0, - msg="Running make failed") - - @classmethod - def tearDownClass(self): - self.project.clean() diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/connman.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/connman.py index bd9dba3bd..003fefe2c 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/connman.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/connman.py @@ -27,5 +27,5 @@ class ConnmanTest(oeRuntimeTest): def test_connmand_running(self): (status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep [c]onnmand') if status != 0: - print self.service_status("connman") + print(self.service_status("connman")) self.fail("No connmand process running") diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/files/test.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/files/test.py index f3a2273c5..f389225d7 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/files/test.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/files/test.py @@ -3,4 +3,4 @@ import os os.system('touch /tmp/testfile.python') a = 9.01e+21 - 9.01e+21 + 0.01 -print "the value of a is %s" % a +print("the value of a is %s" % a) diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/parselogs.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/parselogs.py index dec9ebe87..8efe2d1de 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/parselogs.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/parselogs.py @@ -55,18 +55,25 @@ x86_common = [ 'Could not enable PowerButton event', 'probe of LNXPWRBN:00 failed with error -22', 'pmd_set_huge: Cannot satisfy', + 'failed to setup card detect gpio', + 'amd_nb: Cannot enumerate AMD northbridges', + 'failed to retrieve link info, disabling eDP', ] + common_errors qemux86_common = [ 'wrong ELF class', "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', ] + common_errors ignore_errors = { 'default' : common_errors, 'qemux86' : [ 'Failed to access perfctr msr (MSR', + 'pci 0000:00:00.0: [Firmware Bug]: reg 0x..: invalid BAR (can\'t size)', ] + qemux86_common, 'qemux86-64' : qemux86_common, 'qemumips' : [ @@ -81,16 +88,28 @@ ignore_errors = { 'host side 80-wire cable detection failed, limiting max speed', 'mode "640x480" test failed', 'Failed to load module "glx"', + 'can\'t handle BAR above 4GB', + 'Cannot reserve Legacy IO', ] + common_errors, 'qemuarm' : [ 'mmci-pl18x: probe of fpga:05 failed with error -22', 'mmci-pl18x: probe of fpga:0b failed with error -22', - 'Failed to load module "glx"' + 'Failed to load module "glx"', + 'OF: amba_device_add() failed (-19) for /amba/smc@10100000', + 'OF: amba_device_add() failed (-19) for /amba/mpmc@10110000', + '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/ssp@101f4000', + 'OF: amba_device_add() failed (-19) for /amba/fpga/sci@a000', + 'Failed to initialize \'/amba/timer@101e3000\': -22', + 'jitterentropy: Initialization failed with host not compliant with requirements: 2', ] + common_errors, 'qemuarm64' : [ 'Fatal server error:', '(EE) Server terminated with error (1). Closing log file.', 'dmi: Firmware registration failed.', + 'irq: type mismatch, failed to map hwirq-27 for /intc', ] + common_errors, 'emenlow' : [ '[Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness', @@ -110,11 +129,19 @@ ignore_errors = { '(EE) Failed to load module psbdrv', '(EE) open /dev/fb0: No such file or directory', '(EE) AIGLX: reverting to software rendering', + 'dmi: Firmware registration failed.', + 'ioremap error for 0x78', ] + x86_common, 'intel-corei7-64' : x86_common, 'crownbay' : x86_common, 'genericx86' : x86_common, - 'genericx86-64' : x86_common, + 'genericx86-64' : [ + 'Direct firmware load for i915', + 'Failed to load firmware i915', + 'Failed to fetch GuC', + 'Failed to initialize GuC', + 'The driver is built-in, so to load the firmware you need to', + ] + x86_common, 'edgerouter' : [ 'Fatal server error:', ] + common_errors, @@ -153,6 +180,9 @@ class ParseLogsTest(oeRuntimeTest): def getMachine(self): return oeRuntimeTest.tc.d.getVar("MACHINE", True) + def getWorkdir(self): + return oeRuntimeTest.tc.d.getVar("WORKDIR", True) + #get some information on the CPU of the machine to display at the beginning of the output. This info might be useful in some cases. def getHardwareInfo(self): hwi = "" @@ -190,16 +220,19 @@ class ParseLogsTest(oeRuntimeTest): #copy the log files to be parsed locally def transfer_logs(self, log_list): - target_logs = 'target_logs' + workdir = self.getWorkdir() + self.target_logs = workdir + '/' + 'target_logs' + target_logs = self.target_logs if not os.path.exists(target_logs): os.makedirs(target_logs) + bb.utils.remove(self.target_logs + "/*") for f in log_list: self.target.copy_from(f, target_logs) #get the local list of logs def get_local_log_list(self, log_locations): self.transfer_logs(self.getLogList(log_locations)) - logs = [ os.path.join('target_logs',f) for f in os.listdir('target_logs') if os.path.isfile(os.path.join('target_logs',f)) ] + logs = [ os.path.join(self.target_logs, f) for f in os.listdir(self.target_logs) if os.path.isfile(os.path.join(self.target_logs, f)) ] return logs #build the grep command to be used with filters and exclusions @@ -238,7 +271,7 @@ class ParseLogsTest(oeRuntimeTest): result = None thegrep = self.build_grepcmd(errors, ignore_errors, log) try: - result = subprocess.check_output(thegrep, shell=True) + result = subprocess.check_output(thegrep, shell=True).decode("utf-8") except: pass if (result is not None): @@ -246,7 +279,7 @@ class ParseLogsTest(oeRuntimeTest): rez = result.splitlines() for xrez in rez: try: - grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log]) + grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log]).decode("utf-8") except: pass results[log.replace('target_logs/','')][xrez]=grep_output @@ -262,7 +295,7 @@ class ParseLogsTest(oeRuntimeTest): self.write_dmesg() log_list = self.get_local_log_list(self.log_locations) result = self.parse_logs(self.errors, self.ignore_errors, log_list) - print self.getHardwareInfo() + print(self.getHardwareInfo()) errcount = 0 for log in result: self.msg += "Log: "+log+"\n" diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/ping.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/ping.py index 80c460161..0f2744792 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/ping.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/ping.py @@ -14,7 +14,7 @@ class PingTest(oeRuntimeTest): endtime = time.time() + 60 while count < 5 and time.time() < endtime: proc = subprocess.Popen("ping -c 1 %s" % self.target.ip, shell=True, stdout=subprocess.PIPE) - output += proc.communicate()[0] + output += proc.communicate()[0].decode("utf-8") if proc.poll() == 0: count += 1 else: diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/python.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/python.py index 26edb7a9b..29a231c7c 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/python.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/python.py @@ -4,7 +4,7 @@ from oeqa.oetest import oeRuntimeTest, skipModule from oeqa.utils.decorators import * def setUpModule(): - if not oeRuntimeTest.hasPackage("python"): + if not oeRuntimeTest.hasPackage("python-core"): skipModule("No python package in the image") diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/rpm.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/rpm.py index 624c515aa..7f514ca00 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/rpm.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/rpm.py @@ -51,12 +51,32 @@ class RpmInstallRemoveTest(oeRuntimeTest): @testcase(1096) @skipUnlessPassed('test_ssh') def test_rpm_query_nonroot(self): - (status, output) = self.target.run('useradd test1') - self.assertTrue(status == 0, msg="Failed to create new user: " + output) - (status, output) = self.target.run('sudo -u test1 id') - self.assertTrue('(test1)' in output, msg="Failed to execute as new user") - (status, output) = self.target.run('sudo -u test1 rpm -qa') - self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa: %s" % (status, output)) + + def set_up_test_user(u): + (status, output) = self.target.run("id -u %s" % u) + if status == 0: + pass + else: + (status, output) = self.target.run("useradd %s" % u) + self.assertTrue(status == 0, msg="Failed to create new user: " + output) + + def exec_as_test_user(u): + (status, output) = self.target.run("su -c id %s" % u) + self.assertTrue("({0})".format(u) in output, msg="Failed to execute as new user") + (status, output) = self.target.run("su -c \"rpm -qa\" %s " % u) + self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa: %s" % (status, output)) + + def unset_up_test_user(u): + (status, output) = self.target.run("userdel -r %s" % u) + self.assertTrue(status == 0, msg="Failed to erase user: %s" % output) + + tuser = 'test1' + + try: + set_up_test_user(tuser) + exec_as_test_user(tuser) + finally: + unset_up_test_user(tuser) @testcase(195) @skipUnlessPassed('test_rpm_install') @@ -98,4 +118,3 @@ class RpmInstallRemoveTest(oeRuntimeTest): @classmethod def tearDownClass(self): oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') - diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/smart.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/smart.py index 126d61463..6cdb10d63 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/smart.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/smart.py @@ -1,5 +1,7 @@ import unittest import re +import oe +import subprocess from oeqa.oetest import oeRuntimeTest, skipModule from oeqa.utils.decorators import * from oeqa.utils.httpserver import HTTPService @@ -7,7 +9,7 @@ from oeqa.utils.httpserver import HTTPService def setUpModule(): if not oeRuntimeTest.hasFeature("package-management"): skipModule("Image doesn't have package management feature") - if not oeRuntimeTest.hasPackage("smart"): + if not oeRuntimeTest.hasPackage("smartpm"): skipModule("Image doesn't have smart installed") if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]: skipModule("Rpm is not the primary package manager") @@ -53,9 +55,50 @@ class SmartBasicTest(SmartTest): class SmartRepoTest(SmartTest): @classmethod + def create_index(self, arg): + index_cmd = arg + try: + bb.note("Executing '%s' ..." % index_cmd) + result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8") + except subprocess.CalledProcessError as e: + return("Index creation command '%s' failed with return code %d:\n%s" % + (e.cmd, e.returncode, e.output.decode("utf-8"))) + if result: + bb.note(result) + return None + + @classmethod def setUpClass(self): self.repolist = [] - self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip) + + # Index RPMs + rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") + index_cmds = [] + rpm_dirs_found = False + archs = (oeRuntimeTest.tc.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split() + for arch in archs: + rpm_dir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True), arch) + idx_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpm', arch) + db_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpmdb', arch) + if not os.path.isdir(rpm_dir): + continue + if os.path.exists(db_path): + bb.utils.remove(dbpath, True) + lockfilename = oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True) + "/rpm.lock" + lf = bb.utils.lockfile(lockfilename, False) + oe.path.copyhardlinktree(rpm_dir, idx_path) + # Full indexes overload a 256MB image so reduce the number of rpms + # in the feed. Filter to p* since we use the psplash packages and + # this leaves some allarch and machine arch packages too. + bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm") + bb.utils.unlockfile(lf) + index_cmds.append("%s --dbpath %s --update -q %s" % (rpm_createrepo, db_path, idx_path)) + rpm_dirs_found = True + # Create repodata¬ + result = oe.utils.multiprocess_exec(index_cmds, self.create_index) + if result: + bb.fatal('%s' % ('\n'.join(result))) + self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('WORKDIR', True), oeRuntimeTest.tc.target.server_ip) self.repo_server.start() @classmethod diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/syslog.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/syslog.py index 2601dd9ea..8f550329e 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/syslog.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/syslog.py @@ -9,7 +9,6 @@ def setUpModule(): class SyslogTest(oeRuntimeTest): @testcase(201) - @skipUnlessPassed("test_syslog_help") def test_syslog_running(self): (status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd') self.assertEqual(status, 0, msg="no syslogd process, ps output: %s" % self.target.run(oeRuntimeTest.pscmd)[1]) @@ -19,8 +18,16 @@ class SyslogTestConfig(oeRuntimeTest): @testcase(1149) @skipUnlessPassed("test_syslog_running") def test_syslog_logger(self): - (status,output) = self.target.run('logger foobar && test -e /var/log/messages && grep foobar /var/log/messages || logread | grep foobar') - self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages. Output: %s " % output) + (status, output) = self.target.run('logger foobar') + self.assertEqual(status, 0, msg="Can't log into syslog. Output: %s " % output) + + (status, output) = self.target.run('grep foobar /var/log/messages') + if status != 0: + if oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", "") == "systemd": + (status, output) = self.target.run('journalctl -o cat | grep foobar') + else: + (status, output) = self.target.run('logread | grep foobar') + self.assertEqual(status, 0, msg="Test log string not found in /var/log/messages or logread. Output: %s " % output) @testcase(1150) @skipUnlessPassed("test_syslog_running") diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/systemd.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/systemd.py index 2b2f10d71..8de799cd6 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/systemd.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/systemd.py @@ -57,7 +57,7 @@ class SystemdBasicTests(SystemdTest): self.systemctl('--version') @testcase(551) - @skipUnlessPassed('test_system_basic') + @skipUnlessPassed('test_systemd_basic') def test_systemd_list(self): self.systemctl('list-unit-files') @@ -153,7 +153,7 @@ class SystemdJournalTests(SystemdTest): if check_match: break # put the startup time in the test log if check_match: - print "%s" % check_match + print("%s" % check_match) else: self.skipTest("Error at obtaining the boot time from journalctl") boot_time_sec = 0 @@ -174,5 +174,5 @@ class SystemdJournalTests(SystemdTest): self.skipTest("Error when parsing time from boot string") #Assert the target boot time against systemd's unit start timeout if boot_time_sec > systemd_TimeoutStartSec: - print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\ - %(boot_time_sec, systemd_TimeoutStartSec) + print("Target boot time %s exceeds systemd's TimeoutStartSec %s"\ + %(boot_time_sec, systemd_TimeoutStartSec)) |