]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
oeqa/runtime/rust: Add basic compile/run test
authorAlex Kiernan <alex.kiernan@gmail.com>
Wed, 21 Dec 2022 12:52:56 +0000 (12:52 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 26 Dec 2022 10:29:04 +0000 (10:29 +0000)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/files/test.rs [new file with mode: 0644]
meta/lib/oeqa/runtime/cases/rust.py

diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs
new file mode 100644 (file)
index 0000000..f79c691
--- /dev/null
@@ -0,0 +1,2 @@
+fn main() {
+}
index 55b280d61d8aa894a1613057ff0e6c339b990b78..186bb0d79e154a76ecba2469f7c2a9b590cb516f 100644 (file)
@@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase
 from oeqa.core.decorator.depends import OETestDepends
 from oeqa.runtime.decorator.package import OEHasPackage
 
+class RustCompileTest(OERuntimeTestCase):
+
+    @classmethod
+    def setUp(cls):
+        dst = '/tmp/'
+        src = os.path.join(cls.tc.files_dir, 'test.rs')
+        cls.tc.target.copyTo(src, dst)
+
+    @classmethod
+    def tearDown(cls):
+        files = '/tmp/test.rs /tmp/test'
+        cls.tc.target.run('rm %s' % files)
+
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    @OEHasPackage(['rust'])
+    def test_rust_compile(self):
+        status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test')
+        msg = 'rust compile failed, output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
+        status, output = self.target.run('/tmp/test')
+        msg = 'running compiled file failed, output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
+
 class RustHelloworldTest(OERuntimeTestCase):
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(['rust-hello-world'])