summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-10-05 14:28:39 -0700
committerKhem Raj <raj.khem@gmail.com>2023-10-09 13:10:02 -0700
commit30779662be112081096fb9a223acb0f8a4ccd6f3 (patch)
tree7e6510fde5b930b7adc0aabd781708716db3e527 /meta-oe/recipes-kernel
parent8930d8798b44f538fcfb2013cf273c4534778404 (diff)
downloadmeta-openembedded-30779662be112081096fb9a223acb0f8a4ccd6f3.tar.gz
kernel-selftest: Build bpf tests again
Fix run-ptest script to run all compiled selftests disable bpf on riscv for now Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-kernel')
-rw-r--r--meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb38
-rwxr-xr-xmeta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest10
2 files changed, 31 insertions, 17 deletions
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
index 4d6e0e371..e4eba5f95 100644
--- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -18,7 +18,7 @@ SRC_URI += "file://run-ptest \
18# we will append other kernel selftest in the future 18# we will append other kernel selftest in the future
19# bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d 19# bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
20# if you have older kernel than that you need to remove it from PACKAGECONFIG 20# if you have older kernel than that you need to remove it from PACKAGECONFIG
21PACKAGECONFIG ??= "firmware" 21PACKAGECONFIG ??= "firmware bpf"
22PACKAGECONFIG:remove:x86 = "bpf" 22PACKAGECONFIG:remove:x86 = "bpf"
23PACKAGECONFIG:remove:arm = "bpf vm" 23PACKAGECONFIG:remove:arm = "bpf vm"
24# host ptrace.h is used to compile BPF target but mips ptrace.h is needed 24# host ptrace.h is used to compile BPF target but mips ptrace.h is needed
@@ -28,33 +28,42 @@ PACKAGECONFIG:remove:arm = "bpf vm"
28PACKAGECONFIG:remove:qemumips = "bpf vm" 28PACKAGECONFIG:remove:qemumips = "bpf vm"
29 29
30# riscv does not support libhugetlbfs yet 30# riscv does not support libhugetlbfs yet
31PACKAGECONFIG:remove:riscv64 = "vm" 31PACKAGECONFIG:remove:riscv64 = "bpf vm"
32PACKAGECONFIG:remove:riscv32 = "vm" 32PACKAGECONFIG:remove:riscv32 = "bpf vm"
33 33
34PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," 34PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native,"
35PACKAGECONFIG[firmware] = ",,libcap, bash" 35PACKAGECONFIG[firmware] = ",,libcap, bash"
36PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" 36PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash"
37 37
38do_patch[depends] += "virtual/kernel:do_shared_workdir" 38do_patch[depends] += "virtual/kernel:do_shared_workdir"
39do_compile[depends] += "virtual/kernel:do_install"
39 40
40inherit linux-kernel-base kernel-arch ptest 41inherit linux-kernel-base module-base kernel-arch ptest siteinfo
41 42
42S = "${WORKDIR}/${BP}" 43S = "${WORKDIR}/${BP}"
43 44
45DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
46
44TEST_LIST = "\ 47TEST_LIST = "\
45 ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \ 48 ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \
46 rtc \ 49 rtc \
47" 50"
48
49EXTRA_OEMAKE = '\ 51EXTRA_OEMAKE = '\
50 CROSS_COMPILE=${TARGET_PREFIX} \ 52 CROSS_COMPILE=${TARGET_PREFIX} \
51 ARCH=${ARCH} \ 53 ARCH=${ARCH} \
52 CC="${CC}" \ 54 CC="${CC}" \
53 CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS}" \
54 AR="${AR}" \ 55 AR="${AR}" \
55 LD="${LD}" \ 56 LD="${LD}" \
57 LLVM=1 \
58 CONFIG_CC_IS_GCC= \
59 CONFIG_CC_IS_CLANG=y \
60 CONFIG_CC_IMPLICIT_FALLTHROUGH= \
61 CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
62 HOSTCC="clang -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ ${BUILD_CFLAGS} ${BUILD_LDFLAGS} -Wno-error=unused-command-line-argument" \
63 HOSTLD="clang ${BUILD_LDFLAGS} -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++" \
56 DESTDIR="${D}" \ 64 DESTDIR="${D}" \
57 MACHINE="${ARCH}" \ 65 MACHINE="${ARCH}" \
66 V=1 \
58' 67'
59 68
60KERNEL_SELFTEST_SRC ?= "Makefile \ 69KERNEL_SELFTEST_SRC ?= "Makefile \
@@ -66,7 +75,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \
66 arch \ 75 arch \
67 LICENSES \ 76 LICENSES \
68" 77"
69
70do_compile() { 78do_compile() {
71 if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False', d)} = 'True' ]; then 79 if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False', d)} = 'True' ]; then
72 if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True', 'False', d)} = 'False' ]; then 80 if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True', 'False', d)} = 'False' ]; then
@@ -74,7 +82,17 @@ do_compile() {
74either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency" 82either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency"
75 fi 83 fi
76 fi 84 fi
85 mkdir -p ${S}/include/config ${S}/bits
86 touch ${S}/include/config/auto.conf
87 if [ "${SITEINFO_BITS}" != "32" ]; then
88 for f in long-double endianness floatn struct_rwlock; do
89 cp ${RECIPE_SYSROOT}${includedir}/bits/$f-64.h ${S}/bits/$f-32.h
90 done
91 fi
77 oe_runmake -C ${S} headers 92 oe_runmake -C ${S} headers
93 sed -i -e 's|^all: docs|all:|' ${S}/tools/testing/selftests/bpf/Makefile
94 sed -i -e '/mrecord-mcount/d' ${S}/Makefile
95 sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
78 for i in ${TEST_LIST} 96 for i in ${TEST_LIST}
79 do 97 do
80 oe_runmake -C ${S}/tools/testing/selftests/${i} 98 oe_runmake -C ${S}/tools/testing/selftests/${i}
@@ -133,9 +151,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
133INHIBIT_PACKAGE_DEBUG_SPLIT="1" 151INHIBIT_PACKAGE_DEBUG_SPLIT="1"
134FILES:${PN} += "/usr/kernel-selftest" 152FILES:${PN} += "/usr/kernel-selftest"
135 153
136RDEPENDS:${PN} += "python3 perl" 154RDEPENDS:${PN} += "python3 perl perl-module-io-handle"
137# tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty 155# tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty
138INSANE_SKIP:${PN} += "ldflags" 156INSANE_SKIP:${PN} += "ldflags libdir"
139 157
140SECURITY_CFLAGS = "" 158SECURITY_CFLAGS = ""
141COMPATIBLE_HOST:libc-musl = 'null' 159COMPATIBLE_HOST:libc-musl = 'null'
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest
index d40b9576d..0903d097e 100755
--- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest
@@ -1,11 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2export PATH=$PATH:/usr/kernel-selftest/bpf 2/usr/kernel-selftest/run_kselftest.sh -s
3
4# test_align
5test_align | grep "12 pass" &> /dev/null
6if [ $? == 0 ]; then 3if [ $? == 0 ]; then
7 echo "[PASS]: test_align" 4 echo "PASS: kernel-selftest"
8else 5else
9 echo "[FAIL]: test_align" 6 echo "[FAIL]: kernel-selftest"
10fi 7fi
11