blob: 31036f0f14a403b55e5601df6cb5cad46147e357 [file] [log] [blame]
Patrick Williamsdb4c27e2022-08-05 08:10:29 -05001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Patrick Williamsdb4c27e2022-08-05 08:10:29 -05004# SPDX-License-Identifier: MIT
5#
6
7import os
8import shutil
9import unittest
10
11from oeqa.core.utils.path import remove_safe
12from oeqa.sdk.case import OESDKTestCase
13
14from oeqa.utils.subprocesstweak import errors_have_output
15errors_have_output()
16
17class RustCompileTest(OESDKTestCase):
18 td_vars = ['MACHINE']
19
20 @classmethod
21 def setUpClass(self):
22 targetdir = os.path.join(self.tc.sdk_dir, "hello")
23 try:
24 shutil.rmtree(targetdir)
25 except FileNotFoundError:
26 pass
27 shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), targetdir)
28
29 def setUp(self):
30 machine = self.td.get("MACHINE")
31 if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine):
32 raise unittest.SkipTest("RustCompileTest class: SDK doesn't contain a Rust cross-canadian toolchain")
33
34 def test_cargo_build(self):
35 self._run('cd %s/hello; cargo build' % self.tc.sdk_dir)