@@ -407,6 +407,8 @@ tests.package.test_crudini.TestCrudiniPy2: { extends: .runtime_test }
tests.package.test_crudini.TestCrudiniPy3: { extends: .runtime_test }
tests.package.test_docker_compose.TestDockerCompose: { extends: .runtime_test }
tests.package.test_dropbear.TestDropbear: { extends: .runtime_test }
+tests.package.test_firewalld.TestFirewalldSystemd: { extends: .runtime_test }
+tests.package.test_firewalld.TestFirewalldSysVInit: { extends: .runtime_test }
tests.package.test_glxinfo.TestGlxinfo: { extends: .runtime_test }
tests.package.test_gst1_python.TestGst1Python: { extends: .runtime_test }
tests.package.test_ipython.TestIPythonPy3: { extends: .runtime_test }
@@ -93,6 +93,7 @@ F: package/setools/
F: package/sngrep/
F: package/spidermonkey/
F: package/systemd/
+F: support/testing/tests/package/test_firewalld.py
F: support/testing/tests/package/test_gst1_python.py
F: support/testing/tests/package/test_python_gobject.py
new file mode 100644
@@ -0,0 +1,98 @@
+"""Test firewalld for both systemd and sysvinit."""
+import os
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestFirewalldSystemd(TestPythonPackageBase):
+ """Build the kernel as firewalld requires all of the nftable options."""
+
+ __test__ = True
+ config = \
+ """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.39"
+ 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_INIT_SYSTEMD=y
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_FIREWALLD=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def wait_boot(self):
+ """Boot time is longer than the default multiplier."""
+ self.emulator.timeout_multiplier *= 10
+ self.emulator.login()
+
+ 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"
+ ])
+ self.wait_boot()
+ 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(TestPythonPackageBase):
+ """Build the kernel as firewalld requires all of the nftable options."""
+
+ __test__ = True
+ config = \
+ """
+ BR2_arm=y
+ BR2_cortex_a9=y
+ BR2_ARM_ENABLE_VFP=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.39"
+ 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 wait_boot(self):
+ """Boot time is longer than the default multiplier."""
+ self.emulator.timeout_multiplier *= 10
+ self.emulator.login()
+
+ 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"
+ ])
+ self.wait_boot()
+ cmd = "firewall-cmd --state"
+ output, exit_code = self.emulator.run(cmd, timeout=10)
+ self.assertIn("running", output[0])
+ self.assertEqual(exit_code, 0)