diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/dnf.py')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/dnf.py | 88 |
1 files changed, 35 insertions, 53 deletions
diff --git a/meta/lib/oeqa/runtime/cases/dnf.py b/meta/lib/oeqa/runtime/cases/dnf.py index f40c63026e..3ccb18ce83 100644 --- a/meta/lib/oeqa/runtime/cases/dnf.py +++ b/meta/lib/oeqa/runtime/cases/dnf.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
@@ -73,48 +75,43 @@ class DnfRepoTest(DnfTest): | |||
73 | def test_dnf_makecache(self): | 75 | def test_dnf_makecache(self): |
74 | self.dnf_with_repo('makecache') | 76 | self.dnf_with_repo('makecache') |
75 | 77 | ||
76 | |||
77 | # Does not work when repo is specified on the command line | ||
78 | # @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | ||
79 | # def test_dnf_repolist(self): | ||
80 | # self.dnf_with_repo('repolist') | ||
81 | |||
82 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | 78 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) |
83 | def test_dnf_repoinfo(self): | 79 | def test_dnf_repoinfo(self): |
84 | self.dnf_with_repo('repoinfo') | 80 | self.dnf_with_repo('repoinfo') |
85 | 81 | ||
86 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | 82 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) |
87 | def test_dnf_install(self): | 83 | def test_dnf_install(self): |
88 | output = self.dnf_with_repo('list run-postinsts-dev') | 84 | self.dnf_with_repo('remove -y dnf-test-*') |
89 | if 'Installed Packages' in output: | 85 | self.dnf_with_repo('install -y dnf-test-dep') |
90 | self.dnf_with_repo('remove -y run-postinsts-dev') | ||
91 | self.dnf_with_repo('install -y run-postinsts-dev') | ||
92 | 86 | ||
93 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) | 87 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) |
94 | def test_dnf_install_dependency(self): | 88 | def test_dnf_install_dependency(self): |
95 | self.dnf_with_repo('remove -y run-postinsts') | 89 | self.dnf_with_repo('remove -y dnf-test-*') |
96 | self.dnf_with_repo('install -y run-postinsts-dev') | 90 | self.dnf_with_repo('install -y dnf-test-main') |
91 | output = self.dnf('list --installed dnf-test-*') | ||
92 | self.assertIn("dnf-test-main.", output) | ||
93 | self.assertIn("dnf-test-dep.", output) | ||
97 | 94 | ||
98 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_dependency']) | 95 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_dependency']) |
99 | def test_dnf_install_from_disk(self): | 96 | def test_dnf_install_from_disk(self): |
100 | self.dnf_with_repo('remove -y run-postinsts-dev') | 97 | self.dnf_with_repo('remove -y dnf-test-dep') |
101 | self.dnf_with_repo('install -y --downloadonly run-postinsts-dev') | 98 | self.dnf_with_repo('install -y --downloadonly dnf-test-dep') |
102 | status, output = self.target.run('find /var/cache/dnf -name run-postinsts-dev*rpm', 1500) | 99 | status, output = self.target.run('find /var/cache/dnf -name dnf-test-dep*rpm') |
103 | self.assertEqual(status, 0, output) | 100 | self.assertEqual(status, 0, output) |
104 | self.dnf_with_repo('install -y %s' % output) | 101 | self.dnf_with_repo('install -y %s' % output) |
105 | 102 | ||
106 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_from_disk']) | 103 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install_from_disk']) |
107 | def test_dnf_install_from_http(self): | 104 | def test_dnf_install_from_http(self): |
108 | output = subprocess.check_output('%s %s -name run-postinsts-dev*' % (bb.utils.which(os.getenv('PATH'), "find"), | 105 | output = subprocess.check_output('%s %s -name dnf-test-dep*' % (bb.utils.which(os.getenv('PATH'), "find"), |
109 | os.path.join(self.tc.td['WORKDIR'], 'oe-testimage-repo')), shell=True).decode("utf-8") | 106 | os.path.join(self.tc.td['WORKDIR'], 'oe-testimage-repo')), shell=True).decode("utf-8") |
110 | rpm_path = output.split("/")[-2] + "/" + output.split("/")[-1] | 107 | rpm_path = output.split("/")[-2] + "/" + output.split("/")[-1] |
111 | url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, rpm_path) | 108 | url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, rpm_path) |
112 | self.dnf_with_repo('remove -y run-postinsts-dev') | 109 | self.dnf_with_repo('remove -y dnf-test-dep') |
113 | self.dnf_with_repo('install -y %s' % url) | 110 | self.dnf_with_repo('install -y %s' % url) |
114 | 111 | ||
115 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) | 112 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_install']) |
116 | def test_dnf_reinstall(self): | 113 | def test_dnf_reinstall(self): |
117 | self.dnf_with_repo('reinstall -y run-postinsts-dev') | 114 | self.dnf_with_repo('reinstall -y dnf-test-main') |
118 | 115 | ||
119 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | 116 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) |
120 | @skipIfInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when not enable usrmerge') | 117 | @skipIfInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when not enable usrmerge') |
@@ -137,55 +134,40 @@ class DnfRepoTest(DnfTest): | |||
137 | self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500) | 134 | self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500) |
138 | self.target.run('cp /bin/sh %s/bin' % rootpath, 1500) | 135 | self.target.run('cp /bin/sh %s/bin' % rootpath, 1500) |
139 | self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500) | 136 | self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500) |
140 | self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath) | 137 | self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox' % rootpath) |
141 | status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500) | 138 | status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500) |
142 | self.assertEqual(0, status, output) | 139 | self.assertEqual(0, status, output) |
143 | status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500) | 140 | status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500) |
144 | self.assertEqual(0, status, output) | 141 | self.assertEqual(0, status, output) |
145 | 142 | ||
146 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | 143 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) |
147 | @skipIfNotInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when enable usrmege') | 144 | @skipIfNotInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when enable usrmerge') |
148 | @OEHasPackage('busybox') | 145 | @OEHasPackage('busybox') |
149 | def test_dnf_installroot_usrmerge(self): | 146 | def test_dnf_installroot_usrmerge(self): |
150 | rootpath = '/home/root/chroot/test' | 147 | rootpath = '/home/root/chroot/test' |
151 | #Copy necessary files to avoid errors with not yet installed tools on | 148 | #Copy necessary files to avoid errors with not yet installed tools on |
152 | #installroot directory. | 149 | #installroot directory. |
153 | self.target.run('mkdir -p %s/etc' % rootpath, 1500) | 150 | self.target.run('mkdir -p %s/etc' % rootpath) |
154 | self.target.run('mkdir -p %s/usr/bin %s/usr/sbin' % (rootpath, rootpath), 1500) | 151 | self.target.run('mkdir -p %s/usr/bin %s/usr/sbin' % (rootpath, rootpath)) |
155 | self.target.run('ln -sf -r %s/usr/bin %s/bin' % (rootpath, rootpath), 1500) | 152 | self.target.run('ln -sf usr/bin %s/bin' % (rootpath)) |
156 | self.target.run('ln -sf -r %s/usr/sbin %s/sbin' % (rootpath, rootpath), 1500) | 153 | self.target.run('ln -sf usr/sbin %s/sbin' % (rootpath)) |
157 | self.target.run('mkdir -p %s/dev' % rootpath, 1500) | 154 | self.target.run('mkdir -p %s/dev' % rootpath) |
158 | #Handle different architectures lib dirs | 155 | #Handle different architectures lib dirs |
159 | self.target.run('mkdir -p %s/usr/lib' % rootpath, 1500) | 156 | self.target.run("for l in /lib*; do mkdir -p %s/usr/$l; ln -s usr/$l %s/$l; done" % (rootpath, rootpath)) |
160 | self.target.run('mkdir -p %s/usr/libx32' % rootpath, 1500) | 157 | self.target.run('cp -r /etc/rpm %s/etc' % rootpath) |
161 | self.target.run('mkdir -p %s/usr/lib64' % rootpath, 1500) | 158 | self.target.run('cp -r /etc/dnf %s/etc' % rootpath) |
162 | self.target.run('cp /lib/libtinfo.so.5 %s/usr/lib' % rootpath, 1500) | 159 | self.target.run('cp /bin/busybox %s/bin/sh' % rootpath) |
163 | self.target.run('cp /libx32/libtinfo.so.5 %s/usr/libx32' % rootpath, 1500) | 160 | self.target.run('mount -o bind /dev %s/dev/' % rootpath) |
164 | self.target.run('cp /lib64/libtinfo.so.5 %s/usr/lib64' % rootpath, 1500) | 161 | self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox' % rootpath) |
165 | self.target.run('ln -sf -r %s/lib %s/usr/lib' % (rootpath,rootpath), 1500) | 162 | status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath) |
166 | self.target.run('ln -sf -r %s/libx32 %s/usr/libx32' % (rootpath,rootpath), 1500) | ||
167 | self.target.run('ln -sf -r %s/lib64 %s/usr/lib64' % (rootpath,rootpath), 1500) | ||
168 | self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500) | ||
169 | self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500) | ||
170 | self.target.run('cp /bin/sh %s/bin' % rootpath, 1500) | ||
171 | self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500) | ||
172 | self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath) | ||
173 | status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500) | ||
174 | self.assertEqual(0, status, output) | 163 | self.assertEqual(0, status, output) |
175 | status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500) | 164 | status, output = self.target.run('test -e %s/bin/busybox' % rootpath) |
176 | self.assertEqual(0, status, output) | 165 | self.assertEqual(0, status, output) |
177 | 166 | ||
178 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) | 167 | @OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache']) |
179 | def test_dnf_exclude(self): | 168 | def test_dnf_exclude(self): |
180 | excludepkg = 'curl-dev' | 169 | self.dnf_with_repo('remove -y dnf-test-*') |
181 | self.dnf_with_repo('install -y curl*') | 170 | self.dnf_with_repo('install -y --exclude=dnf-test-dep dnf-test-*') |
182 | self.dnf('list %s' % excludepkg, 0) | 171 | output = self.dnf('list --installed dnf-test-*') |
183 | #Avoid remove dependencies to skip some errors on different archs and images | 172 | self.assertIn("dnf-test-main.", output) |
184 | self.dnf_with_repo('remove --setopt=clean_requirements_on_remove=0 -y curl*') | 173 | self.assertNotIn("dnf-test-dev.", output) |
185 | #check curl-dev is not installed adter removing all curl occurrences | ||
186 | status, output = self.target.run('dnf list --installed | grep %s'% excludepkg, 1500) | ||
187 | self.assertEqual(1, status, "%s was not removed, is listed as installed"%excludepkg) | ||
188 | self.dnf_with_repo('install -y --exclude=%s --exclude=curl-staticdev curl*' % excludepkg) | ||
189 | #check curl-dev is not installed after being excluded | ||
190 | status, output = self.target.run('dnf list --installed | grep %s'% excludepkg , 1500) | ||
191 | self.assertEqual(1, status, "%s was not excluded, is listed as installed"%excludepkg) | ||