* [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method
@ 2023-11-05 21:52 Adam Duskett
2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Adam Duskett @ 2023-11-05 21:52 UTC (permalink / raw)
To: buildroot; +Cc: Adam Duskett
to override the current value of 60 seconds
As per a suggestion by Thomas, add a timeout argument to override the current
value of 60 seconds for the emulator.login method.
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
support/testing/infra/emulator.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index 02cf486128..09f81eca89 100644
--- a/support/testing/infra/emulator.py
+++ b/support/testing/infra/emulator.py
@@ -84,11 +84,11 @@ class Emulator(object):
# Wait for the login prompt to appear, and then login as root with
# the provided password, or no password if not specified.
- def login(self, password=None):
+ def login(self, password=None, timeout=60):
# The login prompt can take some time to appear when running multiple
# instances in parallel, so set the timeout to a large value
index = self.qemu.expect(["buildroot login:", pexpect.TIMEOUT],
- timeout=60 * self.timeout_multiplier)
+ timeout=timeout * self.timeout_multiplier)
if index != 0:
self.logfile.write("==> System does not boot")
raise SystemError("System does not boot")
--
2.41.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett @ 2023-11-05 21:52 ` Adam Duskett 2023-11-06 19:45 ` Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 3/5] test_lxc.py: " Adam Duskett ` (4 subsequent siblings) 5 siblings, 2 replies; 11+ messages in thread From: Adam Duskett @ 2023-11-05 21:52 UTC (permalink / raw) To: buildroot; +Cc: Adam Duskett self.emulator.timeout_multiplier *= 10 is equivilent to 60 * 10 or 600. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- support/testing/tests/init/test_systemd_selinux.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/support/testing/tests/init/test_systemd_selinux.py b/support/testing/tests/init/test_systemd_selinux.py index fab23e3330..d463f91669 100644 --- a/support/testing/tests/init/test_systemd_selinux.py +++ b/support/testing/tests/init/test_systemd_selinux.py @@ -21,9 +21,8 @@ class TestSELinuxSystemd(infra.basetest.BRTest): """ def wait_boot(self): - # The complete boot with systemd takes more time than what the default multipler permits - self.emulator.timeout_multiplier *= 10 - self.emulator.login() + # The complete boot with systemd takes more time than what the default multiplier permits + self.emulator.login(timeout=600) def run_tests(self, fstype): kernel = os.path.join(self.builddir, "images", "bzImage") -- 2.41.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login 2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett @ 2023-11-06 19:45 ` Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard 1 sibling, 0 replies; 11+ messages in thread From: Thomas Petazzoni via buildroot @ 2023-11-06 19:45 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot On Sun, 5 Nov 2023 14:52:18 -0700 Adam Duskett <adam.duskett@amarulasolutions.com> wrote: > self.emulator.timeout_multiplier *= 10 is equivilent to 60 * 10 or 600. > > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> > --- > support/testing/tests/init/test_systemd_selinux.py | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/support/testing/tests/init/test_systemd_selinux.py b/support/testing/tests/init/test_systemd_selinux.py > index fab23e3330..d463f91669 100644 > --- a/support/testing/tests/init/test_systemd_selinux.py > +++ b/support/testing/tests/init/test_systemd_selinux.py > @@ -21,9 +21,8 @@ class TestSELinuxSystemd(infra.basetest.BRTest): > """ > > def wait_boot(self): > - # The complete boot with systemd takes more time than what the default multipler permits > - self.emulator.timeout_multiplier *= 10 > - self.emulator.login() > + # The complete boot with systemd takes more time than what the default multiplier permits I think the wording of the comment no longer made sense, since we're no longer tweaking the multiplier. So I've reworded the comment a bit (likewise for PATCH 3/5). Thanks! Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login 2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett 2023-11-06 19:45 ` Thomas Petazzoni via buildroot @ 2023-11-10 11:51 ` Peter Korsgaard 1 sibling, 0 replies; 11+ messages in thread From: Peter Korsgaard @ 2023-11-10 11:51 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot >>>>> "Adam" == Adam Duskett <adam.duskett@amarulasolutions.com> writes: > self.emulator.timeout_multiplier *= 10 is equivilent to 60 * 10 or 600. > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> Committed to 2023.02.x and 2023.08.x, thanks. -- Bye, Peter Korsgaard _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH 3/5] test_lxc.py: use timeout argument for emulator.login 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett 2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett @ 2023-11-05 21:52 ` Adam Duskett 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation Adam Duskett ` (3 subsequent siblings) 5 siblings, 1 reply; 11+ messages in thread From: Adam Duskett @ 2023-11-05 21:52 UTC (permalink / raw) To: buildroot; +Cc: Adam Duskett self.emulator.timeout_multiplier *= 10 is equivilent to 60 * 10 or 600. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- support/testing/tests/package/test_lxc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/support/testing/tests/package/test_lxc.py b/support/testing/tests/package/test_lxc.py index 5be4782e2d..770cd10f30 100644 --- a/support/testing/tests/package/test_lxc.py +++ b/support/testing/tests/package/test_lxc.py @@ -33,9 +33,8 @@ class TestLxc(infra.basetest.BRTest): self.assertRunOk(cmd, 120) def wait_boot(self): - # the complete boot with systemd takes more time than what the default multipler permits - self.emulator.timeout_multiplier *= 10 - self.emulator.login() + # the complete boot with systemd takes more time than what the default multiplier permits + self.emulator.login(timeout=600) def setup_run_test_container(self): self.run_ok("lxc-create -n lxc_iperf3 -t none -f /usr/share/lxc/config/minimal-iperf3.conf") -- 2.41.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 3/5] test_lxc.py: use timeout argument for emulator.login 2023-11-05 21:52 ` [Buildroot] [PATCH 3/5] test_lxc.py: " Adam Duskett @ 2023-11-10 11:51 ` Peter Korsgaard 0 siblings, 0 replies; 11+ messages in thread From: Peter Korsgaard @ 2023-11-10 11:51 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot >>>>> "Adam" == Adam Duskett <adam.duskett@amarulasolutions.com> writes: > self.emulator.timeout_multiplier *= 10 is equivilent to 60 * 10 or 600. > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> Committed to 2023.02.x and 2023.08.x, thanks. -- Bye, Peter Korsgaard _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation. 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett 2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett 2023-11-05 21:52 ` [Buildroot] [PATCH 3/5] test_lxc.py: " Adam Duskett @ 2023-11-05 21:52 ` Adam Duskett 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 5/5] support/testing/tests/package/test_firewalld.py: new test Adam Duskett ` (2 subsequent siblings) 5 siblings, 1 reply; 11+ messages in thread From: Adam Duskett @ 2023-11-05 21:52 UTC (permalink / raw) To: buildroot; +Cc: Adam Duskett timeout = 35 * self.emulator.timeout_multiplier [...] self.assertRunOk(cmd, timeout=timeout) Gets re-multiplied by self.emulator.timeout_multiplier in self.emulator.run(). Drop multiplying the timeout by self.emulator.timeout_multiplier to fix this issue. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- support/testing/tests/package/test_python_django.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/testing/tests/package/test_python_django.py b/support/testing/tests/package/test_python_django.py index 0b7d35bb6a..e1ca50f6d8 100644 --- a/support/testing/tests/package/test_python_django.py +++ b/support/testing/tests/package/test_python_django.py @@ -6,7 +6,7 @@ class TestPythonDjango(TestPythonPackageBase): sample_scripts = ["tests/package/sample_python_django.py"] def run_sample_scripts(self): - timeout = 35 * self.emulator.timeout_multiplier + timeout = 35 cmd = "cd /opt && /usr/bin/django-admin startproject testsite" self.assertRunOk(cmd, timeout=timeout) -- 2.41.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation. 2023-11-05 21:52 ` [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation Adam Duskett @ 2023-11-10 11:51 ` Peter Korsgaard 0 siblings, 0 replies; 11+ messages in thread From: Peter Korsgaard @ 2023-11-10 11:51 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot >>>>> "Adam" == Adam Duskett <adam.duskett@amarulasolutions.com> writes: > timeout = 35 * self.emulator.timeout_multiplier > [...] > self.assertRunOk(cmd, timeout=timeout) > Gets re-multiplied by self.emulator.timeout_multiplier in self.emulator.run(). > Drop multiplying the timeout by self.emulator.timeout_multiplier to fix this > issue. > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> Committed to 2023.02.x and 2023.08.x, thanks. -- Bye, Peter Korsgaard _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH 5/5] support/testing/tests/package/test_firewalld.py: new test 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett ` (2 preceding siblings ...) 2023-11-05 21:52 ` [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation Adam Duskett @ 2023-11-05 21:52 ` Adam Duskett 2023-11-06 19:44 ` [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard 5 siblings, 0 replies; 11+ messages in thread From: Adam Duskett @ 2023-11-05 21:52 UTC (permalink / raw) To: buildroot; +Cc: Adam Duskett 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 | 102 ++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 support/testing/tests/package/test_firewalld.py diff --git a/DEVELOPERS b/DEVELOPERS index d096ab0449..47cebfef72 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -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> diff --git a/support/testing/tests/package/test_firewalld.py b/support/testing/tests/package/test_firewalld.py new file mode 100644 index 0000000000..700337f637 --- /dev/null +++ b/support/testing/tests/package/test_firewalld.py @@ -0,0 +1,102 @@ +"""Test firewalld for both systemd and sysvinit.""" +import os +import time +import infra.basetest + + +class TestFirewalldSystemd(infra.basetest.BRTest): + """Build the kernel as firewalld requires several the nftable options.""" + + config = """ + BR2_arm=y + BR2_cortex_a9=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y + BR2_INIT_SYSTEMD=y + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.61" + 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.login(timeout=120) + + # It may take some time for firewalld to finish startup. + # Give it at least 15 seconds. + is_active = False + for i in range(15): + output, _ = self.emulator.run("systemctl is-active firewalld") + if output[0] == "active": + is_active = True + break + time.sleep(1) + if not is_active: + self.fail("firewalld failed to activate!") + + 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.""" + + config = """ + BR2_arm=y + BR2_cortex_a9=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.61" + 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.login(timeout=120) + cmd = "firewall-cmd --state" + output, exit_code = self.emulator.run(cmd, timeout=10) + self.assertIn("running", output[0]) + self.assertEqual(exit_code, 0) -- 2.41.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett ` (3 preceding siblings ...) 2023-11-05 21:52 ` [Buildroot] [PATCH 5/5] support/testing/tests/package/test_firewalld.py: new test Adam Duskett @ 2023-11-06 19:44 ` Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard 5 siblings, 0 replies; 11+ messages in thread From: Thomas Petazzoni via buildroot @ 2023-11-06 19:44 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot On Sun, 5 Nov 2023 14:52:17 -0700 Adam Duskett <adam.duskett@amarulasolutions.com> wrote: > to override the current value of 60 seconds > > As per a suggestion by Thomas, add a timeout argument to override the current > value of 60 seconds for the emulator.login method. > > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> > --- > support/testing/infra/emulator.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Series applied. I just did a minor change on PATCH 2/5 and 3/5, I will comment on PATCH 2/5 as the minor change is the same on both patches. Thanks! Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett ` (4 preceding siblings ...) 2023-11-06 19:44 ` [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Thomas Petazzoni via buildroot @ 2023-11-10 11:51 ` Peter Korsgaard 5 siblings, 0 replies; 11+ messages in thread From: Peter Korsgaard @ 2023-11-10 11:51 UTC (permalink / raw) To: Adam Duskett; +Cc: buildroot >>>>> "Adam" == Adam Duskett <adam.duskett@amarulasolutions.com> writes: > to override the current value of 60 seconds > As per a suggestion by Thomas, add a timeout argument to override the current > value of 60 seconds for the emulator.login method. > Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> Committed to 2023.02.x and 2023.08.x, thanks. -- Bye, Peter Korsgaard _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-11-10 11:52 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-11-05 21:52 [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Adam Duskett 2023-11-05 21:52 ` [Buildroot] [PATCH 2/5] test_systemd_selinux.py: use timeout argument for emulator.login Adam Duskett 2023-11-06 19:45 ` Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 3/5] test_lxc.py: " Adam Duskett 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 4/5] test_python_django.py: fix timeout calculation Adam Duskett 2023-11-10 11:51 ` Peter Korsgaard 2023-11-05 21:52 ` [Buildroot] [PATCH 5/5] support/testing/tests/package/test_firewalld.py: new test Adam Duskett 2023-11-06 19:44 ` [Buildroot] [PATCH 1/5] support/testing/infra/emulator.py: add a timeout argument for the login method Thomas Petazzoni via buildroot 2023-11-10 11:51 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox