diff mbox series

[v2,10/15] selftest/cases/runtime_test: Add test for Linux Rust sample

Message ID 20251230141540.1974380-11-Harish.Sadineni@windriver.com
State Changes Requested
Headers show
Series Enable rust support for linux kernel | expand

Commit Message

Harish Sadineni Dec. 30, 2025, 2:15 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

This new case tests that the rust_mininal sample inside the kernel source
tree is buildable and works properly: check that the module can be
loaded and that it prints correctly.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Mathieu Dubois-Briand Jan. 5, 2026, 9:32 a.m. UTC | #1
On Tue Dec 30, 2025 at 3:15 PM CET, Harish via lists.openembedded.org Sadineni wrote:
> From: Yoann Congal <yoann.congal@smile.fr>
>
> This new case tests that the rust_mininal sample inside the kernel source
> tree is buildable and works properly: check that the module can be
> loaded and that it prints correctly.
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---

Hi Yoann, Harish,

Thanks for your patch.

It looks like we got a few intermittent failures here:

2026-01-02 19:40:58,816 - oe-selftest - INFO - FAIL: runtime_test.RustKernel.test_kernel_rust_sample (subunit.RemotedTestCase)
2026-01-02 19:40:58,816 - oe-selftest - INFO - ----------------------------------------------------------------------
2026-01-02 19:40:58,816 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/runtime_test.py", line 514, in test_kernel_rust_sample
    self.assertEqual(status, 1, "Loading rust_out_of_tree module failed!")
  File "/usr/lib/python3.10/unittest/case.py", line 845, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.10/unittest/case.py", line 838, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: 0 != 1 : Loading rust_out_of_tree module failed!

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3082
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3095

I only saw two occurrences so far, on at least 10 builds, but maybe you
can check for obvious reasons before the series get merged.

Thanks,
Mathieu
Yoann Congal Jan. 8, 2026, 9:39 a.m. UTC | #2
Le lun. 5 janv. 2026 à 10:32, Mathieu Dubois-Briand <
mathieu.dubois-briand@bootlin.com> a écrit :

> On Tue Dec 30, 2025 at 3:15 PM CET, Harish via lists.openembedded.org
> Sadineni wrote:
> > From: Yoann Congal <yoann.congal@smile.fr>
> >
> > This new case tests that the rust_mininal sample inside the kernel source
> > tree is buildable and works properly: check that the module can be
> > loaded and that it prints correctly.
> >
> > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> > Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> > ---
>
> Hi Yoann, Harish,
>
> Thanks for your patch.
>
> It looks like we got a few intermittent failures here:
>
> 2026-01-02 19:40:58,816 - oe-selftest - INFO - FAIL:
> runtime_test.RustKernel.test_kernel_rust_sample (subunit.RemotedTestCase)
> 2026-01-02 19:40:58,816 - oe-selftest - INFO -
> ----------------------------------------------------------------------
> 2026-01-02 19:40:58,816 - oe-selftest - INFO -
> testtools.testresult.real._StringException: Traceback (most recent call
> last):
>   File
> "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/runtime_test.py",
> line 514, in test_kernel_rust_sample
>     self.assertEqual(status, 1, "Loading rust_out_of_tree module failed!")
>   File "/usr/lib/python3.10/unittest/case.py", line 845, in assertEqual
>     assertion_func(first, second, msg=msg)
>   File "/usr/lib/python3.10/unittest/case.py", line 838, in
> _baseAssertEqual
>     raise self.failureException(msg)
> AssertionError: 0 != 1 : Loading rust_out_of_tree module failed!
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3082
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3095

Those are both from ARM hosts and, sadly, there are no logs to explain why
it failed :(
Harish, is this something you can test on your side?


> I only saw two occurrences so far, on at least 10 builds, but maybe you
> can check for obvious reasons before the series get merged.
>
> Thanks,
> Mathieu
>
> --
> Mathieu Dubois-Briand, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index d58ffa80f5..e8374606a4 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -481,3 +481,28 @@  IMAGE_INSTALL:append = " systemtap-runtime"
                 cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples
                 result = runCmd(cmd)
                 self.assertEqual(0, result.status, 'crosstap  syscalls_by_pid returned a non 0 status:%s' % result.output)
+
+@OETestTag("runqemu")
+class RustKernel(OESelftestTestCase):
+        @classmethod
+        def setUpClass(cls):
+            super(RustKernel, cls).setUpClass()
+            cls.image = "core-image-minimal"
+
+        def test_kernel_rust_sample(self):
+            import textwrap
+            self.write_config(textwrap.dedent("""
+                DISTRO_FEATURES:append = ' rust-kernel'
+                KERNEL_EXTRA_FEATURES:append = ' features/kernel-sample/kernel-rust-sample.scc'
+                CORE_IMAGE_EXTRA_INSTALL += "kernel-module-rust-minimal"
+            """))
+            bitbake(self.image)
+
+            with runqemu(self.image, runqemuparams = "nographic") as qemu:
+                qemu.run_serial("dmesg -c > /dev/null")
+                status, _ = qemu.run_serial("modprobe rust_minimal")
+                self.assertEqual(status, 1, "Loading rust_minimal module failed!")
+                _, output = qemu.run_serial("dmesg")
+                self.logger.debug(f"rust_minimal dmesg output:\n" + textwrap.indent(output, "  "))
+                self.assertIn("Rust minimal sample", output, "Kernel Rust sample expected output not found in dmesg")
+