summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2023-12-17 14:58:49 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-23 08:46:00 +0000
commitdfe9c45264924e0b6a7c3f9ce4574eb9fa554ccc (patch)
tree7111e43c1f4eaeb2246dd9ba3e1be39a34f5e975 /meta/lib/oeqa/runtime
parent9cd6986348beefd2965a3cb7c38c466328f8e757 (diff)
downloadpoky-dfe9c45264924e0b6a7c3f9ce4574eb9fa554ccc.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 (From OE-Core rev: ca7e78c8be6aaa2780702eab54715a74fc0dac5e) 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.py35
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
10from oeqa.core.decorator.depends import OETestDepends 10from oeqa.core.decorator.depends import OETestDepends
11from oeqa.runtime.decorator.package import OEHasPackage 11from oeqa.runtime.decorator.package import OEHasPackage
12 12
13
13class MaturinTest(OERuntimeTestCase): 14class MaturinTest(OERuntimeTestCase):
14 @OETestDepends(['ssh.SSHTest.test_ssh', 'python.PythonTest.test_python3']) 15 @OETestDepends(['ssh.SSHTest.test_ssh', 'python.PythonTest.test_python3'])
15 @OEHasPackage(['python3-maturin']) 16 @OEHasPackage(['python3-maturin'])
@@ -21,3 +22,37 @@ class MaturinTest(OERuntimeTestCase):
21 python_version = "%s.%s" % (py_major, py_minor) 22 python_version = "%s.%s" % (py_major, py_minor)
22 self.assertEqual(output, "🐍 1 python interpreter found:\n" 23 self.assertEqual(output, "🐍 1 python interpreter found:\n"
23 " - CPython %s at /usr/bin/python%s" % (python_version, python_version)) 24 " - CPython %s at /usr/bin/python%s" % (python_version, python_version))
25
26
27class MaturinDevelopTest(OERuntimeTestCase):
28 @classmethod
29 def setUp(cls):
30 dst = '/tmp'
31 src = os.path.join(cls.tc.files_dir, "maturin/guessing-game")
32 cls.tc.target.copyTo(src, dst)
33
34 @classmethod
35 def tearDown(cls):
36 cls.tc.target.run('rm -rf %s' % '/tmp/guessing-game/target')
37
38 @OETestDepends(['ssh.SSHTest.test_ssh', 'python.PythonTest.test_python3'])
39 @OEHasPackage(['python3-maturin'])
40 def test_maturin_develop(self):
41 """
42 This test case requires:
43 (1) that a .venv can been created.
44 (2) DNS nameserver to resolve crate URIs for fetching
45 (3) a functional 'rustc' and 'cargo'
46 """
47 targetdir = os.path.join("/tmp", "guessing-game")
48 self.target.run("cd %s; python3 -m venv .venv" % targetdir)
49 self.target.run("echo 'nameserver 8.8.8.8' > /etc/resolv.conf")
50 cmd = "cd %s; maturin develop" % targetdir
51 status, output = self.target.run(cmd)
52 self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8")
53 self.assertRegex(output, r"🐍 Not using a specific python interpreter")
54 self.assertRegex(output, r"📡 Using build options features from pyproject.toml")
55 self.assertRegex(output, r"Compiling guessing-game v0.1.0")
56 self.assertRegex(output, r"📦 Built wheel for abi3 Python ≥ 3.8")
57 self.assertRegex(output, r"🛠 Installed guessing-game-0.1.0")
58 self.assertEqual(status, 0)