diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2022-07-20 16:06:01 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-28 11:07:33 +0100 |
commit | 1e3e20e92e3c1d0fd97eaa9660cfb57808af8948 (patch) | |
tree | 8ccaf368209bc1287e5ec6ff7a988996d997708f /meta/lib/oeqa/sdk | |
parent | 5bb7d810f039812e9c963309ef81c4e6dc1c9e66 (diff) | |
download | poky-1e3e20e92e3c1d0fd97eaa9660cfb57808af8948.tar.gz |
oeqa/sdk: Add basic rust cargo test
Add a QA test to the SDK to test that a basic cargo build works.
[RP: Tweaked to work for multilibs and updated to match toolchain changes]
(From OE-Core rev: d0cfe587bc897e79ef01805cc9a42fbca28c883c)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/rust.py | 33 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml | 6 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/files/rust/hello/src/main.rs | 3 |
3 files changed, 42 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/rust.py b/meta/lib/oeqa/sdk/cases/rust.py new file mode 100644 index 0000000000..c122b64d0c --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/rust.py | |||
@@ -0,0 +1,33 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: MIT | ||
3 | # | ||
4 | |||
5 | import os | ||
6 | import shutil | ||
7 | import unittest | ||
8 | |||
9 | from oeqa.core.utils.path import remove_safe | ||
10 | from oeqa.sdk.case import OESDKTestCase | ||
11 | |||
12 | from oeqa.utils.subprocesstweak import errors_have_output | ||
13 | errors_have_output() | ||
14 | |||
15 | class RustCompileTest(OESDKTestCase): | ||
16 | td_vars = ['MACHINE'] | ||
17 | |||
18 | @classmethod | ||
19 | def setUpClass(self): | ||
20 | targetdir = os.path.join(self.tc.sdk_dir, "hello") | ||
21 | try: | ||
22 | os.removedirs(targetdir) | ||
23 | except OSError: | ||
24 | pass | ||
25 | shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), targetdir) | ||
26 | |||
27 | def setUp(self): | ||
28 | machine = self.td.get("MACHINE") | ||
29 | if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine): | ||
30 | raise unittest.SkipTest("RustCompileTest class: SDK doesn't contain a Rust cross-canadian toolchain") | ||
31 | |||
32 | def test_cargo_build(self): | ||
33 | self._run('cd %s/hello; cargo build' % self.tc.sdk_dir) | ||
diff --git a/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml b/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml new file mode 100644 index 0000000000..fe619478a6 --- /dev/null +++ b/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml | |||
@@ -0,0 +1,6 @@ | |||
1 | [package] | ||
2 | name = "hello" | ||
3 | version = "0.1.0" | ||
4 | edition = "2021" | ||
5 | |||
6 | [dependencies] | ||
diff --git a/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs b/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs new file mode 100644 index 0000000000..a06c03f82a --- /dev/null +++ b/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | println!("Hello, OpenEmbedded world!"); | ||
3 | } | ||