xref: /OK3568_Linux_fs/buildroot/support/testing/tests/init/test_openrc.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1from tests.init.base import InitSystemBase as InitSystemBase
2
3
4class InitSystemOpenrcBase(InitSystemBase):
5    config = \
6        """
7        BR2_arm=y
8        BR2_cortex_a9=y
9        BR2_ARM_ENABLE_VFP=y
10        BR2_TOOLCHAIN_EXTERNAL=y
11        BR2_INIT_OPENRC=y
12        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
13        # BR2_TARGET_ROOTFS_TAR is not set
14        """
15
16    def check_init(self):
17        super(InitSystemOpenrcBase, self).check_init('/sbin/openrc-init')
18
19        # Test all services are OK
20        output, _ = self.emulator.run("rc-status -c")
21        self.assertEqual(len(output), 0)
22
23
24class TestInitSystemOpenrcRoFull(InitSystemOpenrcBase):
25    config = InitSystemOpenrcBase.config + \
26        """
27        BR2_SYSTEM_DHCP="eth0"
28        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
29        BR2_TARGET_ROOTFS_SQUASHFS=y
30        """
31
32    def test_run(self):
33        self.start_emulator("squashfs")
34        self.check_init()
35
36
37class TestInitSystemOpenrcRwFull(InitSystemOpenrcBase):
38    config = InitSystemOpenrcBase.config + \
39        """
40        BR2_SYSTEM_DHCP="eth0"
41        BR2_TARGET_ROOTFS_EXT2=y
42        """
43
44    def test_run(self):
45        self.start_emulator("ext2")
46        self.check_init()
47