kselftest next update for Linux 7.4-rc1
Subsystems (5)
Shuah Khan
maintainerHi Linus,
Please pull the kselftest next update for Linux 7.4-rc1.
- Improves selftest build, run-time, and install framework
Installs even when some modules fail to build, prints summary of test results at the end of the default test run, keeps the build status from wrapping to success so build errors are reported, and optionally records per-suite build and install results:
selftests: lib.mk: Don't fail install if no modules were built selftests/lib.mk: run_tests: print summary at the end
selftests: keep the build status from wrapping to success
selftests: optionally record per-suite build and install results
- Adds LLVM support to kselftest_deps.sh
selftests: kselftest_deps.sh: Support LLVM
- Fixes resctrl, breakpoints suspend, ftrace, and tracing tests
selftests/resctrl: Skip L3_CAT when no exclusive cache portion exists
selftests: breakpoints: Skip step_after_suspend_test on systems
without a wakeup capable RTC
selftests/ftrace: skip gcov symbols when picking a function to probe selftests/ftrace: Avoid unlink error on first run selftests/ftrace: Add nice dependency
tracing/selftests: Fix incorrect invocation of exit_fail
- Fixes and enhances resctrl test use link lists to manage IMC counters
selftests/resctrl: Introduce linked list management for IMC counters selftests/resctrl: Replace counter index references with pointers selftests/resctrl: Enable dynamic management of IMC counters via
linked list
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit cee9395acd8043be0644b25c34bfa86623f2b935:
Linux 7.3-rc1 (2026-08-30 13:34:40 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-7.4-rc1
for you to fetch changes up to 368e5d4d12a802ee3708800319cd13904721286f:
selftests: breakpoints: Skip step_after_suspend_test on systems without a wakeup capable RTC (2026-10-19 18:05:00 -0600)
----------------------------------------------------------------
linux_kselftest-next-7.4-rc1
- Improves selftest build, run-time, and install framework
Installs even when some modules fail to build, prints summary of test results at the end of the default test run, keeps the build status from wrapping to success so build errors are reported, and optionally records per-suite build and install results:
selftests: lib.mk: Don't fail install if no modules were built selftests/lib.mk: run_tests: print summary at the end
selftests: keep the build status from wrapping to success
selftests: optionally record per-suite build and install results
- Adds LLVM support to kselftest_deps.sh
selftests: kselftest_deps.sh: Support LLVM
- Fixes resctrl, breakpoints suspend, ftrace, and tracing tests
selftests/resctrl: Skip L3_CAT when no exclusive cache portion exists
selftests: breakpoints: Skip step_after_suspend_test on systems
without a wakeup capable RTC
selftests/ftrace: skip gcov symbols when picking a function to probe selftests/ftrace: Avoid unlink error on first run selftests/ftrace: Add nice dependency
tracing/selftests: Fix incorrect invocation of exit_fail
- Fixes and enhances resctrl test use link lists to manage IMC counters
selftests/resctrl: Introduce linked list management for IMC counters selftests/resctrl: Replace counter index references with pointers selftests/resctrl: Enable dynamic management of IMC counters via
linked list
----------------------------------------------------------------
Anirudh Srinivasan (1):
selftests: breakpoints: Skip step_after_suspend_test on systems without a wakeup capable RTC
Eva Kurchatova (1):
selftests/ftrace: skip gcov symbols when picking a function to probe
Jaewon Jung (2):
selftests/ftrace: Avoid unlink error on first run selftests/ftrace: Add nice dependency
Mark Brown (2):
selftests: lib.mk: Don't fail install if no modules were built
selftests: kselftest_deps.sh: Support LLVM
Matthieu Baerts (NGI0) (1):
selftests/lib.mk: run_tests: print summary at the end
Richard Cheng (1):
selftests/resctrl: Skip L3_CAT when no exclusive cache portion exists
Sasha Levin (2):
selftests: keep the build status from wrapping to success
selftests: optionally record per-suite build and install results
Woradorn Laodhanadhaworn (1):
tracing/selftests: Fix incorrect invocation of exit_fail
Yifan Wu (3):
selftests/resctrl: Introduce linked list management for IMC counters selftests/resctrl: Replace counter index references with pointers selftests/resctrl: Enable dynamic management of IMC counters via linked list
Documentation/dev-tools/kselftest.rst | 38 +++++ tools/testing/selftests/Makefile | 31 +++- .../breakpoints/step_after_suspend_test.c | 11 ++ tools/testing/selftests/build_report.mk | 26 ++++ tools/testing/selftests/ftrace/ftracetest | 2 +- .../test.d/00basic/ringbuffer_subbuf_size.tc | 6 +- .../ftrace/test.d/00basic/trace_marker.tc | 4 +- .../ftrace/test.d/kprobe/kprobe_eventname.tc | 2 +- .../inter-event/trigger-onchange-action-hist.tc | 2 +- .../inter-event/trigger-snapshot-action-hist.tc | 2 +- tools/testing/selftests/kselftest_deps.sh | 83 +++++++++- tools/testing/selftests/lib.mk | 5 +- tools/testing/selftests/resctrl/cat_test.c | 23 ++- tools/testing/selftests/resctrl/mba_test.c | 1 + tools/testing/selftests/resctrl/mbm_test.c | 1 + tools/testing/selftests/resctrl/resctrl.h | 2 + tools/testing/selftests/resctrl/resctrl_val.c | 169 +++++++++++---------- 17 files changed, 304 insertions(+), 104 deletions(-) create mode 100644 tools/testing/selftests/build_report.mk
----------------------------------------------------------------
Documentation/dev-tools/kselftest.rst +38 -0
@@ -133,6 +133,44 @@ build successfully; make will abort as soon as any target fails:: This applies to both the ``all`` and ``install`` targets and is useful in CI environments where a silent partial build would be misleading. +Recording suite build results +============================= + +Since the build succeeds as long as one target builds, the exit status of +make does not show which targets failed. Set ``KSFT_BUILD_REPORT`` to the +absolute path of a file to have the ``all`` and ``install`` targets append +a tab-separated record for each target they process:: + + $ : > /tmp/ksft-build.tsv + $ make -C tools/testing/selftests O=/tmp/kernel-build \ + KSFT_BUILD_REPORT=/tmp/ksft-build.tsv install + +Each record holds the phase (``all`` or ``install``), a name and the exit +status of that step. Recording does not change which targets are built or +installed, or the exit status of make, also with ``FORCE_TARGETS=1``. The +caller creates or truncates the report before a build; the rules only +append to it. Nothing is recorded by ``make -n``, ``-t`` or ``-q``. + +The same name can appear several times: ``install`` builds the targets +again, and generating ``kselftest-list.txt`` is recorded as part of the +``install`` phase. Targets that are added automatically as installation +dependencies of other targets, such as ``net/lib``, are recorded too. +Suites that are built from several subdirectories may also record each +subdirectory under its path, for example ``arm64/tags``; a failure there +means that the suite was built or installed only partially. A record +belongs to the target with the longest name that is equal to the record +name or followed by ``/`` in it. + +A target was built and installed successfully only if all of its records +have a zero status. Missing records do not show that a target was built. +A successful target that installs no tests has no entries in +``kselftest-list.txt``. Install the kernel headers with ``make headers`` +before building: a suite that fails because the headers are missing is +recorded as failed even if a later step installs them. + +``KSFT_BUILD_REPORT_VERSION`` in tools/testing/selftests/Makefile gives the +version of this format, currently ``1``. + Running the full range hotplug selftests ========================================
tools/testing/selftests/Makefile +23 -8
@@ -171,6 +171,10 @@ endif # of the targets gets built. FORCE_TARGETS ?= +# Remember dry runs for the build report before MAKEFLAGS may be cleared. +KSFT_BUILD_REPORT_DRY_RUN := $(strip $(foreach f,n t q,$(findstring $(f),$(firstword -$(MAKEFLAGS))))) +export KSFT_BUILD_REPORT_DRY_RUN + # Clear LDFLAGS and MAKEFLAGS when implicit rules are missing. This provides # implicit rules to sub-test Makefiles which avoids build failures in test # Makefile that don't have explicit build rules.
@@ -215,6 +219,10 @@ ARCH ?= $(SUBARCH) export BUILD export KHDR_INCLUDES +# Version of the optional KSFT_BUILD_REPORT format written by these rules. +KSFT_BUILD_REPORT_VERSION := 1 +include $(top_srcdir)/tools/testing/selftests/build_report.mk + # set default goal to all, so make without a target runs all, even when # all isn't the first target in the file. .DEFAULT_GOAL := all
@@ -223,11 +231,13 @@ all: @ret=1; \ for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ - mkdir $$BUILD_TARGET -p; \ + mkdir -p $$BUILD_TARGET && \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \ - O=$(abs_objtree) \ - $(if $(FORCE_TARGETS),|| exit); \ - ret=$$((ret * $$?)); \ + O=$(abs_objtree); \ + status=$$?; \ + $(call ksft_record_build_status,all,$$TARGET); \ + $(if $(FORCE_TARGETS),[ $$status -eq 0 ] || exit $$status;) \ + [ $$status -eq 0 ] && ret=0; \ done; exit $$ret; run_tests: all
@@ -284,7 +294,7 @@ ifdef INSTALL_PATH install -m 744 kselftest/ktap_helpers.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/ksft.py $(INSTALL_PATH)/kselftest/ install -m 744 run_kselftest.sh $(INSTALL_PATH)/ - rm -f $(TEST_LIST) + : > $(TEST_LIST) @ret=1; \ for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \
@@ -292,9 +302,11 @@ ifdef INSTALL_PATH INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \ SRC_PATH=$(shell readlink -e $$(pwd)) \ OBJ_PATH=$(INSTALL_PATH) \ - O=$(abs_objtree) \ - $(if $(FORCE_TARGETS),|| exit); \ - ret=$$((ret * $$?)); \ + O=$(abs_objtree); \ + status=$$?; \ + $(call ksft_record_build_status,install,$$TARGET); \ + $(if $(FORCE_TARGETS),[ $$status -eq 0 ] || exit $$status;) \ + [ $$status -eq 0 ] && ret=0; \ done; exit $$ret;
@@ -308,6 +320,9 @@ ifdef INSTALL_PATH printf "Emit Tests for $$TARGET\n"; \ $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \ -C $$TARGET emit_tests >> $(TEST_LIST); \ + status=$$?; \ + $(call ksft_record_build_status,install,$$TARGET); \ + (exit $$status); \ done; @VERSION=$$(git describe HEAD 2>/dev/null); \ if [ -n "$$VERSION" ]; then \
tools/testing/selftests/breakpoints/step_after_suspend_test.c +11 -0
@@ -18,6 +18,7 @@#include <sys/timerfd.h> #include <sys/types.h> #include <sys/wait.h> +#include <time.h> #include "kselftest.h"
@@ -158,11 +159,21 @@ void suspend(void)int err;int count_before;int count_after; +struct timespec res;struct itimerspec spec = {};if (getuid () !=0 )ksft_exit_skip ("Please run the test as root - Exiting.\n" ); +/* +* CLOCK_BOOTTIME_ALARM cannot wake up systems that don't have a +* wakeup capable RTC from suspend. Check if we have a wakeup-capable +* RTC to prevent this test from causing the system to hang after +* it suspends. +*/ +if (clock_getres (CLOCK_BOOTTIME_ALARM , &res) !=0 ) +ksft_exit_skip ("No wakeup-capable RTC for CLOCK_BOOTTIME_ALARM\n" ); + timerfd =timerfd_create (CLOCK_BOOTTIME_ALARM ,0 );if (timerfd <0 )ksft_exit_fail_msg ("timerfd_create() failed\n" );
tools/testing/selftests/build_report.mk new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Optional per-suite build report, see "Recording suite build results" in +# Documentation/dev-tools/kselftest.rst. Callers set KSFT_BUILD_REPORT to an +# absolute filename and use ksft_record_build_status from a shell loop that +# has stored the exit status of the recorded step in $status. + +ifneq (x$(KSFT_BUILD_REPORT)x,xx) +ifeq ($(filter x/%,$(firstword x$(KSFT_BUILD_REPORT))),) +$(error KSFT_BUILD_REPORT must be an absolute path: '$(KSFT_BUILD_REPORT)') +endif +endif +export KSFT_BUILD_REPORT + +ksft_build_report_dry_run := $(KSFT_BUILD_REPORT_DRY_RUN) \ + $(foreach f,n t q,$(findstring $(f),$(firstword -$(MAKEFLAGS)))) + +ifneq ($(strip $(ksft_build_report_dry_run)),) +ksft_record_build_status = : +else +define ksft_record_build_status +if [ -n "$$KSFT_BUILD_REPORT" ]; then \ + printf '%s\t%s\t%d\n' '$(1)' "$(2)" "$$status" >> "$$KSFT_BUILD_REPORT" || exit 1; \ +fi +endef +endif
tools/testing/selftests/ftrace/ftracetest +1 -1
@@ -243,7 +243,7 @@ else mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR" date > $LOG_FILE if [ "x-$LINK_PTR" != "x-" ]; then - unlink $LINK_PTR + rm -f $LINK_PTR ln -fs $LOG_DATE $LINK_PTR fi fi
tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_subbuf_size.tc +3 -3
@@ -60,7 +60,7 @@ test_buffer() { # the size must be greater than or equal to page_size - data_offset page_size=$((page_size-data_offset)) if [ $size -lt $page_size ]; then - exit fail + exit_fail fi # Now add a little more the meta data overhead will overflow
@@ -71,14 +71,14 @@ test_buffer() { new_str=`awk ' /tracing_mark_write:/ { sub(/^.*tracing_mark_write: /,"");printf "%s", $0; exit}' trace` if [ "$new_str" = "$str" ]; then - exit fail; + exit_fail fi # Make sure the entire line can be found new_str=`awk ' /tracing_mark_write:/ { sub(/^.*tracing_mark_write: /,"");printf "%s", $0; }' trace` if [ "$new_str" != "$str" ]; then - exit fail; + exit_fail fi }
tools/testing/selftests/ftrace/test.d/00basic/trace_marker.tc +2 -2
@@ -68,14 +68,14 @@ test_buffer() { new_str=`awk ' /tracing_mark_write:/ { sub(/^.*tracing_mark_write: /,"");printf "%s", $0; exit}' trace` if [ "$new_str" = "$str" ]; then - exit fail; + exit_fail fi # Make sure the entire line can be found new_str=`awk ' /tracing_mark_write:/ { sub(/^.*tracing_mark_write: /,"");printf "%s", $0; }' trace` if [ "$new_str" != "$str" ]; then - exit fail; + exit_fail fi }
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc +1 -1
@@ -5,7 +5,7 @@ :;: "Add an event on function without name" ;: -FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` +FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | grep -v __gcov | tail -n 1 | cut -f 3 -d " "` [ "x" != "x$FUNC" ] || exit_unresolved echo "p $FUNC" > kprobe_events PROBE_NAME=`echo $FUNC | tr ".:" "_"`
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger onchange action -# requires: set_event "onchange(var)":README ping:program +# requires: set_event "onchange(var)":README ping:program nice:program # flags: instance fail() { #msg
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test inter-event histogram trigger snapshot action -# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program +# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program nice:program # flags: instance fail() { #msg
tools/testing/selftests/kselftest_deps.sh +80 -3
118 lines not on this page · raw message
tools/testing/selftests/lib.mk +3 -2
@@ -106,7 +106,8 @@ define RUN_TESTS if [ "X$(summary)" != "X" ]; then \ per_test_logging=1; \ fi; \ - run_many $(1) + run_many $(1); \ + ktap_print_totals endef define INSTALL_INCLUDES
@@ -155,7 +156,7 @@ endef define INSTALL_MODS_RULE $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH)/$(INSTALL_LIST)) - $(if $(INSTALL_LIST),rsync -a --copy-unsafe-links $(INSTALL_LIST)/*.ko $(INSTALL_PATH)/$(INSTALL_LIST)) + $(if $(wildcard $(INSTALL_LIST)/*.ko),rsync -a --copy-unsafe-links $(INSTALL_LIST)/*.ko $(INSTALL_PATH)/$(INSTALL_LIST)) endef define INSTALL_RULE
tools/testing/selftests/resctrl/cat_test.c +22 -1
@@ -357,11 +357,32 @@ static bool noncont_cat_feature_check(const struct resctrl_test *test)return resource_info_file_exists (test->resource,"sparse_masks" ); } +static bool cat_feature_check (const struct resctrl_test *test) +{ +unsigned long mask; + +if (!test_resource_feature_check (test)) +return false; + +/* +* Test requires an exclusive cache portion. Some platforms may +* legitimately report all bits as shareable, skip the test if that +* is the case. +*/ +if (get_mask_no_shareable (test->resource, &mask)) { +ksft_print_msg ("All %s bits are shareable, test requires an exclusive cache portion\n" , + test->resource); +return false; + } + +return true; +} +struct resctrl_test l3_cat_test = { .name ="L3_CAT" , .group ="CAT" , .resource ="L3" , - .feature_check = test_resource_feature_check, + .feature_check = cat_feature_check, .run_test = cat_run_test, .cleanup = cat_test_cleanup, };
tools/testing/selftests/resctrl/mba_test.c +1 -0
@@ -166,6 +166,7 @@ static int check_results(void)static void mba_test_cleanup (void ) { +cleanup_read_mem_bw_imc ();remove (RESULT_FILE_NAME ); }
tools/testing/selftests/resctrl/mbm_test.c +1 -0
@@ -125,6 +125,7 @@ static int mbm_measure(const struct user_params *uparams,static void mbm_test_cleanup (void ) { +cleanup_read_mem_bw_imc ();remove (RESULT_FILE_NAME ); }
tools/testing/selftests/resctrl/resctrl.h +2 -0
@@ -24,6 +24,7 @@#include <linux/perf_event.h> #include <linux/compiler.h> #include <linux/bits.h> +#include <linux/list.h> #include "kselftest.h" #define MB (1024 * 1024)
@@ -183,6 +184,7 @@ void mem_flush(unsigned char *buf, size_t buf_size);void fill_cache_read (unsigned char *buf,size_t buf_size,bool once);ssize_t get_fill_buf_size (int cpu_no,const char *cache_type);int initialize_read_mem_bw_imc (void ); +void cleanup_read_mem_bw_imc (void );int measure_read_mem_bw (const struct user_params *uparams,struct resctrl_val_param *param,pid_t bm_pid); void initialize_mem_bw_resctrl(const struct resctrl_val_param *param,
tools/testing/selftests/resctrl/resctrl_val.c +88 -81
337 lines not on this page · raw message
The pull request you sent on Wed, 21 Oct 2026 13:34:16 -0600:
The pull request you sent on Wed, 21 Oct 2026 13:34:16 -0600:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftesttags/linux_kselftest-next-7.4-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/968de9d17980a0e538fc4e4394af49465294386d
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html