diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/runtime-test.py')
-rw-r--r-- | meta/lib/oeqa/selftest/runtime-test.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py index 1dbfae1106..20caa97d16 100644 --- a/meta/lib/oeqa/selftest/runtime-test.py +++ b/meta/lib/oeqa/selftest/runtime-test.py | |||
@@ -155,3 +155,64 @@ postinst-delayed-t \ | |||
155 | elif found: | 155 | elif found: |
156 | self.assertEqual(idx, len(postinst_list), "Not found all postinsts") | 156 | self.assertEqual(idx, len(postinst_list), "Not found all postinsts") |
157 | break | 157 | break |
158 | |||
159 | @testcase(1545) | ||
160 | def test_postinst_roofs_and_boot(self): | ||
161 | """ | ||
162 | Summary: The purpose of this test case is to verify Post-installation | ||
163 | scripts are called when roofs is created and also test | ||
164 | that script can be delayed to run at first boot. | ||
165 | Dependencies: NA | ||
166 | Steps: 1. Add proper configuration to local.conf file | ||
167 | 2. Build a "core-image-full-cmdline" image | ||
168 | 3. Verify that file created by postinst_rootfs recipe is | ||
169 | present on rootfs dir. | ||
170 | 4. Boot the image created on qemu and verify that the file | ||
171 | created by postinst_boot recipe is present on image. | ||
172 | 5. Clean the packages and image created to test with | ||
173 | different package managers | ||
174 | Expected: The files are successfully created during rootfs and boot | ||
175 | time for 3 different package managers: rpm,ipk,deb and | ||
176 | for initialization managers: sysvinit and systemd. | ||
177 | |||
178 | """ | ||
179 | file_rootfs_name = "this-was-created-at-rootfstime" | ||
180 | fileboot_name = "this-was-created-at-first-boot" | ||
181 | rootfs_pkg = 'postinst-at-rootfs' | ||
182 | boot_pkg = 'postinst-delayed-a' | ||
183 | #Step 1 | ||
184 | features = 'MACHINE = "qemux86"\n' | ||
185 | features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg) | ||
186 | for init_manager in ("sysvinit", "systemd"): | ||
187 | #for sysvinit no extra configuration is needed, | ||
188 | if (init_manager is "systemd"): | ||
189 | features += 'DISTRO_FEATURES_append = " systemd"\n' | ||
190 | features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n' | ||
191 | features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n' | ||
192 | features += 'VIRTUAL-RUNTIME_initscripts = ""\n' | ||
193 | for classes in ("package_rpm package_deb package_ipk", | ||
194 | "package_deb package_rpm package_ipk", | ||
195 | "package_ipk package_deb package_rpm"): | ||
196 | features += 'PACKAGE_CLASSES = "%s"\n' % classes | ||
197 | self.write_config(features) | ||
198 | |||
199 | #Step 2 | ||
200 | bitbake('core-image-full-cmdline') | ||
201 | |||
202 | #Step 3 | ||
203 | file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS',"core-image-full-cmdline"), | ||
204 | file_rootfs_name) | ||
205 | found = os.path.isfile(file_rootfs_created) | ||
206 | self.assertTrue(found, "File %s was not created at rootfs time by %s" % \ | ||
207 | (file_rootfs_name, rootfs_pkg)) | ||
208 | |||
209 | #Step 4 | ||
210 | testcommand = 'ls /etc/'+fileboot_name | ||
211 | with runqemu('core-image-full-cmdline') as qemu: | ||
212 | sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | ||
213 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand)) | ||
214 | self.assertEqual(result.status, 0, 'File %s was not created at firts boot'% fileboot_name) | ||
215 | |||
216 | #Step 5 | ||
217 | bitbake(' %s %s -c cleanall' % (rootfs_pkg, boot_pkg)) | ||
218 | bitbake('core-image-full-cmdline -c cleanall') | ||