diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-10-05 14:28:39 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-10-09 13:10:02 -0700 |
commit | 30779662be112081096fb9a223acb0f8a4ccd6f3 (patch) | |
tree | 7e6510fde5b930b7adc0aabd781708716db3e527 /meta-oe/recipes-kernel | |
parent | 8930d8798b44f538fcfb2013cf273c4534778404 (diff) | |
download | meta-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.bb | 38 | ||||
-rwxr-xr-x | meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest | 10 |
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 |
21 | PACKAGECONFIG ??= "firmware" | 21 | PACKAGECONFIG ??= "firmware bpf" |
22 | PACKAGECONFIG:remove:x86 = "bpf" | 22 | PACKAGECONFIG:remove:x86 = "bpf" |
23 | PACKAGECONFIG:remove:arm = "bpf vm" | 23 | PACKAGECONFIG: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" | |||
28 | PACKAGECONFIG:remove:qemumips = "bpf vm" | 28 | PACKAGECONFIG:remove:qemumips = "bpf vm" |
29 | 29 | ||
30 | # riscv does not support libhugetlbfs yet | 30 | # riscv does not support libhugetlbfs yet |
31 | PACKAGECONFIG:remove:riscv64 = "vm" | 31 | PACKAGECONFIG:remove:riscv64 = "bpf vm" |
32 | PACKAGECONFIG:remove:riscv32 = "vm" | 32 | PACKAGECONFIG:remove:riscv32 = "bpf vm" |
33 | 33 | ||
34 | PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," | 34 | PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," |
35 | PACKAGECONFIG[firmware] = ",,libcap, bash" | 35 | PACKAGECONFIG[firmware] = ",,libcap, bash" |
36 | PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" | 36 | PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" |
37 | 37 | ||
38 | do_patch[depends] += "virtual/kernel:do_shared_workdir" | 38 | do_patch[depends] += "virtual/kernel:do_shared_workdir" |
39 | do_compile[depends] += "virtual/kernel:do_install" | ||
39 | 40 | ||
40 | inherit linux-kernel-base kernel-arch ptest | 41 | inherit linux-kernel-base module-base kernel-arch ptest siteinfo |
41 | 42 | ||
42 | S = "${WORKDIR}/${BP}" | 43 | S = "${WORKDIR}/${BP}" |
43 | 44 | ||
45 | DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" | ||
46 | |||
44 | TEST_LIST = "\ | 47 | TEST_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 | |||
49 | EXTRA_OEMAKE = '\ | 51 | EXTRA_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 | ||
60 | KERNEL_SELFTEST_SRC ?= "Makefile \ | 69 | KERNEL_SELFTEST_SRC ?= "Makefile \ |
@@ -66,7 +75,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \ | |||
66 | arch \ | 75 | arch \ |
67 | LICENSES \ | 76 | LICENSES \ |
68 | " | 77 | " |
69 | |||
70 | do_compile() { | 78 | do_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() { | |||
74 | either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency" | 82 | either 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}" | |||
133 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" | 151 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" |
134 | FILES:${PN} += "/usr/kernel-selftest" | 152 | FILES:${PN} += "/usr/kernel-selftest" |
135 | 153 | ||
136 | RDEPENDS:${PN} += "python3 perl" | 154 | RDEPENDS:${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 |
138 | INSANE_SKIP:${PN} += "ldflags" | 156 | INSANE_SKIP:${PN} += "ldflags libdir" |
139 | 157 | ||
140 | SECURITY_CFLAGS = "" | 158 | SECURITY_CFLAGS = "" |
141 | COMPATIBLE_HOST:libc-musl = 'null' | 159 | COMPATIBLE_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 |
2 | export PATH=$PATH:/usr/kernel-selftest/bpf | 2 | /usr/kernel-selftest/run_kselftest.sh -s |
3 | |||
4 | # test_align | ||
5 | test_align | grep "12 pass" &> /dev/null | ||
6 | if [ $? == 0 ]; then | 3 | if [ $? == 0 ]; then |
7 | echo "[PASS]: test_align" | 4 | echo "PASS: kernel-selftest" |
8 | else | 5 | else |
9 | echo "[FAIL]: test_align" | 6 | echo "[FAIL]: kernel-selftest" |
10 | fi | 7 | fi |
11 | |||