Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v2 1/3] Rust oe-selftest script
@ 2021-09-29  8:04 Pgowda
  2021-09-29  8:04 ` [PATCH v2 2/3] Rust cross testing file Pgowda
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Pgowda @ 2021-09-29  8:04 UTC (permalink / raw)
  To: openembedded-core
  Cc: richard.purdie, rwmacleod, alex.kanavin, umesh.kalappa0,
	vinay.m.engg, Pgowda

The file builds remote-test-server and executes rust testing
remotely using background ssh. It adds the necessary test environment
and variables to run the rust oe-selftest.

Print the results in case of failure of runCmd().

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
 meta/lib/oeqa/selftest/cases/rust.py | 53 ++++++++++++++++++++++++++++
 1 file changed, 53 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..7978758221
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: MIT
+import os
+import subprocess
+from oeqa.core.decorator import OETestTag
+from oeqa.core.case import OEPTestResultTestCase
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu, Command
+from oeqa.utils.sshcontrol import SSHControl
+
+# Total time taken for testing is of about 2hr 20min, with PARALLEL_MAKE set to 40 number of jobs.
+class RustSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
+
+	def run_check_emulated(self, *args, **kwargs):
+		# build remote-test-server before image build
+		recipe = "rust-testsuite"
+		bitbake("{} -c compile".format(recipe))
+		builddir = get_bb_var("B", "rust-testsuite")
+		# 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", qemuparams = "-m 512") as qemu:
+			# Copy remote-test-server to image through scp
+			ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user="root")
+			ssh.copy_to(builddir + "/" + "build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server","~/")
+			# Execute remote-test-server on image through background ssh
+			command = '~/remote-test-server -v remote'
+			sshrun=subprocess.Popen(("ssh", '-o',  'UserKnownHostsFile=/dev/null', '-o',  'StrictHostKeyChecking=no', '-f', "root@%s" % qemu.ip, command),
+                                shell=False,
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE)
+			# Get the values of variables.
+			targetsys = get_bb_var("TARGET_SYS", "rust-testsuite")
+			rustlibpath = get_bb_var("STAGING_LIBDIR_NATIVE", "rust-testsuite")
+			tmpdir = get_bb_var("TMPDIR", "rust-testsuite")
+			testargs = "--no-fail-fast --bless"
+			# Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools.
+			cmd = " export PATH=%s/../bin:$PATH;" % rustlibpath
+			cmd = cmd + " export PATH=%s/../bin/%s:%s/hosttools:$PATH;" % (rustlibpath, targetsys, tmpdir)
+			cmd = cmd + " export RUST_TARGET_PATH=%s/rustlib;" % rustlibpath
+			# Trigger testing.
+			cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip
+			cmd = cmd + " cd %s;  python3 src/bootstrap/bootstrap.py test %s --target %s ;" % (builddir, testargs, targetsys)
+			result = runCmd(cmd)
+
+@OETestTag("toolchain-system")
+class RustSelfTestSystemEmulated(RustSelfTestBase):
+	def test_rust(self):
+		self.run_check_emulated("rust")
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-11-26 18:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-29  8:04 [PATCH v2 1/3] Rust oe-selftest script Pgowda
2021-09-29  8:04 ` [PATCH v2 2/3] Rust cross testing file Pgowda
2021-09-29 23:03   ` [OE-core] " Alexandre Belloni
2021-09-30  7:27     ` [PATCH v3] " Pgowda
     [not found]     ` <16A988E1BC842A91.3292@lists.openembedded.org>
2021-10-20  7:08       ` pgowda cve
2021-10-20  7:42         ` Alexandre Belloni
2021-11-02  5:12           ` pgowda cve
2021-11-26 18:34             ` Randy MacLeod
2021-09-29  8:04 ` [PATCH v2 3/3] Rust oe-selftest file Pgowda
2021-09-29 22:59   ` [OE-core] " Alexandre Belloni
2021-09-30  4:31     ` pgowda cve
2021-10-05 16:13       ` Randy MacLeod
2021-10-05 16:21         ` Alexandre Belloni
2021-10-05 18:19 ` [OE-core] [PATCH v2 1/3] Rust oe-selftest script Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox