Skip to contentSkip to conversation

support/testing: new rt-tests runtime test

PATCH Applied Julien Olivain 2 participants 3 messages Jul 2, 2024 – Jul 4, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/testing: new rt-tests runtime test

---
Patch tested on branch master at commit b2c2c48 with commands:

    utils/docker-run make check-package
    ...
    0 warnings generated

    python3 -m flake8 \
        support/testing/tests/package/test_rt_tests.py
    [no-output]

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_rt_tests
    ...
    OK
---
 DEVELOPERS                                    |  1 +
 .../testing/tests/package/test_rt_tests.py    | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 support/testing/tests/package/test_rt_tests.py
DEVELOPERS +1 -0
index 6d9fcd97dfe..90d1a111ab4 100644
@@ -1893,6 +1893,7 @@ F:	support/testing/tests/package/test_python_spake2.py
 F:	support/testing/tests/package/test_python_sympy.py
 F:	support/testing/tests/package/test_rdma_core.py
 F:	support/testing/tests/package/test_rdma_core/
+F:	support/testing/tests/package/test_rt_tests.py
 F:	support/testing/tests/package/test_screen.py
 F:	support/testing/tests/package/test_sed.py
 F:	support/testing/tests/package/test_socat.py
support/testing/tests/package/test_rt_tests.py new file +39 -0
new file mode 100644
index 00000000000..0795d7afd2f
@@ -0,0 +1,39 @@
+import os
+
+import infra.basetest
+
+
+class TestRtTests(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_RT_TESTS=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")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        # We cannot easily test realtime properties in a CI/emulator
+        # environment. Instead, this test runs few rt-tests programs
+        # in small scenario configurations (to make sure the execution
+        # will remain short). It just makes sure the execution returns
+        # a success code. Also, to avoid making the logs too big, we
+        # generally pass the "--quiet" option to have a summary at the
+        # end of the execution.
+        test_cmds = [
+            "cyclictest --quiet --loops=200",
+            "hackbench --fds=2 --groups=3 --loops=5",
+            "pi_stress --inversions=100",
+            "ptsematest --quiet --loops=100",
+            "rt-migrate-test --quiet --loops=5",
+            "signaltest --quiet --loops=200",
+            "sigwaittest --quiet --loops=100"
+        ]
+
+        for cmd in test_cmds:
+            self.assertRunOk(cmd)
Signature · 6 lines
2.45.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Julien,

Le 02/07/2024 à 15:19, Julien Olivain a écrit :

Quoted 58 lines

---
Patch tested on branch master at commit b2c2c48 with commands:

    utils/docker-run make check-package
    ...
    0 warnings generated

    python3 -m flake8 \
        support/testing/tests/package/test_rt_tests.py
    [no-output]

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_rt_tests
    ...
    OK
---
 DEVELOPERS                                    |  1 +
 .../testing/tests/package/test_rt_tests.py    | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 support/testing/tests/package/test_rt_tests.py
DEVELOPERS +1 -0
index 6d9fcd97dfe..90d1a111ab4 100644
@@ -1893,6 +1893,7 @@ F:	support/testing/tests/package/test_python_spake2.py
 F:	support/testing/tests/package/test_python_sympy.py
 F:	support/testing/tests/package/test_rdma_core.py
 F:	support/testing/tests/package/test_rdma_core/
+F:	support/testing/tests/package/test_rt_tests.py
 F:	support/testing/tests/package/test_screen.py
 F:	support/testing/tests/package/test_sed.py
 F:	support/testing/tests/package/test_socat.py
support/testing/tests/package/test_rt_tests.py new file +17 -0
new file mode 100644
index 00000000000..0795d7afd2f
@@ -0,0 +1,39 @@
+import os
+
+import infra.basetest
+
+
+class TestRtTests(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_RT_TESTS=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")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",

support/testing/tests/package/test_rt_tests.py line 27

Quoted 10 lines
support/testing/tests/package/test_rt_tests.py new file +10 -0
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        # We cannot easily test realtime properties in a CI/emulator
+        # environment. Instead, this test runs few rt-tests programs
+        # in small scenario configurations (to make sure the execution
+        # will remain short). It just makes sure the execution returns
+        # a success code. Also, to avoid making the logs too big, we
+        # generally pass the "--quiet" option to have a summary at the
+        # end of the execution.

Running rt-tests tools on slow Gitlab-ci runners, what can go wrong? :)

Tested locally (on a laptop) before applying.

Applied to master, thanks.

Best regards,
Romain

support/testing/tests/package/test_rt_tests.py line 39

Quoted 12 lines
support/testing/tests/package/test_rt_tests.py new file +12 -0
+        test_cmds = [
+            "cyclictest --quiet --loops=200",
+            "hackbench --fds=2 --groups=3 --loops=5",
+            "pi_stress --inversions=100",
+            "ptsematest --quiet --loops=100",
+            "rt-migrate-test --quiet --loops=5",
+            "signaltest --quiet --loops=200",
+            "sigwaittest --quiet --loops=100"
+        ]
+
+        for cmd in test_cmds:
+            self.assertRunOk(cmd)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Romain,

Quoted 4 lines · Romain Naour

Hello Julien,

Le 02/07/2024 à 15:19, Julien Olivain a écrit :

Quoted 1 line

[...]

Quoted 11 lines
Quoted 10 lines
support/testing/tests/package/test_rt_tests.py new file +3 -0
+        # We cannot easily test realtime properties in a CI/emulator
+        # environment. Instead, this test runs few rt-tests programs
+        # in small scenario configurations (to make sure the 

execution
+ # will remain short). It just makes sure the execution
returns

(quoted diff) +2 -0
+        # a success code. Also, to avoid making the logs too big, we
+        # generally pass the "--quiet" option to have a summary at 

the
+ # end of the execution.

Quoted 1 line

Running rt-tests tools on slow Gitlab-ci runners, what can go wrong? :)

Technically, we could probably do some accurate realtime tests in a CI environment with slow runners, with the right Kernel config and using the qemu -icount option. But I chose to keep this test simple and only check if the Buildroot recipe was generating working binaries...

See Qemu doc:
https://www.qemu.org/docs/master/system/invocation.html

I'm mentioning that in case we need an actual realtime runtime test, in the future...

Quoted 6 lines

Tested locally (on a laptop) before applying.

Applied to master, thanks.

Best regards,
Romain

Best regards,

Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot