summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel/kernel-selftest
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-kernel/kernel-selftest')
-rw-r--r--meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb41
-rw-r--r--meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch34
2 files changed, 51 insertions, 24 deletions
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
index 01f185adba..14aa5d0c0c 100644
--- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -2,16 +2,19 @@ SUMMARY = "Kernel selftest for Linux"
2DESCRIPTION = "Kernel selftest for Linux" 2DESCRIPTION = "Kernel selftest for Linux"
3LICENSE = "GPL-2.0-only" 3LICENSE = "GPL-2.0-only"
4 4
5LIC_FILES_CHKSUM = "file://../COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 5LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
6 6
7DEPENDS = "rsync-native llvm-native" 7DEPENDS = "rsync-native llvm-native"
8 8
9S = "${UNPACKDIR}"
10
9# for musl libc 11# for musl libc
10SRC_URI:append:libc-musl = "\ 12SRC_URI:append:libc-musl = "\
11 file://userfaultfd.patch \ 13 file://userfaultfd.patch \
12 " 14 "
13SRC_URI += "file://run-ptest \ 15SRC_URI += "file://run-ptest \
14 file://COPYING \ 16 file://COPYING \
17 file://0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch \
15 " 18 "
16 19
17# now we just test bpf and vm 20# now we just test bpf and vm
@@ -42,8 +45,6 @@ do_compile[depends] += "virtual/kernel:do_install"
42 45
43inherit linux-kernel-base module-base kernel-arch ptest siteinfo 46inherit linux-kernel-base module-base kernel-arch ptest siteinfo
44 47
45S = "${WORKDIR}/${BP}"
46
47DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" 48DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
48 49
49TEST_LIST = "\ 50TEST_LIST = "\
@@ -55,7 +56,7 @@ TEST_LIST = "\
55EXTRA_OEMAKE = '\ 56EXTRA_OEMAKE = '\
56 CROSS_COMPILE=${TARGET_PREFIX} \ 57 CROSS_COMPILE=${TARGET_PREFIX} \
57 ARCH=${ARCH} \ 58 ARCH=${ARCH} \
58 CC="${CC}" \ 59 CC="${CC} ${DEBUG_PREFIX_MAP}" \
59 AR="${AR}" \ 60 AR="${AR}" \
60 LD="${LD}" \ 61 LD="${LD}" \
61 CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \ 62 CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
@@ -96,33 +97,17 @@ either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
96 sed -i -e '/mrecord-mcount/d' ${S}/Makefile 97 sed -i -e '/mrecord-mcount/d' ${S}/Makefile
97 sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile 98 sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
98 sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.* 99 sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
99 for i in ${TEST_LIST} 100 oe_runmake -C ${S}/tools/testing/selftests TARGETS="${TEST_LIST}"
100 do
101 oe_runmake -C ${S}/tools/testing/selftests/${i}
102 done
103} 101}
104 102
105do_install() { 103do_install() {
106 for i in ${TEST_LIST} 104 oe_runmake -C ${S}/tools/testing/selftests INSTALL_PATH=${D}/usr/kernel-selftest TARGETS="${TEST_LIST}" install
107 do
108 oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
109 # Install kselftest-list.txt that required by kselftest runner.
110 oe_runmake -s --no-print-directory COLLECTION=${i} -C ${S}/tools/testing/selftests/${i} emit_tests \
111 >> ${D}/usr/kernel-selftest/kselftest-list.txt
112 done
113 # Install kselftest runner.
114 install -m 0755 ${S}/tools/testing/selftests/run_kselftest.sh ${D}/usr/kernel-selftest/
115 cp -R --no-dereference --preserve=mode,links -v ${S}/tools/testing/selftests/kselftest ${D}/usr/kernel-selftest/
116 if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then 105 if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
117 sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py 106 sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
118 fi 107 fi
119 chown root:root -R ${D}/usr/kernel-selftest 108 chown root:root -R ${D}/usr/kernel-selftest
120} 109}
121 110
122do_configure() {
123 install -D -m 0644 ${WORKDIR}/COPYING ${S}/COPYING
124}
125
126do_patch[prefuncs] += "copy_kselftest_source_from_kernel remove_unrelated" 111do_patch[prefuncs] += "copy_kselftest_source_from_kernel remove_unrelated"
127python copy_kselftest_source_from_kernel() { 112python copy_kselftest_source_from_kernel() {
128 sources = (d.getVar("KERNEL_SELFTEST_SRC") or "").split() 113 sources = (d.getVar("KERNEL_SELFTEST_SRC") or "").split()
@@ -149,15 +134,23 @@ remove_unrelated() {
149 fi 134 fi
150} 135}
151 136
137do_configure[dirs] = "${S}"
138
152PACKAGE_ARCH = "${MACHINE_ARCH}" 139PACKAGE_ARCH = "${MACHINE_ARCH}"
153 140
154INHIBIT_PACKAGE_DEBUG_SPLIT="1" 141INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
155FILES:${PN} += "/usr/kernel-selftest" 142FILES:${PN} += "/usr/kernel-selftest"
156 143
157RDEPENDS:${PN} += "python3 perl perl-module-io-handle" 144RDEPENDS:${PN} += "python3 perl perl-module-io-handle"
158 145
159INSANE_SKIP:${PN} += "libdir" 146INSANE_SKIP:${PN} += "libdir"
160 147
148# A few of the selftests set compile flags that trip up the "ldflags" and
149# "already-stripped" QA checks. As this is mainly a testing package and
150# not really meant for user level execution, disable these two checks.
151INSANE_SKIP:${PN} += "ldflags"
152INSANE_SKIP:${PN} += "already-stripped"
153
161SECURITY_CFLAGS = "" 154SECURITY_CFLAGS = ""
162COMPATIBLE_HOST:libc-musl = 'null' 155COMPATIBLE_HOST:libc-musl = 'null'
163 156
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch
new file mode 100644
index 0000000000..bf5525c361
--- /dev/null
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch
@@ -0,0 +1,34 @@
1From 34021e84d03e2becb88e6c28e8e4867e82a81da5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 17 Sep 2024 17:40:03 -0700
4Subject: [PATCH] selftests: timers: Fix clock_adjtime for newer 32-bit arches
5
6Newer 32-bit architectures e.g. riscv32 are using 64-bit time_t
7from get go, they have not wired __NR_clock_adjtime at all
8valid-adjtimex testcase fails to compile on such architectures.
9if this condition is found then use 64-bit adjtime syscall
10
11Upstream-Status: Submitted [https://patchwork.kernel.org/project/linux-kselftest/patch/20240918004731.3295870-1-raj.khem@gmail.com/]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Cc: John Stultz <jstultz@google.com>
14Cc: Shuah Khan <shuah@kernel.org>
15---
16 tools/testing/selftests/timers/valid-adjtimex.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
20index d500884801d8..ff4ff8b1d127 100644
21--- a/tools/testing/selftests/timers/valid-adjtimex.c
22+++ b/tools/testing/selftests/timers/valid-adjtimex.c
23@@ -39,7 +39,11 @@
24 #include <sys/syscall.h>
25 int clock_adjtime(clockid_t id, struct timex *tx)
26 {
27+#if !defined(__NR_clock_adjtime) && defined(__NR_clock_adjtime64)
28+ return syscall(__NR_clock_adjtime64, id, tx);
29+#else
30 return syscall(__NR_clock_adjtime, id, tx);
31+#endif
32 }
33
34