summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases
diff options
context:
space:
mode:
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)12
-rw-r--r--meta/lib/oeqa/sdk/cases/cmake.py (renamed from meta/lib/oeqa/sdk/cases/assimp.py)17
-rw-r--r--meta/lib/oeqa/sdk/cases/gcc.py2
-rw-r--r--meta/lib/oeqa/sdk/cases/gtk3.py (renamed from meta/lib/oeqa/sdk/cases/buildgalculator.py)7
-rw-r--r--meta/lib/oeqa/sdk/cases/makefile.py (renamed from meta/lib/oeqa/sdk/cases/buildlzip.py)6
-rw-r--r--meta/lib/oeqa/sdk/cases/maturin.py78
-rw-r--r--meta/lib/oeqa/sdk/cases/meson.py (renamed from meta/lib/oeqa/sdk/cases/buildepoxy.py)11
-rw-r--r--meta/lib/oeqa/sdk/cases/perl.py2
-rw-r--r--meta/lib/oeqa/sdk/cases/python.py15
-rw-r--r--meta/lib/oeqa/sdk/cases/rust.py56
10 files changed, 174 insertions, 32 deletions
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
5import os 7import os
6import tempfile 8import tempfile
7import subprocess 9import subprocess
8import unittest
9 10
10from oeqa.sdk.case import OESDKTestCase 11from oeqa.sdk.case import OESDKTestCase
11from oeqa.utils.subprocesstweak import errors_have_output 12from oeqa.utils.subprocesstweak import errors_have_output
12errors_have_output() 13errors_have_output()
13 14
14class BuildCpioTest(OESDKTestCase): 15class 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
11from oeqa.utils.subprocesstweak import errors_have_output 13from oeqa.utils.subprocesstweak import errors_have_output
12errors_have_output() 14errors_have_output()
13 15
14class BuildAssimp(OESDKTestCase): 16class 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
11from oeqa.utils.subprocesstweak import errors_have_output 13from oeqa.utils.subprocesstweak import errors_have_output
12errors_have_output() 14errors_have_output()
13 15
14class GalculatorTest(OESDKTestCase): 16class 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
5import os, tempfile, subprocess, unittest 7import os, tempfile, subprocess
6from oeqa.sdk.case import OESDKTestCase 8from oeqa.sdk.case import OESDKTestCase
7from oeqa.utils.subprocesstweak import errors_have_output 9from oeqa.utils.subprocesstweak import errors_have_output
8errors_have_output() 10errors_have_output()
9 11
10class BuildLzipTest(OESDKTestCase): 12class 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
7import os
8import shutil
9import unittest
10
11from oeqa.sdk.case import OESDKTestCase
12from oeqa.utils.subprocesstweak import errors_have_output
13
14errors_have_output()
15
16
17class 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
38class 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
11from oeqa.utils.subprocesstweak import errors_have_output 13from oeqa.utils.subprocesstweak import errors_have_output
12errors_have_output() 14errors_have_output()
13 15
14class EpoxyTest(OESDKTestCase): 16class 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
5import subprocess, unittest 7import unittest
6from oeqa.sdk.case import OESDKTestCase 8from oeqa.sdk.case import OESDKTestCase
7 9
8from oeqa.utils.subprocesstweak import errors_have_output 10from oeqa.utils.subprocesstweak import errors_have_output
9errors_have_output() 11errors_have_output()
10 12
11class 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
22class Python3Test(OESDKTestCase): 13class 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
7import os
8import shutil
9import unittest
10
11from oeqa.sdk.case import OESDKTestCase
12
13from oeqa.utils.subprocesstweak import errors_have_output
14errors_have_output()
15
16class 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
36class 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))