@@ -37,6 +37,7 @@ F: package/flutter-engine/
F: package/flutter-gallery/
F: package/flutter-pi/
F: package/flutter-sdk-bin/
+F: support/testing/tests/package/test_firewalld.py
F: support/testing/tests/package/test_flutter.py
N: Adam Heinrich <adam@adamh.cz>
new file mode 100644
@@ -0,0 +1,94 @@
+"""Test firewalld for both systemd and sysvinit."""
+import os
+import infra.basetest
+
+
+class TestFirewalldSystemd(infra.basetest.BRTest):
+ """Build the kernel as firewalld requires several the nftable options."""
+
+ __test__ = True
+ config: str = """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+ BR2_PER_PACKAGE_DIRECTORIES=y
+ BR2_INIT_SYSTEMD=y
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.57"
+ BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+ BR2_LINUX_KERNEL_DTS_SUPPORT=y
+ BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_FIREWALLD=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ kernel_file = os.path.join(self.builddir, "images", "zImage")
+ dtb_file = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
+ self.emulator.boot(arch="armv7",
+ kernel=kernel_file,
+ kernel_cmdline=["console=ttyAMA0,115200"],
+ options=[
+ "-initrd", cpio_file,
+ "-dtb", dtb_file,
+ "-M", "vexpress-a9"
+ ])
+ # It takes quite some time for the system to boot with firewalld,
+ self.emulator.timeout_multiplier *= 10
+ self.emulator.login()
+ cmd = "firewall-cmd --state"
+ output, exit_code = self.emulator.run(cmd, timeout=10)
+ self.assertIn("running", output[0])
+ self.assertEqual(exit_code, 0)
+
+
+class TestFirewalldSysVInit(infra.basetest.BRTest):
+ """Build the kernel as firewalld requires several nftable options."""
+
+ __test__ = True
+ config: str = """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+ BR2_PER_PACKAGE_DIRECTORIES=y
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.57"
+ BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+ BR2_LINUX_KERNEL_DTS_SUPPORT=y
+ BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_FIREWALLD=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ kernel_file = os.path.join(self.builddir, "images", "zImage")
+ dtb_file = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
+ self.emulator.boot(arch="armv7",
+ kernel=kernel_file,
+ kernel_cmdline=["console=ttyAMA0,115200"],
+ options=[
+ "-initrd", cpio_file,
+ "-dtb", dtb_file,
+ "-M", "vexpress-a9"
+ ])
+ # It takes quite some time for the system to boot with firewalld.
+ self.emulator.timeout_multiplier *= 10
+ self.emulator.login()
+ cmd = "firewall-cmd --state"
+ output, exit_code = self.emulator.run(cmd, timeout=10)
+ self.assertIn("running", output[0])
+ self.assertEqual(exit_code, 0)
This test case runs firewalld using both system and sysvinit. run `firewalld-cmd --state` and ensure the output is "running" with a return code of 0. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- DEVELOPERS | 1 + .../testing/tests/package/test_firewalld.py | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 support/testing/tests/package/test_firewalld.py