diff options
author | Alex Kiernan <alex.kiernan@gmail.com> | 2022-12-21 12:52:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-23 12:04:44 +0000 |
commit | 79e57d41d2febbbd6c66622fd8376ef97c584621 (patch) | |
tree | 4b91d159fda4400c601cb7feb7cdc0a73edba52c /meta | |
parent | eac47bff704f9169237f68d48ac3726ccf97de3d (diff) | |
download | poky-79e57d41d2febbbd6c66622fd8376ef97c584621.tar.gz |
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>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/files/test.rs | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/cases/rust.py | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs new file mode 100644 index 0000000000..f79c691f08 --- /dev/null +++ b/meta/lib/oeqa/files/test.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn main() { | ||
2 | } | ||
diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py index 55b280d61d..186bb0d79e 100644 --- a/meta/lib/oeqa/runtime/cases/rust.py +++ b/meta/lib/oeqa/runtime/cases/rust.py | |||
@@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase | |||
8 | from oeqa.core.decorator.depends import OETestDepends | 8 | from oeqa.core.decorator.depends import OETestDepends |
9 | from oeqa.runtime.decorator.package import OEHasPackage | 9 | from oeqa.runtime.decorator.package import OEHasPackage |
10 | 10 | ||
11 | class RustCompileTest(OERuntimeTestCase): | ||
12 | |||
13 | @classmethod | ||
14 | def setUp(cls): | ||
15 | dst = '/tmp/' | ||
16 | src = os.path.join(cls.tc.files_dir, 'test.rs') | ||
17 | cls.tc.target.copyTo(src, dst) | ||
18 | |||
19 | @classmethod | ||
20 | def tearDown(cls): | ||
21 | files = '/tmp/test.rs /tmp/test' | ||
22 | cls.tc.target.run('rm %s' % files) | ||
23 | |||
24 | @OETestDepends(['ssh.SSHTest.test_ssh']) | ||
25 | @OEHasPackage(['rust']) | ||
26 | def test_rust_compile(self): | ||
27 | status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test') | ||
28 | msg = 'rust compile failed, output: %s' % output | ||
29 | self.assertEqual(status, 0, msg=msg) | ||
30 | |||
31 | status, output = self.target.run('/tmp/test') | ||
32 | msg = 'running compiled file failed, output: %s' % output | ||
33 | self.assertEqual(status, 0, msg=msg) | ||
34 | |||
11 | class RustHelloworldTest(OERuntimeTestCase): | 35 | class RustHelloworldTest(OERuntimeTestCase): |
12 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 36 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
13 | @OEHasPackage(['rust-hello-world']) | 37 | @OEHasPackage(['rust-hello-world']) |