kernel-selftest: Build bpf tests again
PATCH 1/2 kernel-selftest: Build bpf tests again
Fix run-ptest script to run all compiled selftests
--- .../kernel-selftest/kernel-selftest.bb | 34 ++++++++++++++----- .../kernel-selftest/kernel-selftest/run-ptest | 10 ++---- 2 files changed, 29 insertions(+), 15 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +26 -8
@@ -18,7 +18,7 @@ SRC_URI += "file://run-ptest \ # we will append other kernel selftest in the future # bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d # if you have older kernel than that you need to remove it from PACKAGECONFIG -PACKAGECONFIG ??= "firmware" +PACKAGECONFIG ??= "firmware bpf" PACKAGECONFIG:remove:x86 = "bpf" PACKAGECONFIG:remove:arm = "bpf vm" # host ptrace.h is used to compile BPF target but mips ptrace.h is needed
@@ -31,30 +31,39 @@ PACKAGECONFIG:remove:qemumips = "bpf vm" PACKAGECONFIG:remove:riscv64 = "vm" PACKAGECONFIG:remove:riscv32 = "vm" -PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," +PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," PACKAGECONFIG[firmware] = ",,libcap, bash" PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" do_patch[depends] += "virtual/kernel:do_shared_workdir" +do_compile[depends] += "virtual/kernel:do_install" -inherit linux-kernel-base kernel-arch ptest +inherit linux-kernel-base module-base kernel-arch ptest siteinfo S = "${WORKDIR}/${BP}" +DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" + TEST_LIST = "\ ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \ rtc \ " - EXTRA_OEMAKE = '\ CROSS_COMPILE=${TARGET_PREFIX} \ ARCH=${ARCH} \ CC="${CC}" \ - CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS}" \ AR="${AR}" \ LD="${LD}" \ + LLVM=1 \ + CONFIG_CC_IS_GCC= \ + CONFIG_CC_IS_CLANG=y \ + CONFIG_CC_IMPLICIT_FALLTHROUGH= \ + CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \ + HOSTCC="clang -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ ${BUILD_CFLAGS} ${BUILD_LDFLAGS} -Wno-error=unused-command-line-argument" \ + HOSTLD="clang ${BUILD_LDFLAGS} -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++" \ DESTDIR="${D}" \ MACHINE="${ARCH}" \ + V=1 \ ' KERNEL_SELFTEST_SRC ?= "Makefile \
@@ -66,7 +75,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \ arch \ LICENSES \ " - do_compile() { if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False', d)} = 'True' ]; then if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True', 'False', d)} = 'False' ]; then
@@ -74,7 +82,17 @@ do_compile() { either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency" fi fi + mkdir -p ${S}/include/config ${S}/bits + touch ${S}/include/config/auto.conf + if [ "${SITEINFO_BITS}" != "32" ]; then + for f in long-double endianness floatn struct_rwlock; do + cp ${RECIPE_SYSROOT}${includedir}/bits/$f-64.h ${S}/bits/$f-32.h + done + fi oe_runmake -C ${S} headers + sed -i -e 's|^all: docs|all:|' ${S}/tools/testing/selftests/bpf/Makefile + sed -i -e '/mrecord-mcount/d' ${S}/Makefile + sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile for i in ${TEST_LIST} do oe_runmake -C ${S}/tools/testing/selftests/${i}
@@ -133,9 +151,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" INHIBIT_PACKAGE_DEBUG_SPLIT="1" FILES:${PN} += "/usr/kernel-selftest" -RDEPENDS:${PN} += "python3 perl" +RDEPENDS:${PN} += "python3 perl perl-module-io-handle" # tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty -INSANE_SKIP:${PN} += "ldflags" +INSANE_SKIP:${PN} += "ldflags libdir" SECURITY_CFLAGS = "" COMPATIBLE_HOST:libc-musl = 'null'
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest +3 -7
@@ -1,11 +1,7 @@ #!/bin/sh -export PATH=$PATH:/usr/kernel-selftest/bpf - -# test_align -test_align | grep "12 pass" &> /dev/null +/usr/kernel-selftest/run_kselftest.sh -s if [ $? == 0 ]; then - echo "[PASS]: test_align" + echo "PASS: kernel-selftest" else - echo "[FAIL]: test_align" + echo "[FAIL]: kernel-selftest" fi -
Signature · 1 line
2.42.0
PATCH 2/2 ptest-packagelists-meta-oe: Add kernel-selftest to x86/x86-64 images
Test run for 10+ minutes so they belong to slow testset
--- meta-oe/conf/include/ptest-packagelists-meta-oe.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +3 -1
@@ -50,10 +50,12 @@ PTESTS_SLOW_META_OE = "\ rsyslog \ mariadb \ " +PTESTS_SLOW_META_OE:append:x86 = " kernel-selftest" +PTESTS_SLOW_META_OE:append:x86-64 = " kernel-selftest" +PTESTS_SLOW_META_OE:remove:libc-musl = "kernel-selftest" PTESTS_PROBLEMS_META_OE ="\ jemalloc \ - kernel-selftest \ keyutils \ libdbi-perl \ libgpiod \
Signature · 1 line
2.42.0
Does this patch introduce a requirement on clang? We are seeing build failures in our nightly master builds on kernel-selftst with clang not being found.
Quoted 133 lines · Khem Raj
Fix run-ptest script to run all compiled selftests
Signed-off-by Khem Raj <[email protected]>--- .../kernel-selftest/kernel-selftest.bb | 34 ++++++++++++++----- .../kernel-selftest/kernel-selftest/run-ptest | 10 ++---- 2 files changed, 29 insertions(+), 15 deletions(-)meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +26
-8@@ -18,7 +18,7 @@ SRC_URI += "file://run-ptest \ # we will append other kernel selftest in the future # bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d # if you have older kernel than that you need to remove it from PACKAGECONFIG -PACKAGECONFIG ??= "firmware" +PACKAGECONFIG ??= "firmware bpf" PACKAGECONFIG:remove:x86 = "bpf" PACKAGECONFIG:remove:arm = "bpf vm" # host ptrace.h is used to compile BPF target but mips ptrace.h is needed@@ -31,30 +31,39 @@ PACKAGECONFIG:remove:qemumips = "bpf vm" PACKAGECONFIG:remove:riscv64 = "vm" PACKAGECONFIG:remove:riscv32 = "vm" -PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," +PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," PACKAGECONFIG[firmware] = ",,libcap, bash" PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" do_patch[depends] += "virtual/kernel:do_shared_workdir" +do_compile[depends] += "virtual/kernel:do_install" -inherit linux-kernel-base kernel-arch ptest +inherit linux-kernel-base module-base kernel-arch ptest siteinfo S = "${WORKDIR}/${BP}" +DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" + TEST_LIST = "\ ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \ rtc \ " - EXTRA_OEMAKE = '\ CROSS_COMPILE=${TARGET_PREFIX} \ ARCH=${ARCH} \ CC="${CC}" \ - CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS}" \ AR="${AR}" \ LD="${LD}" \ + LLVM=1 \ + CONFIG_CC_IS_GCC= \ + CONFIG_CC_IS_CLANG=y \ + CONFIG_CC_IMPLICIT_FALLTHROUGH= \ + CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \ + HOSTCC="clang -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ ${BUILD_CFLAGS} ${BUILD_LDFLAGS} -Wno-error=unused-command-line-argument" \ + HOSTLD="clang ${BUILD_LDFLAGS} -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++" \ DESTDIR="${D}" \ MACHINE="${ARCH}" \ + V=1 \ ' KERNEL_SELFTEST_SRC ?= "Makefile \@@ -66,7 +75,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \ arch \ LICENSES \ " - do_compile() { if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False', d)} = 'True' ]; then if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True', 'False', d)} = 'False' ]; then@@ -74,7 +82,17 @@ do_compile() { either install it and add it to HOSTTOOLS, or add clang-native from meta-clang to dependency" fi fi + mkdir -p ${S}/include/config ${S}/bits + touch ${S}/include/config/auto.conf + if [ "${SITEINFO_BITS}" != "32" ]; then + for f in long-double endianness floatn struct_rwlock; do + cp ${RECIPE_SYSROOT}${includedir}/bits/$f-64.h ${S}/bits/$f-32.h + done + fi oe_runmake -C ${S} headers + sed -i -e 's|^all: docs|all:|' ${S}/tools/testing/selftests/bpf/Makefile + sed -i -e '/mrecord-mcount/d' ${S}/Makefile + sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile for i in ${TEST_LIST} do oe_runmake -C ${S}/tools/testing/selftests/${i}@@ -133,9 +151,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" INHIBIT_PACKAGE_DEBUG_SPLIT="1" FILES:${PN} += "/usr/kernel-selftest" -RDEPENDS:${PN} += "python3 perl" +RDEPENDS:${PN} += "python3 perl perl-module-io-handle" # tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty -INSANE_SKIP:${PN} += "ldflags" +INSANE_SKIP:${PN} += "ldflags libdir" SECURITY_CFLAGS = "" COMPATIBLE_HOST:libc-musl = 'null'meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest +3
-8@@ -1,11 +1,7 @@ #!/bin/sh -export PATH=$PATH:/usr/kernel-selftest/bpf - -# test_align -test_align | grep "12 pass" &> /dev/null +/usr/kernel-selftest/run_kselftest.sh -s if [ $? == 0 ]; then - echo "[PASS]: test_align" + echo "PASS: kernel-selftest" else - echo "[FAIL]: test_align" + echo "[FAIL]: kernel-selftest" fi - -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#105362): https://lists.openembedded.org/g/openembedded-devel/message/105362
Mute This Topic: https://lists.openembedded.org/mt/101786204/6551054
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS
Quoted 5 lines · Ryan Eatmon
Does this patch introduce a requirement on clang? We are seeing build failures in our nightly master builds on kernel-selftst with clang not being found.
Clang dependency was already there but I think some portions are specific to clang which perhaps can be covered with a bbappend eg the settings in extra oe make
Quoted 162 lines · Khem Raj
Review
Quoted 9 lines
Fix run-ptest script to run all compiled selftests
Signed-off-by Khem Raj <[email protected]>--- .../kernel-selftest/kernel-selftest.bb | 34 ++++++++++++++----- .../kernel-selftest/kernel-selftest/run-ptest | 10 ++---- 2 files changed, 29 insertions(+), 15 deletions(-)(quoted diff) +0
-0b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb SRC_URI += "file://run-ptest \ · line 19
Quoted 6 lines
index
4d6e0e3717..8fab1df391100644meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +0
-0@@ -18,7 +18,7 @@ SRC_URI += "file://run-ptest \ # we will append other kernel selftest in the future # bpf was added in 4.10 with:https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb SRC_URI += "file://run-ptest \ · line 20
Quoted 1 line
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +0
-0# if you have older kernel than that you need to remove it fromPACKAGECONFIG
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb SRC_URI += "file://run-ptest \
Quoted 5 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-1-PACKAGECONFIG ??= "firmware" +PACKAGECONFIG ??= "firmware bpf" PACKAGECONFIG:remove:x86 = "bpf" PACKAGECONFIG:remove:arm = "bpf vm" # host ptrace.h is used to compile BPF target but mips ptrace.h isneeded
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGECONFIG:remove:qemumips = "bpf vm" · line 34
Quoted 6 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-1@@ -31,30 +31,39 @@ PACKAGECONFIG:remove:qemumips = "bpf vm" PACKAGECONFIG:remove:riscv64 = "vm" PACKAGECONFIG:remove:riscv32 = "vm" -PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native," +PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ngrsync-native python3-docutils-native,"
Quoted 13 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +4
-1PACKAGECONFIG[firmware] = ",,libcap, bash" PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash" do_patch[depends] += "virtual/kernel:do_shared_workdir" +do_compile[depends] += "virtual/kernel:do_install" -inherit linux-kernel-base kernel-arch ptest +inherit linux-kernel-base module-base kernel-arch ptest siteinfo S = "${WORKDIR}/${BP}" +DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map" +meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGECONFIG:remove:qemumips = "bpf vm"
Quoted 10 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +0
-2TEST_LIST = "\ ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \ rtc \ " - EXTRA_OEMAKE = '\ CROSS_COMPILE=${TARGET_PREFIX} \ ARCH=${ARCH} \ CC="${CC}" \ - CLANG="clang -fno-stack-protector -target ${TARGET_ARCH}${TOOLCHAIN_OPTIONS}" \
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGECONFIG:remove:qemumips = "bpf vm"
Quoted 7 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +5
-0AR="${AR}" \ LD="${LD}" \ + LLVM=1 \ + CONFIG_CC_IS_GCC= \ + CONFIG_CC_IS_CLANG=y \ + CONFIG_CC_IMPLICIT_FALLTHROUGH= \ + CLANG="clang -fno-stack-protector -target ${TARGET_ARCH}${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGECONFIG:remove:qemumips = "bpf vm" · line 62
Quoted 1 line
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-0+ HOSTCC="clang -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++${BUILD_CFLAGS} ${BUILD_LDFLAGS} -Wno-error=unused-command-line-argument" \
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGECONFIG:remove:qemumips = "bpf vm" · line 63
Quoted 1 line
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-0+ HOSTLD="clang ${BUILD_LDFLAGS} -unwindlib=libgcc -rtlib=libgcc-stdlib=libstdc++" \
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb KERNEL_SELFTEST_SRC ?= "Makefile \ · line 79
Quoted 13 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-1DESTDIR="${D}" \ MACHINE="${ARCH}" \ + V=1 \ ' KERNEL_SELFTEST_SRC ?= "Makefile \@@ -66,7 +75,6 @@ KERNEL_SELFTEST_SRC ?= "Makefile \ arch \ LICENSES \ " - do_compile() { if [ ${@bb.utils.contains('PACKAGECONFIG', 'bpf', 'True', 'False',d)} = 'True' ]; then
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb KERNEL_SELFTEST_SRC ?= "Makefile \ · line 80
Quoted 1 line
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +0
-0if [ ${@bb.utils.contains('DEPENDS', 'clang-native', 'True','False', d)} = 'False' ]; then
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb do_compile() { · line 82
Quoted 2 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +0
-0@@ -74,7 +82,17 @@ do_compile() { either install it and add it to HOSTTOOLS, or add clang-native frommeta-clang to dependency"
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb do_compile() {
Quoted 7 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +5
-0fi fi + mkdir -p ${S}/include/config ${S}/bits + touch ${S}/include/config/auto.conf + if [ "${SITEINFO_BITS}" != "32" ]; then + for f in long-double endianness floatn struct_rwlock; do + cp ${RECIPE_SYSROOT}${includedir}/bits/$f-64.h
${S}/bits/$f-32.hmeta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb do_compile() {
Quoted 4 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +3
-0+ done + fi oe_runmake -C ${S} headers + sed -i -e 's|^all: docs|all:|'${S}/tools/testing/selftests/bpf/Makefile
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb PACKAGE_ARCH = "${MACHINE_ARCH}" · line 155
Quoted 12 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +3
-1+ sed -i -e '/mrecord-mcount/d' ${S}/Makefile + sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile for i in ${TEST_LIST} do oe_runmake -C ${S}/tools/testing/selftests/${i}@@ -133,9 +151,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" INHIBIT_PACKAGE_DEBUG_SPLIT="1" FILES:${PN} += "/usr/kernel-selftest" -RDEPENDS:${PN} += "python3 perl" +RDEPENDS:${PN} += "python3 perl perl-module-io-handle" # tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and
tools/testing/selftests/Makefileexplicitly overrides to emptyQuoted 6 lines
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1
-1-INSANE_SKIP:${PN} += "ldflags" +INSANE_SKIP:${PN} += "ldflags libdir" SECURITY_CFLAGS = "" 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
Quoted 22 lines
index
d40b9576d8..0903d097e1100755meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest +3
-8@@ -1,11 +1,7 @@ #!/bin/sh -export PATH=$PATH:/usr/kernel-selftest/bpf - -# test_align -test_align | grep "12 pass" &> /dev/null +/usr/kernel-selftest/run_kselftest.sh -s if [ $? == 0 ]; then - echo "[PASS]: test_align" + echo "PASS: kernel-selftest" else - echo "[FAIL]: test_align" + echo "[FAIL]: kernel-selftest" fi - -=-=-=-=-=-=-=-=-=-=-=-Quoted 2 lines
Links: You receive all messages sent to this group. View/Reply Online (#105362):
https://lists.openembedded.org/g/openembedded-devel/message/105362
Quoted 3 lines
Mute This Topic: https://lists.openembedded.org/mt/101786204/6551054
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [Quoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
--
Ryan Eatmon [email protected]
-----------------------------------------
Texas Instruments, Inc. - LCPD - MGTS