diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta/lib/oeqa/runtime/cases/dnf.py | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/lib/oeqa/runtime/cases/dnf.py')
-rw-r--r-- | poky/meta/lib/oeqa/runtime/cases/dnf.py | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/poky/meta/lib/oeqa/runtime/cases/dnf.py b/poky/meta/lib/oeqa/runtime/cases/dnf.py new file mode 100644 index 000000000..2f87296b4 --- /dev/null +++ b/poky/meta/lib/oeqa/runtime/cases/dnf.py @@ -0,0 +1,123 @@ +import os +import re +import subprocess +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.runtime.decorator.package import OEHasPackage + +class DnfTest(OERuntimeTestCase): + + def dnf(self, command, expected = 0): + command = 'dnf %s' % command + status, output = self.target.run(command, 1500) + message = os.linesep.join([command, output]) + self.assertEqual(status, expected, message) + return output + +class DnfBasicTest(DnfTest): + + @skipIfNotFeature('package-management', + 'Test requires package-management to be in IMAGE_FEATURES') + @skipIfNotDataVar('IMAGE_PKGTYPE', 'rpm', + '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') + +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) + cls.repo_server.start() + + @classmethod + def tearDownClass(cls): + cls.repo_server.stop() + + def dnf_with_repo(self, command): + pkgarchs = os.listdir(os.path.join(self.tc.td['WORKDIR'], 'oe-testimage-repo')) + deploy_url = 'http://%s:%s/' %(self.target.server_ip, self.repo_server.port) + cmdlinerepoopts = ["--repofrompath=oe-testimage-repo-%s,%s%s" %(arch, deploy_url, arch) for arch in pkgarchs] + + self.dnf(" ".join(cmdlinerepoopts) + " --nogpgcheck " + command) + + @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) + @OETestID(1744) + def test_dnf_makecache(self): + self.dnf_with_repo('makecache') + + +# Does not work when repo is specified on the command line +# @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) +# def test_dnf_repolist(self): +# 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): + 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') + status, output = self.target.run('find /var/cache/dnf -name run-postinsts-dev*rpm', 1500) + self.assertEqual(status, 0, output) + 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") + rpm_path = output.split("/")[-2] + "/" + output.split("/")[-1] + url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, rpm_path) + self.dnf_with_repo('remove -y run-postinsts-dev') + 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') + + |