diff options
Diffstat (limited to 'meta/lib/oeqa/sdk')
22 files changed, 368 insertions, 41 deletions
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/sdk/buildtools-cases/README new file mode 100644 index 0000000000..d4f20faa9f --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/README | |||
@@ -0,0 +1,2 @@ | |||
1 | These test cases are used by buildtools-tarball, and are not used by the testsdk | ||
2 | class. | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/build.py b/meta/lib/oeqa/sdk/buildtools-cases/build.py new file mode 100644 index 0000000000..c85c32496b --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/build.py | |||
@@ -0,0 +1,32 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os, tempfile | ||
8 | import time | ||
9 | from oeqa.sdk.case import OESDKTestCase | ||
10 | from oeqa.utils.subprocesstweak import errors_have_output | ||
11 | errors_have_output() | ||
12 | |||
13 | class BuildTests(OESDKTestCase): | ||
14 | """ | ||
15 | Verify that bitbake can build virtual/libc inside the buildtools. | ||
16 | """ | ||
17 | def test_libc(self): | ||
18 | with tempfile.TemporaryDirectory(prefix='bitbake-build-', dir=self.tc.sdk_dir) as testdir: | ||
19 | corebase = self.td['COREBASE'] | ||
20 | |||
21 | self._run('. %s/oe-init-build-env %s' % (corebase, testdir)) | ||
22 | with open(os.path.join(testdir, 'conf', 'local.conf'), 'ta') as conf: | ||
23 | conf.write('\n') | ||
24 | conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR']) | ||
25 | |||
26 | try: | ||
27 | self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir)) | ||
28 | finally: | ||
29 | delay = 10 | ||
30 | while delay and (os.path.exists(testdir + "/bitbake.lock") or os.path.exists(testdir + "/cache/hashserv.db-wal")): | ||
31 | time.sleep(1) | ||
32 | delay = delay - 1 | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py new file mode 100644 index 0000000000..a62c4d0bc4 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py | |||
@@ -0,0 +1,31 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os.path | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | |||
10 | class GccTests(OESDKTestCase): | ||
11 | def test_verify_specs(self): | ||
12 | """ | ||
13 | Verify that the compiler has been relocated successfully and isn't | ||
14 | looking in the hard-coded prefix. | ||
15 | """ | ||
16 | # Canonicalise the SDK root | ||
17 | sdk_base = os.path.realpath(self.tc.sdk_dir) | ||
18 | # Canonicalise the location of GCC | ||
19 | gcc_path = os.path.realpath(self._run("command -v gcc").strip()) | ||
20 | # Skip the test if the GCC didn't come from the buildtools, as it only | ||
21 | # comes with buildtools-extended-tarball. | ||
22 | if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base: | ||
23 | self.skipTest("Buildtools does not provide GCC") | ||
24 | |||
25 | # This is the prefix that GCC is build with, and should be replaced at | ||
26 | # installation time. | ||
27 | sdkpath = self.td.get("SDKPATH") | ||
28 | self.assertTrue(sdkpath) | ||
29 | |||
30 | for line in self._run('gcc -dumpspecs').splitlines(): | ||
31 | self.assertNotIn(sdkpath, line) | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/https.py b/meta/lib/oeqa/sdk/buildtools-cases/https.py new file mode 100644 index 0000000000..4525e3d758 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/https.py | |||
@@ -0,0 +1,22 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | from oeqa.sdk.case import OESDKTestCase | ||
8 | from oeqa.utils.subprocesstweak import errors_have_output | ||
9 | errors_have_output() | ||
10 | |||
11 | class HTTPTests(OESDKTestCase): | ||
12 | """ | ||
13 | Verify that HTTPS certificates are working correctly, as this depends on | ||
14 | environment variables being set correctly. | ||
15 | """ | ||
16 | |||
17 | def test_wget(self): | ||
18 | self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html') | ||
19 | |||
20 | def test_python(self): | ||
21 | # urlopen() returns a file-like object on success and throws an exception otherwise | ||
22 | self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'') | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py new file mode 100644 index 0000000000..a55d456656 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py | |||
@@ -0,0 +1,24 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import shutil | ||
8 | import os.path | ||
9 | from oeqa.sdk.case import OESDKTestCase | ||
10 | |||
11 | class SanityTests(OESDKTestCase): | ||
12 | def test_tools(self): | ||
13 | """ | ||
14 | Test that wget and tar come from the buildtools, not the host. This | ||
15 | verifies that the buildtools have installed correctly. We can't check | ||
16 | for gcc as that is only installed by buildtools-extended. | ||
17 | """ | ||
18 | for command in ("tar", "wget"): | ||
19 | # Canonicalise the SDK root | ||
20 | sdk_base = os.path.realpath(self.tc.sdk_dir) | ||
21 | # Canonicalise the location of this command | ||
22 | tool_path = os.path.realpath(self._run("command -v %s" % command).strip()) | ||
23 | # Assert that the tool was found inside the SDK root | ||
24 | self.assertEqual(os.path.commonprefix((sdk_base, tool_path)), sdk_base) | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/README b/meta/lib/oeqa/sdk/buildtools-docs-cases/README new file mode 100644 index 0000000000..f8edbc7dad --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/README | |||
@@ -0,0 +1,2 @@ | |||
1 | These test cases are used by build-docs-tarball, and are not used by the testsdk | ||
2 | class. | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py new file mode 100644 index 0000000000..6e3ee94292 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import tempfile | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | from oeqa.utils.subprocesstweak import errors_have_output | ||
10 | errors_have_output() | ||
11 | |||
12 | class BuildTests(OESDKTestCase): | ||
13 | """ | ||
14 | Verify that our docs can build using our docs tools tarball. | ||
15 | """ | ||
16 | def test_docs_build(self): | ||
17 | with tempfile.TemporaryDirectory(prefix='docs-tarball-build-', dir=self.tc.sdk_dir) as testdir: | ||
18 | self._run('git clone git://git.yoctoproject.org/yocto-docs %s' % testdir) | ||
19 | self._run('cd %s/documentation && make html' % testdir) | ||
diff --git a/meta/lib/oeqa/sdk/cases/buildcpio.py b/meta/lib/oeqa/sdk/cases/autotools.py index e7fc211a47..848e9392ec 100644 --- a/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py | |||
@@ -1,26 +1,27 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
5 | import os | 7 | import os |
6 | import tempfile | 8 | import tempfile |
7 | import subprocess | 9 | import subprocess |
8 | import unittest | ||
9 | 10 | ||
10 | from oeqa.sdk.case import OESDKTestCase | 11 | from oeqa.sdk.case import OESDKTestCase |
11 | from oeqa.utils.subprocesstweak import errors_have_output | 12 | from oeqa.utils.subprocesstweak import errors_have_output |
12 | errors_have_output() | 13 | errors_have_output() |
13 | 14 | ||
14 | class BuildCpioTest(OESDKTestCase): | 15 | class AutotoolsTest(OESDKTestCase): |
15 | """ | 16 | """ |
16 | Check that autotools will cross-compile correctly. | 17 | Check that autotools will cross-compile correctly. |
17 | """ | 18 | """ |
18 | def test_cpio(self): | 19 | def test_cpio(self): |
19 | with tempfile.TemporaryDirectory(prefix="cpio-", dir=self.tc.sdk_dir) as testdir: | 20 | 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") | 21 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://ftp.gnu.org/gnu/cpio/cpio-2.15.tar.gz") |
21 | 22 | ||
22 | dirs = {} | 23 | dirs = {} |
23 | dirs["source"] = os.path.join(testdir, "cpio-2.13") | 24 | dirs["source"] = os.path.join(testdir, "cpio-2.15") |
24 | dirs["build"] = os.path.join(testdir, "build") | 25 | dirs["build"] = os.path.join(testdir, "build") |
25 | dirs["install"] = os.path.join(testdir, "install") | 26 | dirs["install"] = os.path.join(testdir, "install") |
26 | 27 | ||
@@ -28,8 +29,7 @@ class BuildCpioTest(OESDKTestCase): | |||
28 | self.assertTrue(os.path.isdir(dirs["source"])) | 29 | self.assertTrue(os.path.isdir(dirs["source"])) |
29 | os.makedirs(dirs["build"]) | 30 | os.makedirs(dirs["build"]) |
30 | 31 | ||
31 | self._run("sed -i -e '/char.*program_name/d' {source}/src/global.c".format(**dirs)) | 32 | self._run("cd {build} && {source}/configure $CONFIGURE_FLAGS".format(**dirs)) |
32 | self._run("cd {build} && {source}/configure --disable-maintainer-mode $CONFIGURE_FLAGS".format(**dirs)) | ||
33 | self._run("cd {build} && make -j".format(**dirs)) | 33 | self._run("cd {build} && make -j".format(**dirs)) |
34 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) | 34 | self._run("cd {build} && make install DESTDIR={install}".format(**dirs)) |
35 | 35 | ||
diff --git a/meta/lib/oeqa/sdk/cases/assimp.py b/meta/lib/oeqa/sdk/cases/cmake.py index f166758e49..db7d826a38 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,7 +13,7 @@ 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 | """ |
@@ -19,22 +21,25 @@ class BuildAssimp(OESDKTestCase): | |||
19 | def setUp(self): | 21 | def setUp(self): |
20 | if not (self.tc.hasHostPackage("nativesdk-cmake") or | 22 | if not (self.tc.hasHostPackage("nativesdk-cmake") or |
21 | self.tc.hasHostPackage("cmake-native")): | 23 | self.tc.hasHostPackage("cmake-native")): |
22 | raise unittest.SkipTest("Needs cmake") | 24 | raise unittest.SkipTest("CMakeTest: needs cmake") |
23 | 25 | ||
24 | def test_assimp(self): | 26 | def test_assimp(self): |
25 | with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: | 27 | 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") | 28 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") |
27 | 29 | ||
28 | dirs = {} | 30 | dirs = {} |
29 | dirs["source"] = os.path.join(testdir, "assimp-4.1.0") | 31 | dirs["source"] = os.path.join(testdir, "assimp-5.4.1") |
30 | dirs["build"] = os.path.join(testdir, "build") | 32 | dirs["build"] = os.path.join(testdir, "build") |
31 | dirs["install"] = os.path.join(testdir, "install") | 33 | dirs["install"] = os.path.join(testdir, "install") |
32 | 34 | ||
33 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | 35 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) |
34 | self.assertTrue(os.path.isdir(dirs["source"])) | 36 | self.assertTrue(os.path.isdir(dirs["source"])) |
37 | # Apply the zlib patch https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3 | ||
38 | # this sed wont be needed once assimp moves its zlib copy to v1.3.1+ | ||
39 | self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**dirs)) | ||
35 | os.makedirs(dirs["build"]) | 40 | os.makedirs(dirs["build"]) |
36 | 41 | ||
37 | self._run("cd {build} && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON {source}".format(**dirs)) | 42 | 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)) | 43 | self._run("cmake --build {build} -- -j".format(**dirs)) |
39 | self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs)) | 44 | 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")) | 45 | 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..fc28b9c3d4 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 | ||
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/gtk3.py index eb3c8ddf39..c329c4bb86 100644 --- a/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ b/meta/lib/oeqa/sdk/cases/gtk3.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,7 +13,7 @@ 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 GalculatorTest(OESDKTestCase): | 16 | class GTK3Test(OESDKTestCase): |
15 | """ | 17 | """ |
16 | Test that autotools and GTK+ 3 compiles correctly. | 18 | Test that autotools and GTK+ 3 compiles correctly. |
17 | """ | 19 | """ |
@@ -19,7 +21,8 @@ class GalculatorTest(OESDKTestCase): | |||
19 | if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \ | 21 | if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \ |
20 | self.tc.hasTargetPackage("libgtk-3.0", multilib=True)): | 22 | self.tc.hasTargetPackage("libgtk-3.0", multilib=True)): |
21 | raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") | 23 | raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") |
22 | if not (self.tc.hasHostPackage("nativesdk-gettext-dev")): | 24 | if not (self.tc.hasHostPackage("nativesdk-gettext-dev") or |
25 | self.tc.hasHostPackage("gettext-native")): | ||
23 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") | 26 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext") |
24 | 27 | ||
25 | def test_galculator(self): | 28 | def test_galculator(self): |
diff --git a/meta/lib/oeqa/sdk/cases/buildlzip.py b/meta/lib/oeqa/sdk/cases/makefile.py index 49ae756bf3..2ff54ce25f 100644 --- a/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py | |||
@@ -1,13 +1,15 @@ | |||
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 |
6 | from oeqa.sdk.case import OESDKTestCase | 8 | from oeqa.sdk.case import OESDKTestCase |
7 | from oeqa.utils.subprocesstweak import errors_have_output | 9 | from oeqa.utils.subprocesstweak import errors_have_output |
8 | errors_have_output() | 10 | errors_have_output() |
9 | 11 | ||
10 | class BuildLzipTest(OESDKTestCase): | 12 | class MakefileTest(OESDKTestCase): |
11 | """ | 13 | """ |
12 | Test that "plain" compilation works, using just $CC $CFLAGS etc. | 14 | Test that "plain" compilation works, using just $CC $CFLAGS etc. |
13 | """ | 15 | """ |
diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py new file mode 100644 index 0000000000..20f6b553d0 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/maturin.py | |||
@@ -0,0 +1,78 @@ | |||
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 | if not ( | ||
20 | self.tc.hasHostPackage("nativesdk-python3-maturin") | ||
21 | or self.tc.hasHostPackage("python3-maturin-native") | ||
22 | ): | ||
23 | raise unittest.SkipTest("No python3-maturin package in the SDK") | ||
24 | |||
25 | def test_maturin_list_python(self): | ||
26 | py_major = self._run("python3 -c 'import sys; print(sys.version_info.major)'") | ||
27 | py_minor = self._run("python3 -c 'import sys; print(sys.version_info.minor)'") | ||
28 | python_version = "%s.%s" % (py_major.strip(), py_minor.strip()) | ||
29 | cmd = "maturin list-python" | ||
30 | output = self._run(cmd) | ||
31 | self.assertRegex(output, r"^🐍 1 python interpreter found:\n") | ||
32 | self.assertRegex( | ||
33 | output, | ||
34 | r" - CPython %s (.+)/usr/bin/python%s$" % (python_version, python_version), | ||
35 | ) | ||
36 | |||
37 | |||
38 | class MaturinDevelopTest(OESDKTestCase): | ||
39 | @classmethod | ||
40 | def setUpClass(self): | ||
41 | targetdir = os.path.join(self.tc.sdk_dir, "guessing-game") | ||
42 | try: | ||
43 | shutil.rmtree(targetdir) | ||
44 | except FileNotFoundError: | ||
45 | pass | ||
46 | shutil.copytree( | ||
47 | os.path.join(self.tc.files_dir, "maturin/guessing-game"), targetdir | ||
48 | ) | ||
49 | |||
50 | def setUp(self): | ||
51 | machine = self.td.get("MACHINE") | ||
52 | if not ( | ||
53 | self.tc.hasHostPackage("nativesdk-python3-maturin") | ||
54 | or self.tc.hasHostPackage("python3-maturin-native") | ||
55 | ): | ||
56 | raise unittest.SkipTest("No python3-maturin package in the SDK") | ||
57 | if not ( | ||
58 | self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine) | ||
59 | ): | ||
60 | raise unittest.SkipTest( | ||
61 | "Testing 'maturin develop' requires Rust cross-canadian in the SDK" | ||
62 | ) | ||
63 | |||
64 | def test_maturin_develop(self): | ||
65 | """ | ||
66 | This test case requires: | ||
67 | (1) that a .venv can been created. | ||
68 | (2) a functional 'rustc' and 'cargo' | ||
69 | """ | ||
70 | self._run("cd %s/guessing-game; python3 -m venv .venv" % self.tc.sdk_dir) | ||
71 | cmd = "cd %s/guessing-game; maturin develop" % self.tc.sdk_dir | ||
72 | output = self._run(cmd) | ||
73 | self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8") | ||
74 | self.assertRegex(output, r"🐍 Not using a specific python interpreter") | ||
75 | self.assertRegex(output, r"📡 Using build options features from pyproject.toml") | ||
76 | self.assertRegex(output, r"Compiling guessing-game v0.1.0") | ||
77 | self.assertRegex(output, r"📦 Built wheel for abi3 Python ≥ 3.8") | ||
78 | self.assertRegex(output, r"🛠 Installed guessing-game-0.1.0") | ||
diff --git a/meta/lib/oeqa/sdk/cases/buildepoxy.py b/meta/lib/oeqa/sdk/cases/meson.py index 385f8ccca8..be53df204a 100644 --- a/meta/lib/oeqa/sdk/cases/buildepoxy.py +++ b/meta/lib/oeqa/sdk/cases/meson.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,13 +13,14 @@ 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 EpoxyTest(OESDKTestCase): | 16 | class MesonTest(OESDKTestCase): |
15 | """ | 17 | """ |
16 | Test that Meson builds correctly. | 18 | Test that Meson builds correctly. |
17 | """ | 19 | """ |
18 | def setUp(self): | 20 | def setUp(self): |
19 | if not (self.tc.hasHostPackage("nativesdk-meson")): | 21 | if not (self.tc.hasHostPackage("nativesdk-meson") or |
20 | raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain Meson") | 22 | self.tc.hasHostPackage("meson-native")): |
23 | raise unittest.SkipTest("MesonTest: needs meson") | ||
21 | 24 | ||
22 | def test_epoxy(self): | 25 | def test_epoxy(self): |
23 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: | 26 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: |
@@ -32,7 +35,7 @@ class EpoxyTest(OESDKTestCase): | |||
32 | self.assertTrue(os.path.isdir(dirs["source"])) | 35 | self.assertTrue(os.path.isdir(dirs["source"])) |
33 | os.makedirs(dirs["build"]) | 36 | os.makedirs(dirs["build"]) |
34 | 37 | ||
35 | log = self._run("meson -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) | 38 | log = self._run("meson --warnlevel 1 -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 | 39 | # Check that Meson thinks we're doing a cross build and not a native |
37 | self.assertIn("Build type: cross build", log) | 40 | self.assertIn("Build type: cross build", log) |
38 | self._run("ninja -C {build} -v".format(**dirs)) | 41 | self._run("ninja -C {build} -v".format(**dirs)) |
diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py index 14d76d820f..8eab4442e8 100644 --- a/meta/lib/oeqa/sdk/cases/perl.py +++ b/meta/lib/oeqa/sdk/cases/perl.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 | ||
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index a334abce5f..51284949f5 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py | |||
@@ -1,24 +1,15 @@ | |||
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 | 7 | import unittest |
6 | from oeqa.sdk.case import OESDKTestCase | 8 | from oeqa.sdk.case import OESDKTestCase |
7 | 9 | ||
8 | from oeqa.utils.subprocesstweak import errors_have_output | 10 | from oeqa.utils.subprocesstweak import errors_have_output |
9 | errors_have_output() | 11 | errors_have_output() |
10 | 12 | ||
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): | 13 | class Python3Test(OESDKTestCase): |
23 | def setUp(self): | 14 | def setUp(self): |
24 | if not (self.tc.hasHostPackage("nativesdk-python3-core") or | 15 | if not (self.tc.hasHostPackage("nativesdk-python3-core") or |
diff --git a/meta/lib/oeqa/sdk/cases/rust.py b/meta/lib/oeqa/sdk/cases/rust.py new file mode 100644 index 0000000000..a54245851b --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/rust.py | |||
@@ -0,0 +1,56 @@ | |||
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 build' % self.tc.sdk_dir) | ||
35 | |||
36 | class RustHostCompileTest(OESDKTestCase): | ||
37 | td_vars = ['MACHINE', 'SDK_SYS'] | ||
38 | |||
39 | @classmethod | ||
40 | def setUpClass(self): | ||
41 | targetdir = os.path.join(self.tc.sdk_dir, "hello") | ||
42 | try: | ||
43 | shutil.rmtree(targetdir) | ||
44 | except FileNotFoundError: | ||
45 | pass | ||
46 | shutil.copytree(os.path.join(self.tc.sdk_files_dir, "rust/hello"), targetdir) | ||
47 | |||
48 | def setUp(self): | ||
49 | machine = self.td.get("MACHINE") | ||
50 | if not self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine): | ||
51 | raise unittest.SkipTest("RustCompileTest class: SDK doesn't contain a Rust cross-canadian toolchain") | ||
52 | |||
53 | def test_cargo_build(self): | ||
54 | sdksys = self.td.get("SDK_SYS") | ||
55 | self._run('cd %s/hello; cargo build --target %s-gnu' % (self.tc.sdk_dir, sdksys)) | ||
56 | self._run('cd %s/hello; cargo run --target %s-gnu' % (self.tc.sdk_dir, sdksys)) | ||
diff --git a/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml b/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml new file mode 100644 index 0000000000..fe619478a6 --- /dev/null +++ b/meta/lib/oeqa/sdk/files/rust/hello/Cargo.toml | |||
@@ -0,0 +1,6 @@ | |||
1 | [package] | ||
2 | name = "hello" | ||
3 | version = "0.1.0" | ||
4 | edition = "2021" | ||
5 | |||
6 | [dependencies] | ||
diff --git a/meta/lib/oeqa/sdk/files/rust/hello/build.rs b/meta/lib/oeqa/sdk/files/rust/hello/build.rs new file mode 100644 index 0000000000..b1a533d5df --- /dev/null +++ b/meta/lib/oeqa/sdk/files/rust/hello/build.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | /* This is the simplest build script just to invoke host compiler | ||
2 | in the build process. */ | ||
3 | fn main() {} | ||
diff --git a/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs b/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs new file mode 100644 index 0000000000..a06c03f82a --- /dev/null +++ b/meta/lib/oeqa/sdk/files/rust/hello/src/main.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | println!("Hello, OpenEmbedded world!"); | ||
3 | } | ||
diff --git a/meta/lib/oeqa/sdk/testmetaidesupport.py b/meta/lib/oeqa/sdk/testmetaidesupport.py new file mode 100644 index 0000000000..00ef30e82e --- /dev/null +++ b/meta/lib/oeqa/sdk/testmetaidesupport.py | |||
@@ -0,0 +1,45 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | class TestSDK(object): | ||
8 | def run(self, d): | ||
9 | import json | ||
10 | import logging | ||
11 | from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor | ||
12 | from oeqa.utils import make_logger_bitbake_compatible | ||
13 | |||
14 | pn = d.getVar("PN") | ||
15 | |||
16 | logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) | ||
17 | |||
18 | sdk_dir = d.expand("${WORKDIR}/testsdk/") | ||
19 | bb.utils.remove(sdk_dir, True) | ||
20 | bb.utils.mkdirhier(sdk_dir) | ||
21 | |||
22 | sdk_envs = OESDKTestContextExecutor._get_sdk_environs(d.getVar("DEPLOY_DIR_IMAGE")) | ||
23 | tdname = d.expand("${DEPLOY_DIR_IMAGE}/${PN}.testdata.json") | ||
24 | test_data = json.load(open(tdname, "r")) | ||
25 | |||
26 | host_pkg_manifest = {"cmake-native":"", "gcc-cross":"", "gettext-native":"", "meson-native":"", "perl-native":"", "python3-core-native":"", } | ||
27 | target_pkg_manifest = {"gtk+3":""} | ||
28 | |||
29 | for s in sdk_envs: | ||
30 | bb.plain("meta-ide-support based SDK testing environment: %s" % s) | ||
31 | |||
32 | sdk_env = sdk_envs[s] | ||
33 | |||
34 | tc = OESDKTestContext(td=test_data, logger=logger, sdk_dir=sdk_dir, | ||
35 | sdk_env=sdk_env, target_pkg_manifest=target_pkg_manifest, | ||
36 | host_pkg_manifest=host_pkg_manifest) | ||
37 | |||
38 | tc.loadTests(OESDKTestContextExecutor.default_cases) | ||
39 | |||
40 | results = tc.runTests() | ||
41 | if results: | ||
42 | results.logSummary(pn) | ||
43 | |||
44 | if (not results) or (not results.wasSuccessful()): | ||
45 | bb.fatal('%s - FAILED' % (pn,), forcelog=True) | ||
diff --git a/meta/lib/oeqa/sdk/testsdk.py b/meta/lib/oeqa/sdk/testsdk.py index 35e40187bc..518b09febb 100644 --- a/meta/lib/oeqa/sdk/testsdk.py +++ b/meta/lib/oeqa/sdk/testsdk.py | |||
@@ -23,14 +23,6 @@ class TestSDKBase(object): | |||
23 | return configuration | 23 | return configuration |
24 | 24 | ||
25 | @staticmethod | 25 | @staticmethod |
26 | def get_sdk_json_result_dir(d): | ||
27 | json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa') | ||
28 | custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR") | ||
29 | if custom_json_result_dir: | ||
30 | json_result_dir = custom_json_result_dir | ||
31 | return json_result_dir | ||
32 | |||
33 | @staticmethod | ||
34 | def get_sdk_result_id(configuration): | 26 | def get_sdk_result_id(configuration): |
35 | return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME']) | 27 | return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME']) |
36 | 28 | ||
@@ -72,6 +64,7 @@ class TestSDK(TestSDKBase): | |||
72 | 64 | ||
73 | from bb.utils import export_proxies | 65 | from bb.utils import export_proxies |
74 | from oeqa.utils import make_logger_bitbake_compatible | 66 | from oeqa.utils import make_logger_bitbake_compatible |
67 | from oeqa.utils import get_json_result_dir | ||
75 | 68 | ||
76 | pn = d.getVar("PN") | 69 | pn = d.getVar("PN") |
77 | logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) | 70 | logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) |
@@ -79,6 +72,9 @@ class TestSDK(TestSDKBase): | |||
79 | # sdk use network for download projects for build | 72 | # sdk use network for download projects for build |
80 | export_proxies(d) | 73 | export_proxies(d) |
81 | 74 | ||
75 | # We need the original PATH for testing the eSDK, not with our manipulations | ||
76 | os.environ['PATH'] = d.getVar("BB_ORIGENV", False).getVar("PATH") | ||
77 | |||
82 | tcname = self.get_tcname(d) | 78 | tcname = self.get_tcname(d) |
83 | 79 | ||
84 | if not os.path.exists(tcname): | 80 | if not os.path.exists(tcname): |
@@ -131,7 +127,7 @@ class TestSDK(TestSDKBase): | |||
131 | component = "%s %s" % (pn, self.context_executor_class.name) | 127 | component = "%s %s" % (pn, self.context_executor_class.name) |
132 | context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) | 128 | context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) |
133 | configuration = self.get_sdk_configuration(d, self.test_type) | 129 | configuration = self.get_sdk_configuration(d, self.test_type) |
134 | result.logDetails(self.get_sdk_json_result_dir(d), | 130 | result.logDetails(get_json_result_dir(d), |
135 | configuration, | 131 | configuration, |
136 | self.get_sdk_result_id(configuration)) | 132 | self.get_sdk_result_id(configuration)) |
137 | result.logSummary(component, context_msg) | 133 | result.logSummary(component, context_msg) |