diff options
author | Jose Perez Carranza <jose.perez.carranza@linux.intel.com> | 2017-11-30 10:23:02 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-05-15 10:56:48 +0100 |
commit | cb68e9a2feade1ee05f8c27438b41bdeac55ae3d (patch) | |
tree | b9d0a1d3dd4de69bd0082e127ed0f5d5cdbc3797 /meta | |
parent | 5479654eeaaa0f81bfff54ca49369c87f1658705 (diff) | |
download | poky-cb68e9a2feade1ee05f8c27438b41bdeac55ae3d.tar.gz |
runtime/dnf: Add new dnf test cases
Add test cases to test “exclude” and “installroot“ options, also modify
the logic of filtering packages on the feed to have all the packages
needed by the tests.
[YOCTO #10744]
(From OE-Core rev: 1121806603c6f621d084b692216f3f616a0768dc)
Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/testimage.bbclass | 11 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/cases/dnf.py | 40 |
2 files changed, 48 insertions, 3 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 77291c22ce..bb688b00d5 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
@@ -331,6 +331,7 @@ def create_index(arg): | |||
331 | return None | 331 | return None |
332 | 332 | ||
333 | def create_rpm_index(d): | 333 | def create_rpm_index(d): |
334 | import glob | ||
334 | # Index RPMs | 335 | # Index RPMs |
335 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c") | 336 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c") |
336 | index_cmds = [] | 337 | index_cmds = [] |
@@ -347,9 +348,13 @@ def create_rpm_index(d): | |||
347 | lf = bb.utils.lockfile(lockfilename, False) | 348 | lf = bb.utils.lockfile(lockfilename, False) |
348 | oe.path.copyhardlinktree(rpm_dir, idx_path) | 349 | oe.path.copyhardlinktree(rpm_dir, idx_path) |
349 | # Full indexes overload a 256MB image so reduce the number of rpms | 350 | # Full indexes overload a 256MB image so reduce the number of rpms |
350 | # in the feed. Filter to r* since we use the run-postinst packages and | 351 | # in the feed by filtering to specific packages needed by the tests. |
351 | # this leaves some allarch and machine arch packages too. | 352 | package_list = glob.glob(idx_path + "*/*.rpm") |
352 | bb.utils.remove(idx_path + "*/[a-qs-z]*.rpm") | 353 | |
354 | for pkg in package_list: | ||
355 | if not os.path.basename(pkg).startswith(("rpm", "run-postinsts", "busybox", "bash", "update-alternatives", "libc6", "curl", "musl")): | ||
356 | bb.utils.remove(pkg) | ||
357 | |||
353 | bb.utils.unlockfile(lf) | 358 | bb.utils.unlockfile(lf) |
354 | cmd = '%s --update -q %s' % (rpm_createrepo, idx_path) | 359 | cmd = '%s --update -q %s' % (rpm_createrepo, idx_path) |
355 | 360 | ||
diff --git a/meta/lib/oeqa/runtime/cases/dnf.py b/meta/lib/oeqa/runtime/cases/dnf.py index 2f87296b4e..7da31cbf88 100644 --- a/meta/lib/oeqa/runtime/cases/dnf.py +++ b/meta/lib/oeqa/runtime/cases/dnf.py | |||
@@ -120,4 +120,44 @@ class DnfRepoTest(DnfTest): | |||
120 | def test_dnf_reinstall(self): | 120 | def test_dnf_reinstall(self): |
121 | self.dnf_with_repo('reinstall -y run-postinsts-dev') | 121 | self.dnf_with_repo('reinstall -y run-postinsts-dev') |
122 | 122 | ||
123 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | ||
124 | @OETestID(1771) | ||
125 | def test_dnf_installroot(self): | ||
126 | rootpath = '/home/root/chroot/test' | ||
127 | #Copy necessary files to avoid errors with not yet installed tools on | ||
128 | #installroot directory. | ||
129 | self.target.run('mkdir -p %s/etc' % rootpath, 1500) | ||
130 | self.target.run('mkdir -p %s/bin %s/sbin %s/usr/bin %s/usr/sbin' % (rootpath, rootpath, rootpath, rootpath), 1500) | ||
131 | self.target.run('mkdir -p %s/dev' % rootpath, 1500) | ||
132 | #Handle different architectures lib dirs | ||
133 | self.target.run('mkdir -p %s/lib' % rootpath, 1500) | ||
134 | self.target.run('mkdir -p %s/libx32' % rootpath, 1500) | ||
135 | self.target.run('mkdir -p %s/lib64' % rootpath, 1500) | ||
136 | self.target.run('cp /lib/libtinfo.so.5 %s/lib' % rootpath, 1500) | ||
137 | self.target.run('cp /libx32/libtinfo.so.5 %s/libx32' % rootpath, 1500) | ||
138 | self.target.run('cp /lib64/libtinfo.so.5 %s/lib64' % rootpath, 1500) | ||
139 | self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500) | ||
140 | self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500) | ||
141 | self.target.run('cp /bin/sh %s/bin' % rootpath, 1500) | ||
142 | self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500) | ||
143 | self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath) | ||
144 | status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500) | ||
145 | self.assertEqual(0, status, output) | ||
146 | status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500) | ||
147 | self.assertEqual(0, status, output) | ||
123 | 148 | ||
149 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | ||
150 | @OETestID(1772) | ||
151 | def test_dnf_exclude(self): | ||
152 | excludepkg = 'curl-dev' | ||
153 | self.dnf_with_repo('install -y curl*') | ||
154 | self.dnf('list %s' % excludepkg, 0) | ||
155 | #Avoid remove dependencies to skip some errors on different archs and images | ||
156 | self.dnf_with_repo('remove --setopt=clean_requirements_on_remove=0 -y curl*') | ||
157 | #check curl-dev is not installed adter removing all curl occurrences | ||
158 | status, output = self.target.run('dnf list --installed | grep %s'% excludepkg, 1500) | ||
159 | self.assertEqual(1, status, "%s was not removed, is listed as installed"%excludepkg) | ||
160 | self.dnf_with_repo('install -y --exclude=%s curl*' % excludepkg) | ||
161 | #check curl-dev is not installed after being excluded | ||
162 | status, output = self.target.run('dnf list --installed | grep %s'% excludepkg , 1500) | ||
163 | self.assertEqual(1, status, "%s was not excluded, is listed as installed"%excludepkg) | ||