diff options
author | Ross Burton <ross.burton@intel.com> | 2017-08-04 16:30:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-13 09:27:37 +0100 |
commit | 582097c103a495807e10b3c5719aad31803decca (patch) | |
tree | 38d41f026573a889efa87c57b7aca7be02fc4b3f /meta/lib/oeqa/selftest | |
parent | 476edb2b472b5dc35bf00b02a629db2ada512df3 (diff) | |
download | poky-582097c103a495807e10b3c5719aad31803decca.tar.gz |
oeqa/runtime_test: use subtests in test_postinst_rootfs_and_boot
As this test has two nested loops and actually runs six times, use
UnitTest.subTest() so we can tell which instance is failing, and to run all
variations instead of failing on the first one.
Also set PACKAGE_CLASSES to just the type we need to reduce the verboseness of
the output, and consolidate the feature generation to be neater.
(From OE-Core rev: c7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 2a70ae15b8..72f906deea 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
@@ -223,37 +223,31 @@ postinst-delayed-t \ | |||
223 | fileboot_name = "this-was-created-at-first-boot" | 223 | fileboot_name = "this-was-created-at-first-boot" |
224 | rootfs_pkg = 'postinst-at-rootfs' | 224 | rootfs_pkg = 'postinst-at-rootfs' |
225 | boot_pkg = 'postinst-delayed-a' | 225 | boot_pkg = 'postinst-delayed-a' |
226 | #Step 1 | 226 | |
227 | common_features = 'MACHINE = "qemux86"\n' | ||
228 | common_features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg) | ||
229 | common_features += 'IMAGE_FEATURES += "ssh-server-openssh"\n' | ||
230 | for init_manager in ("sysvinit", "systemd"): | 227 | for init_manager in ("sysvinit", "systemd"): |
231 | #for sysvinit no extra configuration is needed, | 228 | for classes in ("package_rpm", "package_deb", "package_ipk"): |
232 | features = '' | 229 | with self.subTest(init_manager=init_manager, package_class=classes): |
233 | if (init_manager is "systemd"): | 230 | features = 'MACHINE = "qemux86"\n' |
234 | features += 'DISTRO_FEATURES_append = " systemd"\n' | 231 | features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg) |
235 | features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n' | 232 | features += 'IMAGE_FEATURES += "ssh-server-openssh"\n' |
236 | features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n' | 233 | features += 'PACKAGE_CLASSES = "%s"\n' % classes |
237 | features += 'VIRTUAL-RUNTIME_initscripts = ""\n' | 234 | if init_manager == "systemd": |
238 | for classes in ("package_rpm package_deb package_ipk", | 235 | features += 'DISTRO_FEATURES_append = " systemd"\n' |
239 | "package_deb package_rpm package_ipk", | 236 | features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n' |
240 | "package_ipk package_deb package_rpm"): | 237 | features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n' |
241 | features += 'PACKAGE_CLASSES = "%s"\n' % classes | 238 | features += 'VIRTUAL-RUNTIME_initscripts = ""\n' |
242 | self.write_config(common_features + features) | 239 | self.write_config(features) |
243 | 240 | ||
244 | #Step 2 | 241 | bitbake('core-image-minimal') |
245 | bitbake('core-image-minimal') | 242 | |
246 | 243 | file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS', "core-image-minimal"), | |
247 | #Step 3 | 244 | file_rootfs_name) |
248 | file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS',"core-image-minimal"), | 245 | found = os.path.isfile(file_rootfs_created) |
249 | file_rootfs_name) | 246 | self.assertTrue(found, "File %s was not created at rootfs time by %s" % \ |
250 | found = os.path.isfile(file_rootfs_created) | 247 | (file_rootfs_name, rootfs_pkg)) |
251 | self.assertTrue(found, "File %s was not created at rootfs time by %s" % \ | 248 | |
252 | (file_rootfs_name, rootfs_pkg)) | 249 | testcommand = 'ls /etc/' + fileboot_name |
253 | 250 | with runqemu('core-image-minimal') as qemu: | |
254 | #Step 4 | 251 | sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' |
255 | testcommand = 'ls /etc/'+fileboot_name | 252 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand)) |
256 | with runqemu('core-image-minimal') as qemu: | 253 | self.assertEqual(result.status, 0, 'File %s was not created at firts boot'% fileboot_name) |
257 | sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | ||
258 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand)) | ||
259 | self.assertEqual(result.status, 0, 'File %s was not created at firts boot'% fileboot_name) | ||