diff options
| author | Ross Burton <ross.burton@arm.com> | 2024-07-12 19:43:58 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-18 17:21:39 +0100 |
| commit | e64be51ed563157e288ec8312f0820f9928ddbb3 (patch) | |
| tree | 4876ca1586edbbdd16a27ebfd8891b0262027aa3 /meta | |
| parent | a798d00d54a1424f9972de43ff05a0ca8950d7de (diff) | |
| download | poky-e64be51ed563157e288ec8312f0820f9928ddbb3.tar.gz | |
oeqa/sdk: add out-of-tree kernel module building test
Validate that out-of-tree kernel module building using kernel-devsrc
works as expected.
This test uses cryptodev-linux as a idiomatic out of tree module. As the
latest release doesn't actually build with kernel 6.7+, use the same
commit that our recipe uses.
(From OE-Core rev: 8a1c1054815ecc0302c62134f293b8e1f959798a)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -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")) | ||
