Skip to contentSkip to conversation

oeqa: add runtime 'maturin develop' test case

PATCH Superseded Tim Orling 2 participants 4 messages Dec 17, 2023

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/1 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:

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

---
 meta/lib/oeqa/runtime/cases/maturin.py | 35 ++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
meta/lib/oeqa/runtime/cases/maturin.py +35 -0
index b9a3b4acbcd..4e6384fe5e6 100644
@@ -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)
Signature Β· 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/1 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

---
Changes in v2:
Clarify that tools-sdk is required in the image, plus we need the 'rust' toolchain lang

Tested on qemuarm64 core-image-full-cmdline

 meta/lib/oeqa/runtime/cases/maturin.py | 35 ++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
meta/lib/oeqa/runtime/cases/maturin.py +35 -0
index b9a3b4acbcd..4e6384fe5e6 100644
@@ -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)
Signature Β· 1 line
2.34.1
#2 lore raw

Patchtest results for [PATCH v2] oeqa: add runtime 'maturin develop' test case

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/v2-oeqa-add-runtime-maturin-develop-test-case.patch

FAIL: test mbox format: Series has malformed diff lines. Create the series again using git-format-patch and ensure it applies using git am (test_mbox.TestMbox.test_mbox_format)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: Python-unidiff parse error (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE tag format: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: Python-unidiff parse error (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#3 lore raw

Patchtest results for [PATCH] oeqa: add runtime 'maturin develop' test case

In reply to Tim Orling

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/oeqa-add-runtime-maturin-develop-test-case.patch

FAIL: test mbox format: Series has malformed diff lines. Create the series again using git-format-patch and ensure it applies using git am (test_mbox.TestMbox.test_mbox_format)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: Python-unidiff parse error (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE tag format: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: Parse error Hunk is shorter than expected (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: Python-unidiff parse error (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!