Skip to content

Commit b9b60fb

Browse files
bhcopelandroxell
authored andcommitted
kselftest: pass KDIR to enable out-of-tree module builds
Some kselftest suites (e.g. livepatch) include kernel modules built via TEST_GEN_MODS_DIR. The test_modules Makefile defaults KDIR to the host kernel build directory, which does not exist during cross-compilation. This causes the module build to be silently skipped, and the subsequent install step fails when rsync cannot find any .ko files. Pass KDIR={build_dir} so that test modules are built against the kernel being compiled. Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
1 parent 5e04e16 commit b9b60fb

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

test/test_target.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ def test_no_exclude_for_gcc(self, build):
213213
kselftest = Kselftest("kselftest", build)
214214
assert not getattr(kselftest, "exclude_build_makevars", set())
215215

216+
def test_kdir_set_to_build_dir(self, build):
217+
build.toolchain.name = "gcc-14"
218+
kselftest = Kselftest("kselftest", build)
219+
assert kselftest.makevars.get("KDIR") == "{build_dir}"
220+
216221

217222
class TestCompression:
218223
def test_invalid_compression(self):

tuxmake/target/kselftest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ commands = {make} -C tools/testing/selftests install
77

88
[makevars]
99
INSTALL_PATH = {build_dir}/kselftest_install
10+
KDIR = {build_dir}
1011

1112
[artifacts]
1213
kselftest.tar{z_ext} = kselftest.tar{z_ext}

0 commit comments

Comments
 (0)