Signed-off-by: Vinay Kumar <[email protected]>
---
 meta/lib/oeqa/selftest/cases/rust.py | 43 ++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 meta/lib/oeqa/selftest/cases/rust.py

diff --git a/meta/lib/oeqa/selftest/cases/rust.py 
b/meta/lib/oeqa/selftest/cases/rust.py
new file mode 100644
index 0000000000..62851256c2
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: MIT
+import os
+from oeqa.core.decorator import OETestTag
+from oeqa.core.case import OEPTestResultTestCase
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, 
Command
+
+class RustSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
+
+       def run_check(self, *suites, ssh = None):
+               # configure ssh target
+               features = []
+               if ssh is not None:
+                       features.append('TOOLCHAIN_TEST_TARGET = "ssh"')
+                       features.append('TOOLCHAIN_TEST_HOST = 
"{0}"'.format(ssh))
+                       features.append('TOOLCHAIN_TEST_HOST_USER = "root"')
+                       features.append('TOOLCHAIN_TEST_HOST_PORT = "22"')
+               self.write_config("\n".join(features))
+
+               # Start testing once the remote-test-server is ready and image 
is booted.
+               recipe = "rust-test"
+               bitbake("{} -c check".format(recipe))
+
+       def run_check_emulated(self, *args, **kwargs):
+               # build remote-test-server before image build
+               recipe = "rust-test"    
+               bitbake("{} -c compile".format(recipe))
+
+               # build core-image-minimal with required packages
+               default_installed_packages = ["libgcc", "libstdc++", 
"libatomic", "libgomp"]
+               features = []
+               features.append('IMAGE_FEATURES += "ssh-server-openssh"')
+               features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" 
".join(default_installed_packages)))
+               self.write_config("\n".join(features))
+               bitbake("core-image-minimal")
+               # wrap the execution with a qemu instance
+               with runqemu("core-image-minimal", runqemuparams = "nographic 
slirp") as qemu:
+                       return self.run_check(*args, ssh=qemu.ip, **kwargs)
+
+@OETestTag("toolchain-system")
+class RustSelfTestSystemEmulated(RustSelfTestBase):
+       def test_rust(self):
+               self.run_check_emulated("rust")
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#150464): 
https://lists.openembedded.org/g/openembedded-core/message/150464
Mute This Topic: https://lists.openembedded.org/mt/82112823/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to