diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-06-25 12:45:53 -0400 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-06-27 14:38:15 -0400 |
commit | 316dfdd917bec6a218f431211d28bf8df6b6fb0f (patch) | |
tree | 5541073f9851f44c2bd67b4959dc776ee3c3810f /import-layers/yocto-poky/meta/lib/oeqa/runtime/cases | |
parent | 36acd3e888044dea2ac0b2946f15616f968388c9 (diff) | |
download | talos-openbmc-316dfdd917bec6a218f431211d28bf8df6b6fb0f.tar.gz talos-openbmc-316dfdd917bec6a218f431211d28bf8df6b6fb0f.zip |
Yocto 2.5
Move OpenBMC to Yocto 2.5(sumo)
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
Diffstat (limited to 'import-layers/yocto-poky/meta/lib/oeqa/runtime/cases')
6 files changed, 155 insertions, 2 deletions
diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/apt.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/apt.py new file mode 100644 index 000000000..8d4dd35c5 --- /dev/null +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/apt.py @@ -0,0 +1,47 @@ +import os +from oeqa.utils.httpserver import HTTPService +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + +class AptTest(OERuntimeTestCase): + + def pkg(self, command, expected = 0): + command = 'apt-get %s' % command + status, output = self.target.run(command, 1500) + message = os.linesep.join([command, output]) + self.assertEqual(status, expected, message) + return output + +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) + cls.repo_server.start() + + @classmethod + def tearDownClass(cls): + cls.repo_server.stop() + + def setup_source_config_for_package_install(self): + apt_get_source_server = 'http://%s:%s/' % (self.tc.target.server_ip, self.repo_server.port) + apt_get_sourceslist_dir = '/etc/apt/' + self.target.run('cd %s; echo deb %s ./ > sources.list' % (apt_get_sourceslist_dir, apt_get_source_server)) + + def cleanup_source_config_for_package_install(self): + apt_get_sourceslist_dir = '/etc/apt/' + self.target.run('cd %s; rm sources.list' % (apt_get_sourceslist_dir)) + + @skipIfNotFeature('package-management', + 'Test requires package-management to be in IMAGE_FEATURES') + @skipIfNotDataVar('IMAGE_PKGTYPE', 'deb', + 'DEB is not the primary package manager') + @OEHasPackage(['apt']) + def test_apt_install_from_repo(self): + self.setup_source_config_for_package_install() + self.pkg('update') + self.pkg('remove --yes run-postinsts-dev') + self.pkg('install --yes --allow-unauthenticated run-postinsts-dev') + self.cleanup_source_config_for_package_install() diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/gi.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/gi.py new file mode 100644 index 000000000..19073e52c --- /dev/null +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/gi.py @@ -0,0 +1,15 @@ +import os + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +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("<testing&testing>"))""" + 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/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/kernelmodule.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/kernelmodule.py index 11ad7b7f0..de1a5aa44 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/kernelmodule.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/kernelmodule.py @@ -28,7 +28,7 @@ class KernelModuleTest(OERuntimeTestCase): @OETestDepends(['gcc.GccCompileTest.test_gcc_compile']) def test_kernel_module(self): cmds = [ - 'cd /usr/src/kernel && make scripts', + 'cd /usr/src/kernel && make scripts prepare', 'cd /tmp && make', 'cd /tmp && insmod hellomod.ko', 'lsmod | grep hellomod', diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/opkg.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/opkg.py new file mode 100644 index 000000000..671ee06c7 --- /dev/null +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/opkg.py @@ -0,0 +1,47 @@ +import os +from oeqa.utils.httpserver import HTTPService +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature +from oeqa.runtime.decorator.package import OEHasPackage + +class OpkgTest(OERuntimeTestCase): + + def pkg(self, command, expected = 0): + command = 'opkg %s' % command + status, output = self.target.run(command, 1500) + message = os.linesep.join([command, output]) + self.assertEqual(status, expected, message) + return output + +class OpkgRepoTest(OpkgTest): + + @classmethod + def setUpClass(cls): + service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], 'all') + cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip) + cls.repo_server.start() + + @classmethod + def tearDownClass(cls): + cls.repo_server.stop() + + def setup_source_config_for_package_install(self): + apt_get_source_server = 'http://%s:%s/' % (self.tc.target.server_ip, self.repo_server.port) + apt_get_sourceslist_dir = '/etc/opkg/' + self.target.run('cd %s; echo src/gz all %s >> opkg.conf' % (apt_get_sourceslist_dir, apt_get_source_server)) + + def cleanup_source_config_for_package_install(self): + apt_get_sourceslist_dir = '/etc/opkg/' + self.target.run('cd %s; sed -i "/^src/d" opkg.conf' % (apt_get_sourceslist_dir)) + + @skipIfNotFeature('package-management', + 'Test requires package-management to be in IMAGE_FEATURES') + @skipIfNotDataVar('IMAGE_PKGTYPE', 'ipk', + 'IPK is not the primary package manager') + @OEHasPackage(['opkg']) + def test_opkg_install_from_repo(self): + self.setup_source_config_for_package_install() + self.pkg('update') + self.pkg('remove run-postinsts-dev') + self.pkg('install run-postinsts-dev') + self.cleanup_source_config_for_package_install() diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/ptest.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/ptest.py index ec8c038a5..f60a433d5 100644 --- a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/ptest.py +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/ptest.py @@ -48,9 +48,12 @@ class PtestRunnerTest(OERuntimeTestCase): @OETestID(1600) @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') - @skipIfNotFeature('ptest-pkgs', 'Test requires ptest-pkgs to be in IMAGE_FEATURES') @OETestDepends(['ssh.SSHTest.test_ssh']) def test_ptestrunner(self): + status, output = self.target.run('which ptest-runner', 0) + if status != 0: + self.skipTest("No -ptest packages are installed in the image") + import datetime test_log_dir = self.td.get('TEST_LOG_DIR', '') @@ -80,3 +83,11 @@ class PtestRunnerTest(OERuntimeTestCase): # Remove the old link to create a new one os.remove(ptest_log_dir_link) os.symlink(os.path.basename(ptest_log_dir), ptest_log_dir_link) + + failed_tests = {} + for section in parse_result.result_dict: + failed_testcases = [ test for test, result in parse_result.result_dict[section] if result == 'fail' ] + if failed_testcases: + failed_tests[section] = failed_testcases + + self.assertFalse(failed_tests, msg = "Failed ptests: %s" %(str(failed_tests))) diff --git a/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/stap.py b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/stap.py new file mode 100644 index 000000000..fc728bfc5 --- /dev/null +++ b/import-layers/yocto-poky/meta/lib/oeqa/runtime/cases/stap.py @@ -0,0 +1,33 @@ +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 + +class StapTest(OERuntimeTestCase): + + @classmethod + def setUpClass(cls): + src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp') + dst = '/tmp/hello.stp' + cls.tc.target.copyTo(src, dst) + + @classmethod + def tearDownClass(cls): + 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']) + def test_stap(self): + cmds = [ + 'cd /usr/src/kernel && make scripts prepare', + 'cd /lib/modules/`uname -r` && (if [ ! -L build ]; then ln -s /usr/src/kernel build; fi)', + 'stap --disable-cache -DSTP_NO_VERREL_CHECK /tmp/hello.stp' + ] + for cmd in cmds: + status, output = self.target.run(cmd, 900) + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) |