oeqa/runtime/rust: Add basic compile/run test

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alex Kiernan
2022-12-21 12:52:56 +00:00
committed by Richard Purdie
parent eac47bff70
commit 79e57d41d2
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
fn main() {
}

View 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'])