Skip to contentSkip to conversation

kernel-selftest: Update to allow for turning on all tests

PATCH In review Ryan Eatmon 1 participant 3 messages Oct 11, 2024 – Oct 14, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-selftest: Update to allow for turning on all tests

In testing adding in more kernel-selftests there were a number of issues that arose that require changes that are more appropriate for the main recipe and not a bbappend.

1) Stop looping over TEST_LIST ourselves and use the TARGETS="" provided by the kernel-sefltest Makefiles. This correctly sets up various variables that the selftest Makefiles all need. Also, do_install becomes cleaner because the main Makefile already installs the list of tests and the top level script.

2) Add DEBUG_PREFIX_MAP to the CC setting to avoid some "buildpaths" QA errors.

3) Add two INSANE_SKIPS for "already-stripped" and "ldflags". Some of the selftest Makefiles are adding flags to their compiles that basically break the above checks. Since these compiles are not really meant as user level tools and instead testing, it should be ok to just always set INSANE_SKIP for these two.

---
 .../kernel-selftest/kernel-selftest.bb        | 26 +++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +10 -16
index 889fe3e22..f83b07dd9 100644
@@ -56,7 +56,7 @@ TEST_LIST = "\
 EXTRA_OEMAKE = '\
     CROSS_COMPILE=${TARGET_PREFIX} \
     ARCH=${ARCH} \
-    CC="${CC}" \
+    CC="${CC} ${DEBUG_PREFIX_MAP}" \
     AR="${AR}" \
     LD="${LD}" \
     CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
@@ -97,25 +97,13 @@ either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
     sed -i -e '/mrecord-mcount/d' ${S}/Makefile
     sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
     sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i}
-    done
+    oe_runmake -C ${S}/tools/testing/selftests TARGETS="${TEST_LIST}"
 }
 
 do_install() {
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
-        # Install kselftest-list.txt that required by kselftest runner.
-        oe_runmake -s --no-print-directory COLLECTION=${i} -C ${S}/tools/testing/selftests/${i} emit_tests \
-            >> ${D}/usr/kernel-selftest/kselftest-list.txt
-    done
-    # Install kselftest runner.
-    install -m 0755 ${S}/tools/testing/selftests/run_kselftest.sh ${D}/usr/kernel-selftest/
-    cp -R --no-dereference --preserve=mode,links -v ${S}/tools/testing/selftests/kselftest ${D}/usr/kernel-selftest/
+    oe_runmake -C ${S}/tools/testing/selftests INSTALL_PATH=${D}/usr/kernel-selftest TARGETS="${TEST_LIST}" install
     if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
-	sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
+        sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
     fi
     chown root:root  -R ${D}/usr/kernel-selftest
 }
@@ -161,6 +149,12 @@ RDEPENDS:${PN} += "python3 perl perl-module-io-handle"
 
 INSANE_SKIP:${PN} += "libdir"
 
+# A few of the selftests set compile flags that trip up the "ldflags" and
+# "already-stripped" QA checks.  As this is mainly a testing package and
+# not really meant for user level execution, disable these two checks.
+INSANE_SKIP:${PN} += "ldflags"
+INSANE_SKIP:${PN} += "already-stripped"
+
 SECURITY_CFLAGS = ""
 COMPATIBLE_HOST:libc-musl = 'null'
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 kernel-selftest: Update to allow for turning on all tests

In testing adding in more kernel-selftests there were a number of issues that arose that require changes that are more appropriate for the main recipe and not a bbappend.

1) Stop looping over TEST_LIST ourselves and use the TARGETS="" provided by the kernel-sefltest Makefiles. This correctly sets up various variables that the selftest Makefiles all need. Also, do_install becomes cleaner because the main Makefile already installs the list of tests and the top level script.

2) Add DEBUG_PREFIX_MAP to the CC setting to avoid some "buildpaths" QA errors.

3) Add two INSANE_SKIPS for "already-stripped" and "ldflags". Some of the selftest Makefiles are adding flags to their compiles that basically break the above checks. Since these compiles are not really meant as user level tools and instead testing, it should be ok to just always set INSANE_SKIP for these two.

---
 .../kernel-selftest/kernel-selftest.bb        | 26 +++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +10 -16
index 01f185adb..a070ceab5 100644
@@ -55,7 +55,7 @@ TEST_LIST = "\
 EXTRA_OEMAKE = '\
     CROSS_COMPILE=${TARGET_PREFIX} \
     ARCH=${ARCH} \
-    CC="${CC}" \
+    CC="${CC} ${DEBUG_PREFIX_MAP}" \
     AR="${AR}" \
     LD="${LD}" \
     CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
@@ -96,25 +96,13 @@ either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
     sed -i -e '/mrecord-mcount/d' ${S}/Makefile
     sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
     sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i}
