summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-08-04 16:30:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-11 00:08:31 +0100
commitc7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b (patch)
tree997efbecea671b8d8f2596219907e462e8c88fb8
parentd6a0bc57fa07d887a78aa8ed76e3bf4558dc5127 (diff)
downloadopenembedded-core-contrib-c7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b.tar.gz
openembedded-core-contrib-c7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b.tar.bz2
openembedded-core-contrib-c7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b.zip
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. Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/lib/oeqa/selftest/cases/runtime_test.py60
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 \
fileboot_name = "this-was-created-at-first-boot"
rootfs_pkg = 'postinst-at-rootfs'
boot_pkg = 'postinst-delayed-a'
- #Step 1
- common_features = 'MACHINE = "qemux86"\n'
- common_features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg)
- common_features += 'IMAGE_FEATURES += "ssh-server-openssh"\n'
+
for init_manager in ("sysvinit", "systemd"):
- #for sysvinit no extra configuration is needed,
- features = ''
- if (init_manager is "systemd"):
- features += 'DISTRO_FEATURES_append = " systemd"\n'
- features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n'
- features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n'
- features += 'VIRTUAL-RUNTIME_initscripts = ""\n'
- for classes in ("package_rpm package_deb package_ipk",
- "package_deb package_rpm package_ipk",
- "package_ipk package_deb package_rpm"):
- features += 'PACKAGE_CLASSES = "%s"\n' % classes
- self.write_config(common_features + features)
-
- #Step 2
- bitbake('core-image-minimal')
-
- #Step 3
- file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS',"core-image-minimal"),
- file_rootfs_name)
- found = os.path.isfile(file_rootfs_created)
- self.assertTrue(found, "File %s was not created at rootfs time by %s" % \
- (file_rootfs_name, rootfs_pkg))
-
- #Step 4
- testcommand = 'ls /etc/'+fileboot_name
- with runqemu('core-image-minimal') as qemu:
- sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
- result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand))
- self.assertEqual(result.status, 0, 'File %s was not created at firts boot'% fileboot_name)
+ for classes in ("package_rpm", "package_deb", "package_ipk"):
+ with self.subTest(init_manager=init_manager, package_class=classes):
+ features = 'MACHINE = "qemux86"\n'
+ features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg)
+ features += 'IMAGE_FEATURES += "ssh-server-openssh"\n'
+ features += 'PACKAGE_CLASSES = "%s"\n' % classes
+ if init_manager == "systemd":
+ features += 'DISTRO_FEATURES_append = " systemd"\n'
+ features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n'
+ features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n'
+ features += 'VIRTUAL-RUNTIME_initscripts = ""\n'
+ self.write_config(features)
+
+ bitbake('core-image-minimal')
+
+ file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS', "core-image-minimal"),
+ file_rootfs_name)
+ found = os.path.isfile(file_rootfs_created)
+ self.assertTrue(found, "File %s was not created at rootfs time by %s" % \
+ (file_rootfs_name, rootfs_pkg))
+
+ testcommand = 'ls /etc/' + fileboot_name
+ with runqemu('core-image-minimal') as qemu:
+ sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand))
+ self.assertEqual(result.status, 0, 'File %s was not created at firts boot'% fileboot_name)