summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2023-12-16 21:41:32 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-17 19:04:40 +0000
commit7ceff48625d01a0e60eb761a9a668d0c942cda89 (patch)
tree79f80beaddffc0a9d325cab56c602f404e038414 /meta/lib/oeqa
parent47c948c3cf6e582abd12021ceeff2c20a3e81fb5 (diff)
downloadopenembedded-core-contrib-7ceff48625d01a0e60eb761a9a668d0c942cda89.tar.gz
oeqa: add simple 'maturin' SDK (testsdk) test case
We expect 'maturin' will be used in SDKs, so it makes sense to also test it in the testsdk environment. To run this test case, you can add the following to local.conf: TOOLCHAIN_HOST_TASK:append = " nativesdk-python3-maturin" And then build and test the SDK: bitbake -c populate_sdk core-image-full-cmdline bitbake -c testsdk core-image-full-cmdline You can substitute a different image recipe for "core-image-full-cmdline" Signed-off-by: Tim Orling <tim.orling@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/sdk/cases/maturin.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py
new file mode 100644
index 0000000000..14245bc36e
--- /dev/null
+++ b/meta/lib/oeqa/sdk/cases/maturin.py
@@ -0,0 +1,33 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+import unittest
+from oeqa.sdk.case import OESDKTestCase
+
+from oeqa.utils.subprocesstweak import errors_have_output
+
+errors_have_output()
+
+
+class MaturinTest(OESDKTestCase):
+ def setUp(self):
+ if not (
+ self.tc.hasHostPackage("nativesdk-python3-maturin")
+ or self.tc.hasHostPackage("python3-maturin-native")
+ ):
+ raise unittest.SkipTest("No python3-maturin package in the SDK")
+
+ def test_maturin_list_python(self):
+ py_major = self._run("python3 -c 'import sys; print(sys.version_info.major)'")
+ py_minor = self._run("python3 -c 'import sys; print(sys.version_info.minor)'")
+ python_version = "%s.%s" % (py_major.strip(), py_minor.strip())
+ cmd = "maturin list-python"
+ output = self._run(cmd)
+ self.assertRegex(output, r"^🐍 1 python interpreter found:\n")
+ self.assertRegex(
+ output,
+ r" - CPython %s (.+)/usr/bin/python%s$" % (python_version, python_version),
+ )