blob: 1075d37b49ebe3e9d604c9f2c00fbe414fa81b4f [file] [log] [blame]
Patrick Williamsdb4c27e2022-08-05 08:10:29 -05001#
2# SPDX-License-Identifier: MIT
3#
4
5import os
6import shutil
7import unittest
8
9from oeqa.core.utils.path import remove_safe
10from oeqa.sdk.case import OESDKTestCase
11
12from oeqa.utils.subprocesstweak import errors_have_output
13errors_have_output()
14
15class 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 shutil.rmtree(targetdir)
23 except FileNotFoundError:
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)