Add a QA test to the SDK to test that a basic cargo build works for the
SDK host.

Signed-off-by: Sean Nyekjaer <s...@geanix.com>
---
I know that `cargo build` and `cargo run` is kinda redundant for the `cargo
run` command. But I guess it's easier to see whats happening here...

 meta/lib/oeqa/sdk/cases/rust.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/meta/lib/oeqa/sdk/cases/rust.py b/meta/lib/oeqa/sdk/cases/rust.py
index 31036f0f14..9404078b1d 100644
--- a/meta/lib/oeqa/sdk/cases/rust.py
+++ b/meta/lib/oeqa/sdk/cases/rust.py
@@ -33,3 +33,25 @@ class RustCompileTest(OESDKTestCase):
 
     def test_cargo_build(self):
         self._run('cd %s/hello; cargo build' % self.tc.sdk_dir)
+
+class RustHostCompileTest(OESDKTestCase):
+    td_vars = ['MACHINE', 'SDKMACHINE']
+
+    @classmethod
+    def setUpClass(self):
+        targetdir = os.path.join(self.tc.sdk_dir, "hello")
+        try:
+            shutil.rmtree(targetdir)
+        except FileNotFoundError:
+            pass
+        shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), 
targetdir)
+
+    def setUp(self):
+        machine = self.td.get("MACHINE")
+        if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % 
machine):
+            raise unittest.SkipTest("RustCompileTest class: SDK doesn't 
contain a Rust cross-canadian toolchain")
+
+    def test_cargo_build(self):
+        machine = self.td.get("SDKMACHINE")
+        self._run('cd %s/hello; cargo build --target %s-oesdk-linux-gnu' % 
(self.tc.sdk_dir, machine))
+        self._run('cd %s/hello; cargo run --target %s-oesdk-linux-gnu' % 
(self.tc.sdk_dir, machine))
-- 
2.42.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#188398): 
https://lists.openembedded.org/g/openembedded-core/message/188398
Mute This Topic: https://lists.openembedded.org/mt/101654700/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to