summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/cases/kmod.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/kmod.py')
-rw-r--r--meta/lib/oeqa/sdk/cases/kmod.py39
1 files changed, 39 insertions, 0 deletions
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
7import os
8import subprocess
9import tempfile
10
11from oeqa.sdk.case import OESDKTestCase
12from oeqa.sdkext.context import OESDKExtTestContext
13from oeqa.utils.subprocesstweak import errors_have_output
14errors_have_output()
15
16class 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"))