diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases')
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/kmod.py | 41 |
1 files changed, 41 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..9e8fdbcd40 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/kmod.py | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | import os | ||
| 8 | import subprocess | ||
| 9 | import tempfile | ||
| 10 | import unittest | ||
| 11 | |||
| 12 | from oeqa.sdk.case import OESDKTestCase | ||
| 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 | |||
| 21 | def setUp(self): | ||
| 22 | if not self.tc.hasTargetPackage("kernel-devsrc"): | ||
| 23 | raise unittest.SkipTest("KernelModuleTest needs kernel-devsrc") | ||
| 24 | |||
| 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 | |||
| 29 | def test_cryptodev(self): | ||
| 30 | with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir: | ||
| 31 | git_url = "https://github.com/cryptodev-linux/cryptodev-linux" | ||
| 32 | # This is a knnown-good commit post-1.13 that builds with kernel 6.7+ | ||
| 33 | git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f" | ||
| 34 | |||
| 35 | sourcedir = os.path.join(testdir, "cryptodev-linux") | ||
| 36 | subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT) | ||
| 37 | self.assertTrue(os.path.isdir(sourcedir)) | ||
| 38 | subprocess.check_output(["git", "-C", sourcedir, "checkout", git_sha], stderr=subprocess.STDOUT) | ||
| 39 | |||
| 40 | self._run("make -C %s V=1 KERNEL_DIR=$OECORE_TARGET_SYSROOT/usr/src/kernel" % sourcedir) | ||
| 41 | self.check_elf(os.path.join(sourcedir, "cryptodev.ko")) | ||
