diff options
-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 | } | ||