-    done
+    oe_runmake -C ${S}/tools/testing/selftests TARGETS="${TEST_LIST}"
 }
 
 do_install() {
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
-        # Install kselftest-list.txt that required by kselftest runner.
-        oe_runmake -s --no-print-directory COLLECTION=${i} -C ${S}/tools/testing/selftests/${i} emit_tests \
-            >> ${D}/usr/kernel-selftest/kselftest-list.txt
-    done
-    # Install kselftest runner.
-    install -m 0755 ${S}/tools/testing/selftests/run_kselftest.sh ${D}/usr/kernel-selftest/
-    cp -R --no-dereference --preserve=mode,links -v ${S}/tools/testing/selftests/kselftest ${D}/usr/kernel-selftest/
+    oe_runmake -C ${S}/tools/testing/selftests INSTALL_PATH=${D}/usr/kernel-selftest TARGETS="${TEST_LIST}" install
     if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
-	sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
+        sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
     fi
     chown root:root  -R ${D}/usr/kernel-selftest
 }
@@ -158,6 +146,12 @@ RDEPENDS:${PN} += "python3 perl perl-module-io-handle"
 
 INSANE_SKIP:${PN} += "libdir"
 
+# A few of the selftests set compile flags that trip up the "ldflags" and
+# "already-stripped" QA checks.  As this is mainly a testing package and
+# not really meant for user level execution, disable these two checks.
+INSANE_SKIP:${PN} += "ldflags"
+INSANE_SKIP:${PN} += "already-stripped"
+
 SECURITY_CFLAGS = ""
 COMPATIBLE_HOST:libc-musl = 'null'
 
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Now that the master version of this patch has been accepted and promoted, can this scarthgap version be looked at? Thanks.

Quoted 90 lines · Ryan Eatmon via lists.openembedded.org

In testing adding in more kernel-selftests there were a number of issues that arose that require changes that are more appropriate for the main recipe and not a bbappend.

1) Stop looping over TEST_LIST ourselves and use the TARGETS="" provided by the kernel-sefltest Makefiles. This correctly sets up various variables that the selftest Makefiles all need. Also, do_install becomes cleaner because the main Makefile already installs the list of tests and the top level script.

2) Add DEBUG_PREFIX_MAP to the CC setting to avoid some "buildpaths" QA errors.

3) Add two INSANE_SKIPS for "already-stripped" and "ldflags". Some of the selftest Makefiles are adding flags to their compiles that basically break the above checks. Since these compiles are not really meant as user level tools and instead testing, it should be ok to just always set INSANE_SKIP for these two.

---
  .../kernel-selftest/kernel-selftest.bb        | 26 +++++++------------
  1 file changed, 10 insertions(+), 16 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +10 -17
index 01f185adb..a070ceab5 100644
@@ -55,7 +55,7 @@ TEST_LIST = "\
  EXTRA_OEMAKE = '\
      CROSS_COMPILE=${TARGET_PREFIX} \
      ARCH=${ARCH} \
-    CC="${CC}" \
+    CC="${CC} ${DEBUG_PREFIX_MAP}" \
      AR="${AR}" \
      LD="${LD}" \
      CLANG="clang -fno-stack-protector -target ${TARGET_ARCH} ${TOOLCHAIN_OPTIONS} -isystem ${S} -D__WORDSIZE=\'64\' -Wno-error=unused-command-line-argument" \
@@ -96,25 +96,13 @@ either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
      sed -i -e '/mrecord-mcount/d' ${S}/Makefile
      sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
      sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i}
-    done
+    oe_runmake -C ${S}/tools/testing/selftests TARGETS="${TEST_LIST}"
  }
 
  do_install() {
-    for i in ${TEST_LIST}
-    do
-        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
-        # Install kselftest-list.txt that required by kselftest runner.
-        oe_runmake -s --no-print-directory COLLECTION=${i} -C ${S}/tools/testing/selftests/${i} emit_tests \
-            >> ${D}/usr/kernel-selftest/kselftest-list.txt
-    done
-    # Install kselftest runner.
-    install -m 0755 ${S}/tools/testing/selftests/run_kselftest.sh ${D}/usr/kernel-selftest/
-    cp -R --no-dereference --preserve=mode,links -v ${S}/tools/testing/selftests/kselftest ${D}/usr/kernel-selftest/
+    oe_runmake -C ${S}/tools/testing/selftests INSTALL_PATH=${D}/usr/kernel-selftest TARGETS="${TEST_LIST}" install
      if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
-	sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
+        sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
      fi
      chown root:root  -R ${D}/usr/kernel-selftest
  }
@@ -158,6 +146,12 @@ RDEPENDS:${PN} += "python3 perl perl-module-io-handle"
 
  INSANE_SKIP:${PN} += "libdir"
 
+# A few of the selftests set compile flags that trip up the "ldflags" and
+# "already-stripped" QA checks.  As this is mainly a testing package and
+# not really meant for user level execution, disable these two checks.
+INSANE_SKIP:${PN} += "ldflags"
+INSANE_SKIP:${PN} += "already-stripped"
+
  SECURITY_CFLAGS = ""
  COMPATIBLE_HOST:libc-musl = 'null'
 
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#112803): https://lists.openembedded.org/g/openembedded-devel/message/112803
Mute This Topic: https://lists.openembedded.org/mt/108949496/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