diff mbox series

[3/6] support/testing/tests/package/test_mender.py: Add RO fs test

Message ID 20241014102123.3727883-4-adam.duskett@amarulasolutions.com
State New
Headers show
Series mender cleanup and intermittent update | expand

Commit Message

Adam Duskett Oct. 14, 2024, 10:21 a.m. UTC
Add a test for read-only file systems.

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
 support/testing/tests/package/test_mender.py | 40 ++++++++++++++------
 1 file changed, 29 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/support/testing/tests/package/test_mender.py b/support/testing/tests/package/test_mender.py
index fdf55ed616..0938cb77e1 100644
--- a/support/testing/tests/package/test_mender.py
+++ b/support/testing/tests/package/test_mender.py
@@ -3,23 +3,23 @@  import os
 import infra.basetest
 
 
-class TestMender(infra.basetest.BRTest):
+class TestMenderInfra(infra.basetest.BRTest):
     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
-        """
-        BR2_PACKAGE_MENDER=y
-        BR2_TARGET_ROOTFS_CPIO=y
-        BR2_ROOTFS_OVERLAY="{}"
-        """.format(
-           # overlay to add a fake 'fw_printenv', used by Mender
-           infra.filepath("tests/package/test_mender/rootfs-overlay"))
+             """
+             BR2_PACKAGE_MENDER=y
+             BR2_TARGET_ROOTFS_CPIO=y
+             BR2_ROOTFS_OVERLAY="{}"
+             """.format(
+                 # overlay to add a fake 'fw_printenv', used by Mender
+                 infra.filepath("tests/package/test_mender/rootfs-overlay"))
 
-    def test_run(self):
+    def base_test_run(self):
         cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
-        self.emulator.boot(arch="armv5",
-                           kernel="builtin",
+        self.emulator.boot(arch="armv5", kernel="builtin",
                            options=["-initrd", cpio_file])
         self.emulator.login()
 
+    def run_mender_test(self):
         # Check if the Daemon is running
         self.assertRunOk("ls /var/run/mender.pid")
         self.assertRunOk("ps aux | egrep [m]ender")
@@ -30,3 +30,21 @@  class TestMender(infra.basetest.BRTest):
         cmd = "mender show-artifact 2>&1 | grep -i 'err'"  # Check if no 'error' among the traces
         _, exit_code = self.emulator.run(cmd)
         self.assertEqual(exit_code, 1)
+
+
+class TestMenderRW(TestMenderInfra):
+    def test_run(self):
+        TestMenderInfra.base_test_run(self)
+        self.run_mender_test()
+
+
+class TestMenderRO(TestMenderInfra):
+    config = \
+        """
+        {}
+        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
+        """.format(TestMenderInfra.config)
+
+    def test_run(self):
+        TestMenderInfra.base_test_run(self)
+        self.run_mender_test()