]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
rust-hello-world: test at runtime
authorAlexander Kanavin <alex.kanavin@gmail.com>
Wed, 15 Dec 2021 22:40:13 +0000 (23:40 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 17 Dec 2021 09:56:04 +0000 (09:56 +0000)
This adds a smoke check for whether the rust toolchain actually
produces working executables across a range of architectures.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/testimage.bbclass
meta/lib/oeqa/runtime/cases/rust.py [new file with mode: 0644]
meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb

index 66de0e07c62278bcf0789c1911b77ba270b261a6..1c5fd4ee6a4a43fc763962686bc52733a815ee59 100644 (file)
@@ -61,7 +61,7 @@ BASICTESTSUITE = "\
     ping date df ssh scp python perl gi ptest parselogs \
     logrotate connman systemd oe_syslog pam stap ldd xorg \
     kernelmodule gcc buildcpio buildlzip buildgalculator \
-    dnf rpm opkg apt weston go"
+    dnf rpm opkg apt weston go rust"
 
 DEFAULT_TEST_SUITES = "${BASICTESTSUITE}"
 
diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py
new file mode 100644 (file)
index 0000000..b3d6cf7
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+
+class RustHelloworldTest(OERuntimeTestCase):
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    @OEHasPackage(['rust-hello-world'])
+    def test_rusthelloworld(self):
+        cmd = "rust-hello-world"
+        status, output = self.target.run(cmd)
+        msg = 'Exit status was not 0. Output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
+        msg = 'Incorrect output: %s' % output
+        self.assertEqual(output, "Hello, world!", msg=msg)
index 1fee1c925db4b962e0e134a614c1ed87e3e551de..e05e329020d32514471053d87a6790ff9f4858cb 100644 (file)
@@ -25,6 +25,8 @@ GOTOOLS ?= "go-helloworld"
 GOTOOLS:powerpc ?= ""
 GOTOOLS:riscv32 ?= ""
 
+RUSTTOOLS ?= "rust-hello-world"
+
 GSTEXAMPLES ?= "gst-examples"
 GSTEXAMPLES:riscv64 = ""
 
@@ -57,4 +59,5 @@ RDEPENDS:${PN} = "\
     ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', "${X11GLTOOLS}", "", d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', '3g', "${3GTOOLS}", "", d)} \
     ${GOTOOLS} \
+    ${RUSTTOOLS} \
     "