Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Sean Nyekjaer <sean@geanix.com>
To: openembedded-core@lists.openembedded.org
Cc: Sean Nyekjaer <sean@geanix.com>,
	kasper@krinvent.dk, alex.kanavin@gmail.com
Subject: [OE-core][PATCH 3/3] oeqa/sdk/rust: Add build and run test of rust binary with SDK host
Date: Fri, 29 Sep 2023 12:19:23 +0200	[thread overview]
Message-ID: <20230929101925.1442545-3-sean@geanix.com> (raw)
In-Reply-To: <20230929101925.1442545-1-sean@geanix.com>

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

Signed-off-by: Sean Nyekjaer <sean@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



  parent reply	other threads:[~2023-09-29 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 10:19 [OE-core][PATCH 1/3] rust-cross-canadian: set CARGO_TARGET_<triple>_RUSTFLAGS Sean Nyekjaer
2023-09-29 10:19 ` [OE-core][PATCH 2/3] rust-cross-canadian: set CARGO_TARGET_<triple>_RUNNER for nativesdk Sean Nyekjaer
2023-09-29 10:19 ` Sean Nyekjaer [this message]
2023-09-30 10:45 ` [OE-core][PATCH 1/3] rust-cross-canadian: set CARGO_TARGET_<triple>_RUSTFLAGS Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230929101925.1442545-3-sean@geanix.com \
    --to=sean@geanix.com \
    --cc=alex.kanavin@gmail.com \
    --cc=kasper@krinvent.dk \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox