mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 21:32:12 +02:00
oeqa/sdk/rust: Add build and run test of rust binary with SDK host
Add a QA test to the SDK to test that a basic cargo build works for the SDK host. (From OE-Core rev: 7f05760debd3aeb69c3294f3ceb92d4f1aceec1f) Signed-off-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
1a44c1ad59
commit
96310a5867
@@ -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', 'SDK_SYS']
|
||||
|
||||
@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):
|
||||
sdksys = self.td.get("SDK_SYS")
|
||||
self._run('cd %s/hello; cargo build --target %s-gnu' % (self.tc.sdk_dir, sdksys))
|
||||
self._run('cd %s/hello; cargo run --target %s-gnu' % (self.tc.sdk_dir, sdksys))
|
||||
|
||||
Reference in New Issue
Block a user