diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/autotools.py (renamed from meta/lib/oeqa/sdk/cases/buildcpio.py) | 24 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/buildepoxy.py | 41 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/buildgalculator.py | 43 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/cmake.py (renamed from meta/lib/oeqa/sdk/cases/assimp.py) | 23 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/gcc.py | 6 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/gtk3.py | 40 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/kmod.py | 39 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/makefile.py (renamed from meta/lib/oeqa/sdk/cases/buildlzip.py) | 12 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/manifest.py | 26 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/maturin.py | 66 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/meson.py | 72 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/perl.py | 7 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/python.py | 18 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/cases/rust.py | 58 |
14 files changed, 356 insertions, 119 deletions
diff --git a/meta/lib/oeqa/sdk/cases/buildcpio.py b/meta/lib/oeqa/sdk/cases/autotools.py index e7fc211a47..ee6c522551 100644 --- a/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
@@ -11,16 +13,21 @@ from oeqa.sdk.case import OESDKTestCase | |||
11 | from oeqa.utils.subprocesstweak import errors_have_output | 13 | from oeqa.utils.subprocesstweak import errors_have_output |
12 | errors_have_output() | 14 | errors_have_output() |
13 | 15 | ||
14 | class BuildCpioTest(OESDKTestCase): | 16 | class AutotoolsTest(OESDKTestCase): |
15 | """ | 17 | """ |
16 | Check that autotools will cross-compile correctly. | 18 | Check that autotools will cross-compile correctly. |
17 | """ | 19 | """ |
20 | def setUp(self): | ||
21 | libc = self.td.get("TCLIBC") | ||
22 | if libc in [ 'newlib' ]: | ||
23 | raise unittest.SkipTest("AutotoolsTest class: SDK doesn't contain a supported C library") | ||
24 | |||
18 | def test_cpio(self): | 25 | def test_cpio(self): |
19 | with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: | 26 | with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: |
20 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.13.tar.gz") | 27 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.15.tar.gz") |
21 | 28 | ||
22 | dirs = {} | 29 | dirs = {} |
23 | dirs["source"] = os.path.join(testdir, "cpio-2.13") | 30 | dirs["source"] = os.path.join(testdir, "cpio-2.15") |
24 | dirs["build"] = os.path.join(testdir, "build") | 31 | dirs["build"] = os.path.join(testdir, "build") |
25 | dirs["install"] = os.path.join(testdir, "install") | 32 | dirs["install"] = os.path.join(testdir, "install") |
26 | 33 | ||
@@ -28,9 +35,14 @@ class BuildCpioTest(OESDKTestCase): | |||
28 | self.assertTrue(os.path.isdir(dirs["source"])) | 35 | self.assertTrue(os.path.isdir(dirs["source"])) |
29 | os.makedirs(dirs["build"]) | 36 | os.makedirs(dirs["build"]) |
30 | 37 | ||
31 | self._run("sed -i -e '/char.*program_name/d' {source}/src/global.c".format(**dirs)) | 38 | self._run("cd {build} && {source}/configure CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' $CONFIGURE_FLAGS".format(**dirs)) |
32 | self._run("cd {build} && {source}/configure --disable-maintainer-mode $CONFIGURE_FLAGS".format(**dirs)) | 39 | |
33 | self._run("cd {build} && make -j".format(**dirs)) | 40 | # Check that configure detected the target correctly |
41 | with open(os.path.join(dirs["build"], "config.log")) as f: | ||
42 | host_sys = self.td["HOST_SYS"] | ||
43 | self.assertIn(f"host_alias='{host_sys}'\n", f.readlines()) | ||
44 | |||
45 | self._run("cd {build} && make CFLAGS='-std=gnu17 -Dbool=int -Dtrue=1 -Dfalse=0 -Wno-error=implicit-function-declaration' -j".format(**dirs)) | ||
34 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) | 46 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
35 | 47 | ||
36 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio")) | 48 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "cpio")) |
diff --git a/meta/lib/oeqa/sdk/cases/buildepoxy.py b/meta/lib/oeqa/sdk/cases/buildepoxy.py deleted file mode 100644 index 385f8ccca8..0000000000 --- a/meta/lib/oeqa/sdk/cases/buildepoxy.py +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: MIT | ||
3 | # | ||
4 | |||
5 | import os | ||
6 | import subprocess | ||
7 | import tempfile | ||
8 | import unittest | ||
9 | |||
10 | from oeqa.sdk.case import OESDKTestCase | ||
11 | from oeqa.utils.subprocesstweak import errors_have_output | ||
12 | errors_have_output() | ||
13 | |||
14 | class EpoxyTest(OESDKTestCase): | ||
15 | """ | ||
16 | Test that Meson builds correctly. | ||
17 | """ | ||
18 | def setUp(self): | ||
19 | if not (self.tc.hasHostPackage("nativesdk-meson")): | ||
20 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain Meson") | ||
21 | |||
22 | def test_epoxy(self): | ||
23 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: | ||
24 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/anholt/libepoxy/releases/download/1.5.3/libepoxy-1.5.3.tar.xz") | ||
25 | |||
26 | dirs = {} | ||
27 | dirs["source"] = os.path.join(testdir, "libepoxy-1.5.3") | ||
28 | dirs["build"] = os.path.join(testdir, "build") | ||
29 | dirs["install"] = os.path.join(testdir, "install") | ||
30 | |||
31 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
32 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
33 | os.makedirs(dirs["build"]) | ||
34 | |||
35 | log = self._run("meson -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) | ||
36 | # Check that Meson thinks we're doing a cross build and not a native | ||
37 | self.assertIn("Build type: cross build", log) | ||
38 | self._run("ninja -C {build} -v".format(**dirs)) | ||
39 | self._run("DESTDIR={install} ninja -C {build} -v install".format(**dirs)) | ||
40 | |||
41 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libepoxy.so")) | ||
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/buildgalculator.py deleted file mode 100644 index eb3c8ddf39..0000000000 --- a/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: MIT | ||
3 | # | ||
4 | |||
5 | import os | ||
6 | import subprocess | ||
7 | import tempfile | ||
8 | import unittest | ||
9 | |||
10 | from oeqa.sdk.case import OESDKTestCase | ||
11 | from oeqa.utils.subprocesstweak import errors_have_output | ||
12 | errors_have_output() | ||
13 | |||
14 | class GalculatorTest(OESDKTestCase): | ||
15 | """ | ||
16 | Test that autotools and GTK+ 3 compiles correctly. | ||
17 | """ | ||
18 | def setUp(self): | ||
19 | if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \ | ||
20 | self.tc.hasTargetPackage("libgtk-3.0", multilib=True)): | ||
21 | raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") | ||
22 | if not (self.tc.hasHostPackage("nativesdk-gettext-dev")): | ||
23 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") | ||
24 | |||
25 | def test_galculator(self): | ||
26 | with tempfile.TemporaryDirectory(prefix="galculator", dir=self.tc.sdk_dir) as testdir: | ||
27 | tarball = self.fetch(testdir, self.td["DL_DIR"], "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") | ||
28 | |||
29 | dirs = {} | ||
30 | dirs["source"] = os.path.join(testdir, "galculator-2.1.4") | ||
31 | dirs["build"] = os.path.join(testdir, "build") | ||
32 | dirs["install"] = os.path.join(testdir, "install") | ||
33 | |||
34 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
35 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
36 | os.makedirs(dirs["build"]) | ||
37 | |||
38 | self._run("cd {source} && sed -i -e '/s_preferences.*prefs;/d' src/main.c && autoreconf -i -f -I $OECORE_TARGET_SYSROOT/usr/share/aclocal -I m4".format(**dirs)) | ||
39 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) | ||
40 | self._run("cd {build} && make -j".format(**dirs)) | ||
41 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) | ||
42 | |||
43 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "bin", "galculator")) | ||
diff --git a/meta/lib/oeqa/sdk/cases/assimp.py b/meta/lib/oeqa/sdk/cases/cmake.py index f166758e49..070682ef08 100644 --- a/meta/lib/oeqa/sdk/cases/assimp.py +++ b/meta/lib/oeqa/sdk/cases/cmake.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
@@ -11,30 +13,35 @@ from oeqa.sdk.case import OESDKTestCase | |||
11 | from oeqa.utils.subprocesstweak import errors_have_output | 13 | from oeqa.utils.subprocesstweak import errors_have_output |
12 | errors_have_output() | 14 | errors_have_output() |
13 | 15 | ||
14 | class BuildAssimp(OESDKTestCase): | 16 | class CMakeTest(OESDKTestCase): |
15 | """ | 17 | """ |
16 | Test case to build a project using cmake. | 18 | Test case to build a project using cmake. |
17 | """ | 19 | """ |
18 | 20 | ||
19 | def setUp(self): | 21 | def setUp(self): |
20 | if not (self.tc.hasHostPackage("nativesdk-cmake") or | 22 | libc = self.td.get("TCLIBC") |
21 | self.tc.hasHostPackage("cmake-native")): | 23 | if libc in [ 'newlib' ]: |
22 | raise unittest.SkipTest("Needs cmake") | 24 | raise unittest.SkipTest("CMakeTest class: SDK doesn't contain a supported C library") |
25 | |||
26 | self.ensure_host_package("cmake") | ||
23 | 27 | ||
24 | def test_assimp(self): | 28 | def test_assimp(self): |
25 | with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: | 29 | with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: |
26 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v4.1.0.tar.gz") | 30 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") |
27 | 31 | ||
28 | dirs = {} | 32 | dirs = {} |
29 | dirs["source"] = os.path.join(testdir, "assimp-4.1.0") | 33 | dirs["source"] = os.path.join(testdir, "assimp-5.4.1") |
30 | dirs["build"] = os.path.join(testdir, "build") | 34 | dirs["build"] = os.path.join(testdir, "build") |
31 | dirs["install"] = os.path.join(testdir, "install") | 35 | dirs["install"] = os.path.join(testdir, "install") |
32 | 36 | ||
33 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | 37 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) |
34 | self.assertTrue(os.path.isdir(dirs["source"])) | 38 | self.assertTrue(os.path.isdir(dirs["source"])) |
39 | # Apply the zlib patch https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3 | ||
40 | # this sed wont be needed once assimp moves its zlib copy to v1.3.1+ | ||
41 | self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**dirs)) | ||
35 | os.makedirs(dirs["build"]) | 42 | os.makedirs(dirs["build"]) |
36 | 43 | ||
37 | self._run("cd {build} && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON {source}".format(**dirs)) | 44 | self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**dirs)) |
38 | self._run("cmake --build {build} -- -j".format(**dirs)) | 45 | self._run("cmake --build {build} -- -j".format(**dirs)) |
39 | self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs)) | 46 | self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs)) |
40 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libassimp.so.4.1.0")) | 47 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) |
diff --git a/meta/lib/oeqa/sdk/cases/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py index eb08eadd28..e810d2c42b 100644 --- a/meta/lib/oeqa/sdk/cases/gcc.py +++ b/meta/lib/oeqa/sdk/cases/gcc.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
@@ -24,6 +26,10 @@ class GccCompileTest(OESDKTestCase): | |||
24 | os.path.join(self.tc.sdk_dir, f)) | 26 | os.path.join(self.tc.sdk_dir, f)) |
25 | 27 | ||
26 | def setUp(self): | 28 | def setUp(self): |
29 | libc = self.td.get("TCLIBC") | ||
30 | if libc in [ 'newlib' ]: | ||
31 | raise unittest.SkipTest("GccCompileTest class: SDK doesn't contain a supported C library") | ||
32 | |||
27 | machine = self.td.get("MACHINE") | 33 | machine = self.td.get("MACHINE") |
28 | if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or | 34 | if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or |
29 | self.tc.hasHostPackage("^gcc-", regex=True)): | 35 | self.tc.hasHostPackage("^gcc-", regex=True)): |
diff --git a/meta/lib/oeqa/sdk/cases/gtk3.py b/meta/lib/oeqa/sdk/cases/gtk3.py new file mode 100644 index 0000000000..cdaf50ed38 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/gtk3.py | |||
@@ -0,0 +1,40 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import subprocess | ||
9 | import tempfile | ||
10 | |||
11 | from oeqa.sdk.cases.meson import MesonTestBase | ||
12 | |||
13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
14 | errors_have_output() | ||
15 | |||
16 | class GTK3Test(MesonTestBase): | ||
17 | |||
18 | def setUp(self): | ||
19 | super().setUp() | ||
20 | self.ensure_target_package("gtk+3", "libgtk-3.0", recipe="gtk+3") | ||
21 | self.ensure_host_package("glib-2.0-utils", "libglib-2.0-utils", recipe="glib-2.0") | ||
22 | |||
23 | """ | ||
24 | Test that autotools and GTK+ 3 compiles correctly. | ||
25 | """ | ||
26 | def test_libhandy(self): | ||
27 | with tempfile.TemporaryDirectory(prefix="libhandy", dir=self.tc.sdk_dir) as testdir: | ||
28 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://download.gnome.org/sources/libhandy/1.8/libhandy-1.8.3.tar.xz") | ||
29 | |||
30 | sourcedir = os.path.join(testdir, "libhandy-1.8.3") | ||
31 | builddir = os.path.join(testdir, "build") | ||
32 | installdir = os.path.join(testdir, "install") | ||
33 | |||
34 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
35 | self.assertTrue(os.path.isdir(sourcedir)) | ||
36 | os.makedirs(builddir) | ||
37 | |||
38 | self.build_meson(sourcedir, builddir, installdir, "-Dglade_catalog=disabled -Dintrospection=disabled -Dvapi=false") | ||
39 | self.assertTrue(os.path.isdir(installdir)) | ||
40 | self.check_elf(os.path.join(installdir, "usr", "local", "lib", "libhandy-1.so")) | ||
diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py new file mode 100644 index 0000000000..0aa6f702e4 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/kmod.py | |||
@@ -0,0 +1,39 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import subprocess | ||
9 | import tempfile | ||
10 | |||
11 | from oeqa.sdk.case import OESDKTestCase | ||
12 | from oeqa.sdkext.context import OESDKExtTestContext | ||
13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
14 | errors_have_output() | ||
15 | |||
16 | class KernelModuleTest(OESDKTestCase): | ||
17 | """ | ||
18 | Test that out-of-tree kernel modules build. | ||
19 | """ | ||
20 | def test_cryptodev(self): | ||
21 | if isinstance(self.tc, OESDKExtTestContext): | ||
22 | self.skipTest(f"{self.id()} does not support eSDK (https://bugzilla.yoctoproject.org/show_bug.cgi?id=15850)") | ||
23 | |||
24 | self.ensure_target_package("kernel-devsrc") | ||
25 | # These targets need to be built before kernel modules can be built. | ||
26 | self._run("make -j -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts") | ||
27 | |||
28 | with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir: | ||
29 | git_url = "https://github.com/cryptodev-linux/cryptodev-linux" | ||
30 | # This is a knnown-good commit post-1.13 that builds with kernel 6.7+ | ||
31 | git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f" | ||
32 | |||
33 | sourcedir = os.path.join(testdir, "cryptodev-linux") | ||
34 | subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT) | ||
35 | self.assertTrue(os.path.isdir(sourcedir)) | ||
36 | subprocess.check_output(["git", "-C", sourcedir, "checkout", git_sha], stderr=subprocess.STDOUT) | ||
37 | |||
38 | self._run("make -C %s V=1 KERNEL_DIR=$OECORE_TARGET_SYSROOT/usr/src/kernel" % sourcedir) | ||
39 | self.check_elf(os.path.join(sourcedir, "cryptodev.ko")) | ||
diff --git a/meta/lib/oeqa/sdk/cases/buildlzip.py b/meta/lib/oeqa/sdk/cases/makefile.py index 49ae756bf3..e1e2484820 100644 --- a/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py | |||
@@ -1,16 +1,24 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
5 | import os, tempfile, subprocess, unittest | 7 | import os, tempfile, subprocess |
8 | import unittest | ||
6 | from oeqa.sdk.case import OESDKTestCase | 9 | from oeqa.sdk.case import OESDKTestCase |
7 | from oeqa.utils.subprocesstweak import errors_have_output | 10 | from oeqa.utils.subprocesstweak import errors_have_output |
8 | errors_have_output() | 11 | errors_have_output() |
9 | 12 | ||
10 | class BuildLzipTest(OESDKTestCase): | 13 | class MakefileTest(OESDKTestCase): |
11 | """ | 14 | """ |
12 | Test that "plain" compilation works, using just $CC $CFLAGS etc. | 15 | Test that "plain" compilation works, using just $CC $CFLAGS etc. |
13 | """ | 16 | """ |
17 | def setUp(self): | ||
18 | libc = self.td.get("TCLIBC") | ||
19 | if libc in [ 'newlib' ]: | ||
20 | raise unittest.SkipTest("MakefileTest class: SDK doesn't contain a supported C library") | ||
21 | |||
14 | def test_lzip(self): | 22 | def test_lzip(self): |
15 | with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir: | 23 | with tempfile.TemporaryDirectory(prefix="lzip", dir=self.tc.sdk_dir) as testdir: |
16 | tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz") | 24 | tarball = self.fetch(testdir, self.td["DL_DIR"], "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz") |
diff --git a/meta/lib/oeqa/sdk/cases/manifest.py b/meta/lib/oeqa/sdk/cases/manifest.py new file mode 100644 index 0000000000..ee59a5f338 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/manifest.py | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | from oeqa.sdk.case import OESDKTestCase | ||
8 | from oeqa.sdkext.context import OESDKExtTestContext | ||
9 | |||
10 | |||
11 | class ManifestTest(OESDKTestCase): | ||
12 | def test_manifests(self): | ||
13 | """ | ||
14 | Verify that the host and target manifests are not empty, unless this is | ||
15 | a minimal eSDK without toolchain in which case they should be empty. | ||
16 | """ | ||
17 | if ( | ||
18 | isinstance(self.tc, OESDKExtTestContext) | ||
19 | and self.td.get("SDK_EXT_TYPE") == "minimal" | ||
20 | and self.td.get("SDK_INCLUDE_TOOLCHAIN") == "0" | ||
21 | ): | ||
22 | self.assertEqual(self.tc.target_pkg_manifest, {}) | ||
23 | self.assertEqual(self.tc.host_pkg_manifest, {}) | ||
24 | else: | ||
25 | self.assertNotEqual(self.tc.target_pkg_manifest, {}) | ||
26 | self.assertNotEqual(self.tc.host_pkg_manifest, {}) | ||
diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py new file mode 100644 index 0000000000..e3e8edc781 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/maturin.py | |||
@@ -0,0 +1,66 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import shutil | ||
9 | import unittest | ||
10 | |||
11 | from oeqa.sdk.case import OESDKTestCase | ||
12 | from oeqa.utils.subprocesstweak import errors_have_output | ||
13 | |||
14 | errors_have_output() | ||
15 | |||
16 | |||
17 | class MaturinTest(OESDKTestCase): | ||
18 | def setUp(self): | ||
19 | self.ensure_host_package("python3-maturin") | ||
20 | |||
21 | def test_maturin_list_python(self): | ||
22 | out = self._run(r"""python3 -c 'import sys; print(f"{sys.executable}\n{sys.version_info.major}.{sys.version_info.minor}")'""") | ||
23 | executable, version = out.splitlines() | ||
24 | |||
25 | output = self._run("maturin list-python") | ||
26 | # The output looks like this: | ||
27 | # - CPython 3.13 at /usr/bin/python3 | ||
28 | # We don't want to assume CPython so just check for the version and path. | ||
29 | expected = f"{version} at {executable}" | ||
30 | self.assertIn(expected, output) | ||
31 | |||
32 | class MaturinDevelopTest(OESDKTestCase): | ||
33 | def setUp(self): | ||
34 | machine = self.td.get("MACHINE") | ||
35 | self.ensure_host_package("python3-maturin") | ||
36 | |||
37 | if not ( | ||
38 | self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine) | ||
39 | ): | ||
40 | raise unittest.SkipTest( | ||
41 | "Testing 'maturin develop' requires Rust cross-canadian in the SDK" | ||
42 | ) | ||
43 | |||
44 | def test_maturin_develop(self): | ||
45 | """ | ||
46 | This test case requires: | ||
47 | (1) that a .venv can been created. | ||
48 | (2) a functional 'rustc' and 'cargo' | ||
49 | """ | ||
50 | targetdir = os.path.join(self.tc.sdk_dir, "guessing-game") | ||
51 | try: | ||
52 | shutil.rmtree(targetdir) | ||
53 | except FileNotFoundError: | ||
54 | pass | ||
55 | shutil.copytree( | ||
56 | os.path.join(self.tc.files_dir, "maturin/guessing-game"), targetdir | ||
57 | ) | ||
58 | |||
59 | self._run("cd %s; python3 -m venv .venv" % targetdir) | ||
60 | output = self._run("cd %s; maturin develop" % targetdir) | ||
61 | self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8") | ||
62 | self.assertRegex(output, r"🐍 Not using a specific python interpreter") | ||
63 | self.assertRegex(output, r"📡 Using build options features from pyproject.toml") | ||
64 | self.assertRegex(output, r"Compiling guessing-game v0.1.0") | ||
65 | self.assertRegex(output, r"📦 Built wheel for abi3 Python ≥ 3.8") | ||
66 | self.assertRegex(output, r"🛠 Installed guessing-game-0.1.0") | ||
diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py new file mode 100644 index 0000000000..a809ca3a53 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/meson.py | |||
@@ -0,0 +1,72 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import json | ||
8 | import os | ||
9 | import subprocess | ||
10 | import tempfile | ||
11 | import unittest | ||
12 | |||
13 | from oeqa.sdk.case import OESDKTestCase | ||
14 | from oeqa.sdkext.context import OESDKExtTestContext | ||
15 | from oeqa.utils.subprocesstweak import errors_have_output | ||
16 | errors_have_output() | ||
17 | |||
18 | class MesonTestBase(OESDKTestCase): | ||
19 | def setUp(self): | ||
20 | libc = self.td.get("TCLIBC") | ||
21 | if libc in [ 'newlib' ]: | ||
22 | raise unittest.SkipTest("MesonTest class: SDK doesn't contain a supported C library") | ||
23 | |||
24 | if isinstance(self.tc, OESDKExtTestContext): | ||
25 | self.skipTest(f"{self.id()} does not support eSDK (https://bugzilla.yoctoproject.org/show_bug.cgi?id=15854)") | ||
26 | |||
27 | self.ensure_host_package("meson") | ||
28 | self.ensure_host_package("pkgconfig") | ||
29 | |||
30 | def build_meson(self, sourcedir, builddir, installdir=None, options=""): | ||
31 | """ | ||
32 | Given a source tree in sourcedir, configure it to build in builddir with | ||
33 | the specified options, and if installdir is set also install. | ||
34 | """ | ||
35 | log = self._run(f"meson setup --warnlevel 1 {builddir} {sourcedir} {options}") | ||
36 | |||
37 | # Check that Meson thinks we're doing a cross build and not a native | ||
38 | self.assertIn("Build type: cross build", log) | ||
39 | |||
40 | # Check that the cross-compiler used is the one we set. | ||
41 | data = json.loads(self._run(f"meson introspect --compilers {builddir}")) | ||
42 | self.assertIn(self.td.get("CC").split()[0], data["host"]["c"]["exelist"]) | ||
43 | |||
44 | # Check that the target architectures was set correctly. | ||
45 | data = json.loads(self._run(f"meson introspect --machines {builddir}")) | ||
46 | self.assertEqual(data["host"]["cpu"], self.td["HOST_ARCH"]) | ||
47 | |||
48 | self._run(f"meson compile -C {builddir} -v") | ||
49 | |||
50 | if installdir: | ||
51 | self._run(f"meson install -C {builddir} --destdir {installdir}") | ||
52 | |||
53 | class MesonTest(MesonTestBase): | ||
54 | """ | ||
55 | Test that Meson builds correctly. | ||
56 | """ | ||
57 | |||
58 | def test_epoxy(self): | ||
59 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: | ||
60 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/anholt/libepoxy/releases/download/1.5.3/libepoxy-1.5.3.tar.xz") | ||
61 | |||
62 | sourcedir = os.path.join(testdir, "libepoxy-1.5.3") | ||
63 | builddir = os.path.join(testdir, "build") | ||
64 | installdir = os.path.join(testdir, "install") | ||
65 | |||
66 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
67 | self.assertTrue(os.path.isdir(sourcedir)) | ||
68 | |||
69 | os.makedirs(builddir) | ||
70 | self.build_meson(sourcedir, builddir, installdir, "-Degl=no -Dglx=no -Dx11=false") | ||
71 | self.assertTrue(os.path.isdir(installdir)) | ||
72 | self.check_elf(os.path.join(installdir, "usr", "local", "lib", "libepoxy.so")) | ||
diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py index 14d76d820f..a72bd2461a 100644 --- a/meta/lib/oeqa/sdk/cases/perl.py +++ b/meta/lib/oeqa/sdk/cases/perl.py | |||
@@ -1,8 +1,9 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
5 | import unittest | ||
6 | from oeqa.sdk.case import OESDKTestCase | 7 | from oeqa.sdk.case import OESDKTestCase |
7 | 8 | ||
8 | from oeqa.utils.subprocesstweak import errors_have_output | 9 | from oeqa.utils.subprocesstweak import errors_have_output |
@@ -10,9 +11,7 @@ errors_have_output() | |||
10 | 11 | ||
11 | class PerlTest(OESDKTestCase): | 12 | class PerlTest(OESDKTestCase): |
12 | def setUp(self): | 13 | def setUp(self): |
13 | if not (self.tc.hasHostPackage("nativesdk-perl") or | 14 | self.ensure_host_package("perl") |
14 | self.tc.hasHostPackage("perl-native")): | ||
15 | raise unittest.SkipTest("No perl package in the SDK") | ||
16 | 15 | ||
17 | def test_perl(self): | 16 | def test_perl(self): |
18 | cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'" | 17 | cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'" |
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index a334abce5f..b990cd889a 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py | |||
@@ -1,29 +1,17 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
5 | import subprocess, unittest | ||
6 | from oeqa.sdk.case import OESDKTestCase | 7 | from oeqa.sdk.case import OESDKTestCase |
7 | 8 | ||
8 | from oeqa.utils.subprocesstweak import errors_have_output | 9 | from oeqa.utils.subprocesstweak import errors_have_output |
9 | errors_have_output() | 10 | errors_have_output() |
10 | 11 | ||
11 | class Python2Test(OESDKTestCase): | ||
12 | def setUp(self): | ||
13 | if not (self.tc.hasHostPackage("nativesdk-python-core") or | ||
14 | self.tc.hasHostPackage("python-core-native")): | ||
15 | raise unittest.SkipTest("No python package in the SDK") | ||
16 | |||
17 | def test_python2(self): | ||
18 | cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" | ||
19 | output = self._run(cmd) | ||
20 | self.assertEqual(output, "Hello, world\n") | ||
21 | |||
22 | class Python3Test(OESDKTestCase): | 12 | class Python3Test(OESDKTestCase): |
23 | def setUp(self): | 13 | def setUp(self): |
24 | if not (self.tc.hasHostPackage("nativesdk-python3-core") or | 14 | self.ensure_host_package("python3-core", recipe="python3") |
25 | self.tc.hasHostPackage("python3-core-native")): | ||
26 | raise unittest.SkipTest("No python3 package in the SDK") | ||
27 | 15 | ||
28 | def test_python3(self): | 16 | def test_python3(self): |
29 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" | 17 | cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" |
diff --git a/meta/lib/oeqa/sdk/cases/rust.py b/meta/lib/oeqa/sdk/cases/rust.py new file mode 100644 index 0000000000..4b115bebf5 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/rust.py | |||
@@ -0,0 +1,58 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import shutil | ||
9 | import unittest | ||
10 | |||
11 | from oeqa.sdk.case import OESDKTestCase | ||
12 | |||
13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
14 | errors_have_output() | ||
15 | |||
16 | class RustCompileTest(OESDKTestCase): | ||
17 | td_vars = ['MACHINE'] | ||
18 | |||
19 | @classmethod | ||
20 | def setUpClass(self): | ||
21 | targetdir = os.path.join(self.tc.sdk_dir, "hello") | ||
22 | try: | ||
23 | shutil.rmtree(targetdir) | ||
24 | except FileNotFoundError: | ||
25 | pass | ||
26 | shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), targetdir) | ||
27 | |||
28 | def setUp(self): | ||
29 | machine = self.td.get("MACHINE") | ||
30 | if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine): | ||
31 | raise unittest.SkipTest("RustCompileTest class: SDK doesn't contain a Rust cross-canadian toolchain") | ||
32 | |||
33 | def test_cargo_build(self): | ||
34 | self._run('cd %s/hello; cargo add zstd' % (self.tc.sdk_dir)) | ||
35 | self._run('cd %s/hello; cargo build' % self.tc.sdk_dir) | ||
36 | |||
37 | class RustHostCompileTest(OESDKTestCase): | ||
38 | td_vars = ['MACHINE', 'SDK_SYS'] | ||
39 | |||
40 | @classmethod | ||
41 | def setUpClass(self): | ||
42 | targetdir = os.path.join(self.tc.sdk_dir, "hello") | ||
43 | try: | ||
44 | shutil.rmtree(targetdir) | ||
45 | except FileNotFoundError: | ||
46 | pass | ||
47 | shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), targetdir) | ||
48 | |||
49 | def setUp(self): | ||
50 | machine = self.td.get("MACHINE") | ||
51 | if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine): | ||
52 | raise unittest.SkipTest("RustCompileTest class: SDK doesn't contain a Rust cross-canadian toolchain") | ||
53 | |||
54 | def test_cargo_build(self): | ||
55 | sdksys = self.td.get("SDK_SYS") | ||
56 | self._run('cd %s/hello; cargo add zstd' % (self.tc.sdk_dir)) | ||
57 | self._run('cd %s/hello; cargo build --target %s-gnu' % (self.tc.sdk_dir, sdksys)) | ||
58 | self._run('cd %s/hello; cargo run --target %s-gnu' % (self.tc.sdk_dir, sdksys)) | ||