* [PATCH] oeqa/selftest/runtime_test: split systemd and sysvinit tests out
@ 2019-12-06 1:58 Armin Kuster
2019-12-06 14:44 ` Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Armin Kuster @ 2019-12-06 1:58 UTC (permalink / raw)
To: openembedded-core
This should help debug which part of this selftest is failing.
We can not tell which outloop is failing so split the tests into
systemd and sysvinit.
See [Yocto # 13650] for more details.
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
meta/lib/oeqa/selftest/cases/runtime_test.py | 102 ++++++++++++++-----
1 file changed, 76 insertions(+), 26 deletions(-)
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 4b56e5beca2..94dece621b1 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -232,7 +232,7 @@ class TestImage(OESelftestTestCase):
bitbake('-c testimage core-image-minimal')
class Postinst(OESelftestTestCase):
- def test_postinst_rootfs_and_boot(self):
+ def test_postinst_rootfs_and_boot_sysvinit(self):
"""
Summary: The purpose of this test case is to verify Post-installation
scripts are called when rootfs is created and also test
@@ -246,7 +246,7 @@ class Postinst(OESelftestTestCase):
created by postinst_boot recipe is present on image.
Expected: The files are successfully created during rootfs and boot
time for 3 different package managers: rpm,ipk,deb and
- for initialization managers: sysvinit and systemd.
+ for initialization managers: sysvinit.
"""
@@ -261,30 +261,80 @@ class Postinst(OESelftestTestCase):
hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test")
targettestdir = os.path.join(sysconfdir, "postinst-test")
- for init_manager in ("sysvinit", "systemd"):
- for classes in ("package_rpm", "package_deb", "package_ipk"):
- with self.subTest(init_manager=init_manager, package_class=classes):
- features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
- features += 'IMAGE_FEATURES += "package-management empty-root-password"\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')
-
- self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")),
- "rootfs state file was not created")
-
- with runqemu('core-image-minimal') as qemu:
- # Make the test echo a string and search for that as
- # run_serial()'s status code is useless.'
- for filename in ("rootfs", "delayed-a", "delayed-b"):
- status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
- self.assertEqual(output, "found", "%s was not present on boot" % filename)
+ init_manager = "sysvinit"
+ for classes in ("package_rpm", "package_deb", "package_ipk"):
+ with self.subTest(init_manager=init_manager, package_class=classes):
+ features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
+ features += 'IMAGE_FEATURES += "package-management empty-root-password"\n'
+ features += 'PACKAGE_CLASSES = "%s"\n' % classes
+ self.write_config(features)
+
+ bitbake('core-image-minimal')
+
+ self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")),
+ "rootfs state file was not created")
+
+ with runqemu('core-image-minimal') as qemu:
+ # Make the test echo a string and search for that as
+ # run_serial()'s status code is useless.'
+ for filename in ("rootfs", "delayed-a", "delayed-b"):
+ status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
+ self.assertEqual(output, "found", "%s was not present on boot" % filename)
+
+
+ def test_postinst_rootfs_and_boot_systemd(self):
+ """
+ Summary: The purpose of this test case is to verify Post-installation
+ scripts are called when rootfs is created and also test
+ that script can be delayed to run at first boot.
+ Dependencies: NA
+ Steps: 1. Add proper configuration to local.conf file
+ 2. Build a "core-image-minimal" image
+ 3. Verify that file created by postinst_rootfs recipe is
+ present on rootfs dir.
+ 4. Boot the image created on qemu and verify that the file
+ created by postinst_boot recipe is present on image.
+ Expected: The files are successfully created during rootfs and boot
+ time for 3 different package managers: rpm,ipk,deb and
+ for initialization managers: systemd.
+
+ """
+
+ import oe.path
+
+ vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal")
+ rootfs = vars["IMAGE_ROOTFS"]
+ self.assertIsNotNone(rootfs)
+ sysconfdir = vars["sysconfdir"]
+ self.assertIsNotNone(sysconfdir)
+ # Need to use oe.path here as sysconfdir starts with /
+ hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test")
+ targettestdir = os.path.join(sysconfdir, "postinst-test")
+
+ init_manager = "systemd"
+ for classes in ("package_rpm", "package_deb", "package_ipk"):
+ with self.subTest(init_manager=init_manager, package_class=classes):
+ features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
+ features += 'IMAGE_FEATURES += "package-management empty-root-password"\n'
+ features += 'PACKAGE_CLASSES = "%s"\n' % classes
+ 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')
+
+ self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")),
+ "rootfs state file was not created")
+
+ with runqemu('core-image-minimal') as qemu:
+ # Make the test echo a string and search for that as
+ # run_serial()'s status code is useless.'
+ for filename in ("rootfs", "delayed-a", "delayed-b"):
+ status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
+ self.assertEqual(output, "found", "%s was not present on boot" % filename)
+
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] oeqa/selftest/runtime_test: split systemd and sysvinit tests out
2019-12-06 1:58 [PATCH] oeqa/selftest/runtime_test: split systemd and sysvinit tests out Armin Kuster
@ 2019-12-06 14:44 ` Richard Purdie
2019-12-06 16:09 ` akuster808
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2019-12-06 14:44 UTC (permalink / raw)
To: Armin Kuster, openembedded-core
On Thu, 2019-12-05 at 17:58 -0800, Armin Kuster wrote:
> This should help debug which part of this selftest is failing.
> We can not tell which outloop is failing so split the tests into
> systemd and sysvinit.
>
> See [Yocto # 13650] for more details.
>
> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> ---
> meta/lib/oeqa/selftest/cases/runtime_test.py | 102 ++++++++++++++---
> --
> 1 file changed, 76 insertions(+), 26 deletions(-)
Rather than duplicating the code could we have a common function the
tests call please?
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] oeqa/selftest/runtime_test: split systemd and sysvinit tests out
2019-12-06 14:44 ` Richard Purdie
@ 2019-12-06 16:09 ` akuster808
0 siblings, 0 replies; 3+ messages in thread
From: akuster808 @ 2019-12-06 16:09 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 12/6/19 6:44 AM, Richard Purdie wrote:
> On Thu, 2019-12-05 at 17:58 -0800, Armin Kuster wrote:
>> This should help debug which part of this selftest is failing.
>> We can not tell which outloop is failing so split the tests into
>> systemd and sysvinit.
>>
>> See [Yocto # 13650] for more details.
>>
>> Signed-off-by: Armin Kuster <akuster808@gmail.com>
>> ---
>> meta/lib/oeqa/selftest/cases/runtime_test.py | 102 ++++++++++++++---
>> --
>> 1 file changed, 76 insertions(+), 26 deletions(-)
> Rather than duplicating the code could we have a common function the
> tests call please?
sure thing,
- armin
>
> Cheers,
>
> Richard
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-06 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-06 1:58 [PATCH] oeqa/selftest/runtime_test: split systemd and sysvinit tests out Armin Kuster
2019-12-06 14:44 ` Richard Purdie
2019-12-06 16:09 ` akuster808
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox