diff options
author | Tim Orling <ticotimo@gmail.com> | 2023-12-17 14:58:49 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-23 08:43:38 +0000 |
commit | ca7e78c8be6aaa2780702eab54715a74fc0dac5e (patch) | |
tree | 3f12db17bd2f686048584e809740e738c839c9c7 /meta/lib/oeqa/runtime | |
parent | bf0bb7b94ed4930145af5f1fb3836157daceb6bb (diff) | |
download | openembedded-core-ca7e78c8be6aaa2780702eab54715a74fc0dac5e.tar.gz |
oeqa: add runtime 'maturin develop' test case
Similar to the sdk test case, build the "guessing-game" example from
https://maturin.rs/tutorial
This test case:
* creates a python3 venv
* echoes "nameserver 8.8.8.8" to /etc/resolv.conf as we need to have
functional DNS to fetch the crates on target
* fetches crates, builds guessing-game crate and wheel
Put the following in your local.conf:
EXTRA_IMAGE_FEATURES += "tools-sdk"
SDK_INCLUDE_TOOLCHAIN = '1'
SDK_TOOLCHAIN_LANGS += 'rust'
IMAGE_INSTALL:append = " python3-maturin"
IMAGE_CLASSES += "testimage"
TEST_QEMUPARAMS ?= "-m 8192 -smp 4"
IMAGE_ROOTFS_EXTRA_SPACE = "10000000"
NOHDD="1"
NOISO="1"
TEST_SUITES = "ping ssh python maturin"
Test with:
bitbake core-image-full-cmdline
bitbake -c testimage core-image-full-cmdline
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/maturin.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/maturin.py b/meta/lib/oeqa/runtime/cases/maturin.py index b9a3b4acbc..4e6384fe5e 100644 --- a/meta/lib/oeqa/runtime/cases/maturin.py +++ b/meta/lib/oeqa/runtime/cases/maturin.py @@ -10,6 +10,7 @@ from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.runtime.decorator.package import OEHasPackage + class MaturinTest(OERuntimeTestCase): @OETestDepends(['ssh.SSHTest.test_ssh', 'python.PythonTest.test_python3']) @OEHasPackage(['python3-maturin']) @@ -21,3 +22,37 @@ class MaturinTest(OERuntimeTestCase): python_version = "%s.%s" % (py_major, py_minor) self.assertEqual(output, "🐍 1 python interpreter found:\n" " - CPython %s at /usr/bin/python%s" % (python_version, python_version)) + + +class MaturinDevelopTest(OERuntimeTestCase): + @classmethod + def setUp(cls): + dst = '/tmp' + src = os.path.join(cls.tc.files_dir, "maturin/guessing-game") + cls.tc.target.copyTo(src, dst) + + @classmethod + def tearDown(cls): + cls.tc.target.run('rm -rf %s' % '/tmp/guessing-game/target') + + @OETestDepends(['ssh.SSHTest.test_ssh', 'python.PythonTest.test_python3']) + @OEHasPackage(['python3-maturin']) + def test_maturin_develop(self): + """ + This test case requires: + (1) that a .venv can been created. + (2) DNS nameserver to resolve crate URIs for fetching + (3) a functional 'rustc' and 'cargo' + """ + targetdir = os.path.join("/tmp", "guessing-game") + self.target.run("cd %s; python3 -m venv .venv" % targetdir) + self.target.run("echo 'nameserver 8.8.8.8' > /etc/resolv.conf") + cmd = "cd %s; maturin develop" % targetdir + status, output = self.target.run(cmd) + self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8") + self.assertRegex(output, r"🐍 Not using a specific python interpreter") + self.assertRegex(output, r"📡 Using build options features from pyproject.toml") + self.assertRegex(output, r"Compiling guessing-game v0.1.0") + self.assertRegex(output, r"📦 Built wheel for abi3 Python ≥ 3.8") + self.assertRegex(output, r"🛠 Installed guessing-game-0.1.0") + self.assertEqual(status, 0) |