Skip to contentSkip to conversation

Kselftest update for Linux 5.20-rc1

GIT PULL Merged Shuah Khan 4 participants 8 messages Aug 1, 2022 – Aug 3, 2022

Subsystems (15)
Networking KVM Kbuild Kselftest +11 more subsystems
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

Hi Linus,

Please pull the following Kselftest update for Linux 5.20-rc1.

This Kselftest update for Linux 5.20-rc1 consists of:

- timers test build fixes and cleanups for new tool chains
- removing khdr from kselftest framework and main Makefile
- changes to test output messages to improve reports

Please not that this update also included main Makefile change to kselftest build logic in it.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 03c765b0e3b4cb5063276b086c76f7a612856a9a:

Linux 5.19-rc4 (2022-06-26 14:22:10 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-5.20-rc1

for you to fetch changes up to 4062eba9f3d072e72645860fbc5d160428a75c50:

Makefile: replace headers_install with headers for kselftest (2022-07-26 18:06:33 -0600)

----------------------------------------------------------------
linux-kselftest-next-5.20-rc1

This Kselftest update for Linux 5.20-rc1 consists of:

- timers test build fixes and cleanups for new tool chains
- removing khdr from kselftest framework and main Makefile
- changes to test output messages to improve reports

----------------------------------------------------------------
Gautam (2):
kselftests: Enable the echo command to print newlines in Makefile kselftests/damon: add support for cases where debugfs cannot be read

Gautam Menghani (3):
selftests: Make the usage formatting consistent in kselftest_deps.sh selftests/drivers/gpu: Add error messages to drm_mm.sh selftests/kcmp: Make the test output consistent and clear

Guillaume Tucker (6):
selftests: drop khdr make target
selftests: stop using KSFT_KHDR_INSTALL
selftests: drop KSFT_KHDR_INSTALL make target
Makefile: add headers_install to kselftest targets selftests/landlock: drop deprecated headers dependency
Makefile: replace headers_install with headers for kselftest

Johannes Holland (1):
selftests/tpm2: increase timeout for kselftests

Soumya Negi (1):
selftests: drivers/dma-buf: Improve message in selftest summary

Wolfram Sang (9):
selftests: timers: valid-adjtimex: build fix for newer toolchains
selftests: timers: fix declarations of main()
selftests: timers: nanosleep: adapt to kselftest framework
selftests: timers: inconsistency-check: adapt to kselftest framework
selftests: timers: clocksource-switch: fix passing errors from child
selftests: timers: clocksource-switch: sort includes
selftests: timers: clocksource-switch: add command line switch to skip sanity check
selftests: timers: clocksource-switch: add 'runtime' command line parameter
selftests: timers: clocksource-switch: adapt to kselftest framework

Xiang wangx (1):
userfaultfd/selftests: Fix typo in comment

Zan Aziz (1):
selftests:timers: globals don't need initialization to 0

 Makefile                                           |  4 +-
 tools/testing/selftests/Makefile                   | 30 +--------
 tools/testing/selftests/arm64/mte/Makefile         |  1 -
 tools/testing/selftests/arm64/signal/Makefile      |  1 -
 .../testing/selftests/arm64/signal/test_signals.h  |  4 +-
 tools/testing/selftests/damon/_chk_dependency.sh   | 10 +++
 tools/testing/selftests/drivers/dma-buf/udmabuf.c  |  3 +-
 tools/testing/selftests/drivers/gpu/drm_mm.sh      |  4 +-
 .../selftests/drivers/s390x/uvdevice/Makefile      |  1 -
 tools/testing/selftests/futex/functional/Makefile  |  1 -
 tools/testing/selftests/kcmp/kcmp_test.c           |  6 +-
 tools/testing/selftests/kselftest_deps.sh          |  2 +-
 tools/testing/selftests/kvm/Makefile               |  1 -
 tools/testing/selftests/landlock/Makefile          | 10 +--
 tools/testing/selftests/lib.mk                     | 38 ------------
 tools/testing/selftests/net/Makefile               |  1 -
 tools/testing/selftests/net/mptcp/Makefile         |  1 -
 tools/testing/selftests/tc-testing/Makefile        |  1 -
 tools/testing/selftests/timers/adjtick.c           |  2 +-
 .../testing/selftests/timers/alarmtimer-suspend.c  |  2 +-
 tools/testing/selftests/timers/change_skew.c       |  2 +-
 .../testing/selftests/timers/clocksource-switch.c  | 71 ++++++++++++++--------
 .../testing/selftests/timers/inconsistency-check.c | 32 +++++-----
 tools/testing/selftests/timers/nanosleep.c         | 18 +++---
 tools/testing/selftests/timers/raw_skew.c          |  2 +-
 tools/testing/selftests/timers/skew_consistency.c  |  2 +-
 tools/testing/selftests/timers/valid-adjtimex.c    |  2 +-
 tools/testing/selftests/tpm2/settings              |  1 +
 tools/testing/selftests/vm/Makefile                |  1 -
 tools/testing/selftests/vm/userfaultfd.c           |  2 +-
 30 files changed, 111 insertions(+), 145 deletions(-)
 create mode 100644 tools/testing/selftests/tpm2/settings

----------------------------------------------------------------

Makefile +2 -2
index 8973b285ce6c..5c934d16664c 100644
@@ -1347,10 +1347,10 @@ tools/%: FORCE
 # Kernel selftest
 
 PHONY += kselftest
-kselftest:
+kselftest: headers
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
 
-kselftest-%: FORCE
+kselftest-%: headers FORCE
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
 
 PHONY += kselftest-merge
tools/testing/selftests/Makefile +3 -27
index de11992dc577..5047d8eef53e 100644
@@ -143,7 +143,6 @@ endif
 # Prepare for headers install
 include $(top_srcdir)/scripts/subarch.include
 ARCH           ?= $(SUBARCH)
-export KSFT_KHDR_INSTALL_DONE := 1
 export BUILD
 export KHDR_INCLUDES
 
@@ -151,30 +150,7 @@ export KHDR_INCLUDES
 # all isn't the first target in the file.
 .DEFAULT_GOAL := all
 
-# Install headers here once for all tests. KSFT_KHDR_INSTALL_DONE
-# is used to avoid running headers_install from lib.mk.
-# Invoke headers install with --no-builtin-rules to avoid circular
-# dependency in "make kselftest" case. In this case, second level
-# make inherits builtin-rules which will use the rule generate
-# Makefile.o and runs into
-# "Circular Makefile.o <- prepare dependency dropped."
-# and headers_install fails and test compile fails.
-#
-# O= KBUILD_OUTPUT cases don't run into this error, since main Makefile
-# invokes them as sub-makes and --no-builtin-rules is not necessary,
-# but doesn't cause any failures. Keep it simple and use the same
-# flags in both cases.
-# Local build cases: "make kselftest", "make -C" - headers are installed
-# in the default INSTALL_HDR_PATH usr/include.
-khdr:
-ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
-	$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
-else
-	$(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$(abs_objtree)/usr \
-		ARCH=$(ARCH) -C $(top_srcdir) headers_install
-endif
-
-all: khdr
+all:
 	@ret=1;							\
 	for TARGET in $(TARGETS); do				\
 		BUILD_TARGET=$$BUILD/$$TARGET;			\
@@ -253,7 +229,7 @@ ifdef INSTALL_PATH
 	for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		[ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
-		echo -n "Emit Tests for $$TARGET\n"; \
+		echo -ne "Emit Tests for $$TARGET\n"; \
 		$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
 			-C $$TARGET emit_tests >> $(TEST_LIST); \
 	done;
@@ -274,4 +250,4 @@ clean:
 		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
 	done;
 
-.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar
+.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar
tools/testing/selftests/arm64/mte/Makefile +0 -1
index 409e3e53d00a..a5a0744423d8 100644
@@ -22,7 +22,6 @@ ifeq ($(mte_cc_support),1)
 TEST_GEN_PROGS := $(PROGS)
 
 # Get Kernel headers installed and use them.
-KSFT_KHDR_INSTALL := 1
 else
     $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
     $(warning test program "mte" will not be created.)
tools/testing/selftests/arm64/signal/Makefile +0 -1
index ac4ad0005715..be7520a863b0 100644
@@ -11,7 +11,6 @@ PROGS := $(patsubst %.c,%,$(SRCS))
 TEST_GEN_PROGS := $(notdir $(PROGS))
 
 # Get Kernel headers installed and use them.
-KSFT_KHDR_INSTALL := 1
 
 # Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list
 # to account for any OUTPUT target-dirs optionally provided by
tools/testing/selftests/arm64/signal/test_signals.h +1 -3
index c70fdec7d7c4..0c645834ddc3 100644
@@ -9,9 +9,7 @@
 #include <ucontext.h>
 
 /*
- * Using ARCH specific and sanitized Kernel headers installed by KSFT
- * framework since we asked for it by setting flag KSFT_KHDR_INSTALL
- * in our Makefile.
+ * Using ARCH specific and sanitized Kernel headers from the tree.
  */
 #include <asm/ptrace.h>
 #include <asm/hwcap.h>
tools/testing/selftests/damon/_chk_dependency.sh +10 -0
index 0189db81550b..0328ac0b5a5e 100644
@@ -26,3 +26,13 @@ do
 		exit 1
 	fi
 done
+
+permission_error="Operation not permitted"
+for f in attrs target_ids monitor_on
+do
+	status=$( cat "$DBGFS/$f" 2>&1 )
+	if [ "${status#*$permission_error}" != "$status" ]; then
+		echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
+		exit $ksft_skip
+	fi
+done
tools/testing/selftests/drivers/dma-buf/udmabuf.c +2 -1
index de1c4e6de0b2..c812080e304e 100644
@@ -32,7 +32,8 @@ int main(int argc, char *argv[])
 
 	devfd = open("/dev/udmabuf", O_RDWR);
 	if (devfd < 0) {
-		printf("%s: [skip,no-udmabuf]\n", TEST_PREFIX);
+		printf("%s: [skip,no-udmabuf: Unable to access DMA buffer device file]\n",
+		       TEST_PREFIX);
 		exit(77);
 	}
 
tools/testing/selftests/drivers/gpu/drm_mm.sh +2 -2
index b789dc8257e6..09c76cd7661d 100755
@@ -3,7 +3,7 @@
 # Runs API tests for struct drm_mm (DRM range manager)
 
 if ! /sbin/modprobe -n -q test-drm_mm; then
-       echo "drivers/gpu/drm_mm: [skip]"
+       echo "drivers/gpu/drm_mm: module test-drm_mm is not found in /lib/modules/`uname -r` [skip]"
        exit 77
 fi
 
@@ -11,6 +11,6 @@ if /sbin/modprobe -q test-drm_mm; then
        /sbin/modprobe -q -r test-drm_mm
        echo "drivers/gpu/drm_mm: ok"
 else
-       echo "drivers/gpu/drm_mm: [FAIL]"
+       echo "drivers/gpu/drm_mm: module test-drm_mm could not be removed [FAIL]"
        exit 1
 fi
tools/testing/selftests/drivers/s390x/uvdevice/Makefile +0 -1
index 5e701d2708d4..891215a7dc8a 100644
@@ -11,7 +11,6 @@ else
 TEST_GEN_PROGS := test_uvdevice
 
 top_srcdir ?= ../../../../../..
-KSFT_KHDR_INSTALL := 1
 khdr_dir = $(top_srcdir)/usr/include
 LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
 
tools/testing/selftests/futex/functional/Makefile +0 -1
index b8152c573e8a..732149011692 100644
@@ -22,7 +22,6 @@ TEST_GEN_FILES := \
 TEST_PROGS := run.sh
 
 top_srcdir = ../../../../..
-KSFT_KHDR_INSTALL := 1
 DEFAULT_INSTALL_HDR_PATH := 1
 include ../../lib.mk
 
tools/testing/selftests/kcmp/kcmp_test.c +4 -2
index 6ea7b9f37a41..25110c7c0b3e 100644
@@ -88,6 +88,9 @@ int main(int argc, char **argv)
 		int pid2 = getpid();
 		int ret;
 
+		ksft_print_header();
+		ksft_set_plan(3);
+
 		fd2 = open(kpath, O_RDWR, 0644);
 		if (fd2 < 0) {
 			perror("Can't open file");
@@ -152,7 +155,6 @@ int main(int argc, char **argv)
 			ksft_inc_pass_cnt();
 		}
 
-		ksft_print_cnts();
 
 		if (ret)
 			ksft_exit_fail();
@@ -162,5 +164,5 @@ int main(int argc, char **argv)
 
 	waitpid(pid2, &status, P_ALL);
 
-	return ksft_exit_pass();
+	return 0;
 }
tools/testing/selftests/kselftest_deps.sh +1 -1
index 00e60d6eb16b..708cb5429633 100755
@@ -26,7 +26,7 @@ echo "  main Makefile when optional -p is specified."
 echo "- Prints pass/fail dependency check for each tests/sub-test."
 echo "- Prints pass/fail targets and libraries."
 echo "- Default: runs dependency checks on all tests."
-echo "- Optional test name can be specified to check dependencies for it."
+echo "- Optional: test name can be specified to check dependencies for it."
 exit 1
 
 }
tools/testing/selftests/kvm/Makefile +0 -1
index 22423c871ed6..120951fc304a 100644
@@ -4,7 +4,6 @@ include ../../../build/Build.include
 all:
 
 top_srcdir = ../../../..
-KSFT_KHDR_INSTALL := 1
 
 # For cross-builds to work, UNAME_M has to map to ARCH and arch specific
 # directories and targets in this Makefile. "uname -m" doesn't map to
tools/testing/selftests/landlock/Makefile +2 -8
index 0b0049e133bb..a6959df28eb0 100644
@@ -8,17 +8,11 @@ TEST_GEN_PROGS := $(src_test:.c=)
 
 TEST_GEN_PROGS_EXTENDED := true
 
-KSFT_KHDR_INSTALL := 1
 OVERRIDE_TARGETS := 1
 include ../lib.mk
 
-khdr_dir = $(top_srcdir)/usr/include
-
-$(khdr_dir)/linux/landlock.h: khdr
-	@:
-
 $(OUTPUT)/true: true.c
 	$(LINK.c) $< $(LDLIBS) -o $@ -static
 
-$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
-	$(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)
+$(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
+	$(LINK.c) $< $(LDLIBS) -o $@ -lcap
tools/testing/selftests/lib.mk +0 -38
index 1a5cc3cd97ec..947fc72413e9 100644
@@ -51,45 +51,7 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
 TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
 
-ifdef KSFT_KHDR_INSTALL
-top_srcdir ?= ../../../..
-include $(top_srcdir)/scripts/subarch.include
-ARCH		?= $(SUBARCH)
-
-# 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
-
-# Invoke headers install with --no-builtin-rules to avoid circular
-# dependency in "make kselftest" case. In this case, second level
-# make inherits builtin-rules which will use the rule generate
-# Makefile.o and runs into
-# "Circular Makefile.o <- prepare dependency dropped."
-# and headers_install fails and test compile fails.
-# O= KBUILD_OUTPUT cases don't run into this error, since main Makefile
-# invokes them as sub-makes and --no-builtin-rules is not necessary,
-# but doesn't cause any failures. Keep it simple and use the same
-# flags in both cases.
-# Note that the support to install headers from lib.mk is necessary
-# when test Makefile is run directly with "make -C".
-# When local build is done, headers are installed in the default
-# INSTALL_HDR_PATH usr/include.
-.PHONY: khdr
-.NOTPARALLEL:
-khdr:
-ifndef KSFT_KHDR_INSTALL_DONE
-ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
-	$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
-else
-	$(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$OUTPUT/usr \
-		ARCH=$(ARCH) -C $(top_srcdir) headers_install
-endif
-endif
-
-all: khdr $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
-else
 all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
-endif
 
 define RUN_TESTS
 	BASE_DIR="$(selfdir)";			\
tools/testing/selftests/net/Makefile +0 -1
index 7ea54af55490..bc006f2693da 100644
@@ -62,7 +62,6 @@ TEST_PROGS += test_vxlan_vnifiltering.sh
 
 TEST_FILES := settings
 
-KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
 include bpf/Makefile
tools/testing/selftests/net/mptcp/Makefile +0 -1
index f905d5358e68..1af2f66fb59a 100644
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
 top_srcdir = ../../../../..
-KSFT_KHDR_INSTALL := 1
 
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
 
tools/testing/selftests/tc-testing/Makefile +0 -1
index 4d639279f41e..cb553eac9f41 100644
@@ -5,7 +5,6 @@ top_srcdir = $(abspath ../../../..)
 APIDIR := $(top_scrdir)/include/uapi
 TEST_GEN_FILES = action.o
 
-KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
 PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
tools/testing/selftests/timers/adjtick.c +1 -1
index 54d8d87f36b3..47e05fdc32c5 100644
@@ -165,7 +165,7 @@ int check_tick_adj(long tickval)
 	return  0;
 }
 
-int main(int argv, char **argc)
+int main(int argc, char **argv)
 {
 	struct timespec raw;
 	long tick, max, interval, err;
tools/testing/selftests/timers/alarmtimer-suspend.c +1 -1
index 54da4b088f4c..4332b494103d 100644
@@ -92,7 +92,7 @@ long long timespec_sub(struct timespec a, struct timespec b)
 	return ret;
 }
 
-int final_ret = 0;
+int final_ret;
 
 void sigalarm(int signo)
 {
tools/testing/selftests/timers/change_skew.c +1 -1
index c4eab7124990..992a77f2a74c 100644
@@ -55,7 +55,7 @@ int change_skew_test(int ppm)
 }
 
 
-int main(int argv, char **argc)
+int main(int argc, char **argv)
 {
 	struct timex tx;
 	int i, ret;
tools/testing/selftests/timers/clocksource-switch.c +47 -24

115 lines not on this page · raw message

tools/testing/selftests/timers/inconsistency-check.c +18 -14
index e6756d9c60a7..36a49fba6c9b 100644
@@ -122,30 +122,28 @@ int consistency_test(int clock_type, unsigned long seconds)
 		if (inconsistent >= 0) {
 			unsigned long long delta;
 
-			printf("\%s\n", start_str);
+			ksft_print_msg("\%s\n", start_str);
 			for (i = 0; i < CALLS_PER_LOOP; i++) {
 				if (i == inconsistent)
-					printf("--------------------\n");
-				printf("%lu:%lu\n", list[i].tv_sec,
+					ksft_print_msg("--------------------\n");
+				ksft_print_msg("%lu:%lu\n", list[i].tv_sec,
 							list[i].tv_nsec);
 				if (i == inconsistent + 1)
-					printf("--------------------\n");
+					ksft_print_msg("--------------------\n");
 			}
 			delta = list[inconsistent].tv_sec * NSEC_PER_SEC;
 			delta += list[inconsistent].tv_nsec;
 			delta -= list[inconsistent+1].tv_sec * NSEC_PER_SEC;
 			delta -= list[inconsistent+1].tv_nsec;
-			printf("Delta: %llu ns\n", delta);
+			ksft_print_msg("Delta: %llu ns\n", delta);
 			fflush(0);
 			/* timestamp inconsistency*/
 			t = time(0);
-			printf("%s\n", ctime(&t));
-			printf("[FAILED]\n");
+			ksft_print_msg("%s\n", ctime(&t));
 			return -1;
 		}
 		now = list[0].tv_sec;
 	}
-	printf("[OK]\n");
 	return 0;
 }
 
@@ -178,16 +176,22 @@ int main(int argc, char *argv[])
 
 	setbuf(stdout, NULL);
 
+	ksft_print_header();
+	ksft_set_plan(maxclocks - userclock);
+
 	for (clockid = userclock; clockid < maxclocks; clockid++) {
 
-		if (clockid == CLOCK_HWSPECIFIC)
+		if (clockid == CLOCK_HWSPECIFIC || clock_gettime(clockid, &ts)) {
+			ksft_test_result_skip("%-31s\n", clockstring(clockid));
 			continue;
+		}
 
-		if (!clock_gettime(clockid, &ts)) {
-			printf("Consistent %-30s ", clockstring(clockid));
-			if (consistency_test(clockid, runtime))
-				return ksft_exit_fail();
+		if (consistency_test(clockid, runtime)) {
+			ksft_test_result_fail("%-31s\n", clockstring(clockid));
+			ksft_exit_fail();
+		} else {
+			ksft_test_result_pass("%-31s\n", clockstring(clockid));
 		}
 	}
-	return ksft_exit_pass();
+	ksft_exit_pass();
 }
tools/testing/selftests/timers/nanosleep.c +11 -7
index 71b5441c2fd9..df1d03516e7b 100644
@@ -133,33 +133,37 @@ int main(int argc, char **argv)
 	long long length;
 	int clockid, ret;
 
+	ksft_print_header();
+	ksft_set_plan(NR_CLOCKIDS);
+
 	for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) {
 
 		/* Skip cputime clockids since nanosleep won't increment cputime */
 		if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
 				clockid == CLOCK_THREAD_CPUTIME_ID ||
-				clockid == CLOCK_HWSPECIFIC)
+				clockid == CLOCK_HWSPECIFIC) {
+			ksft_test_result_skip("%-31s\n", clockstring(clockid));
 			continue;
+		}
 
-		printf("Nanosleep %-31s ", clockstring(clockid));
 		fflush(stdout);
 
 		length = 10;
 		while (length <= (NSEC_PER_SEC * 10)) {
 			ret = nanosleep_test(clockid, length);
 			if (ret == UNSUPPORTED) {
-				printf("[UNSUPPORTED]\n");
+				ksft_test_result_skip("%-31s\n", clockstring(clockid));
 				goto next;
 			}
 			if (ret < 0) {
-				printf("[FAILED]\n");
-				return ksft_exit_fail();
+				ksft_test_result_fail("%-31s\n", clockstring(clockid));
+				ksft_exit_fail();
 			}
 			length *= 100;
 		}
-		printf("[OK]\n");
+		ksft_test_result_pass("%-31s\n", clockstring(clockid));
 next:
 		ret = 0;
 	}
-	return ksft_exit_pass();
+	ksft_exit_pass();
 }
tools/testing/selftests/timers/raw_skew.c +1 -1
index b41d8dd0c40c..5beceeed0d11 100644
@@ -89,7 +89,7 @@ void get_monotonic_and_raw(struct timespec *mon, struct timespec *raw)
 	}
 }
 
-int main(int argv, char **argc)
+int main(int argc, char **argv)
 {
 	struct timespec mon, raw, start, end;
 	long long delta1, delta2, interval, eppm, ppm;
tools/testing/selftests/timers/skew_consistency.c +1 -1
index 8066be9aff11..63913f75b384 100644
@@ -38,7 +38,7 @@
 
 #define NSEC_PER_SEC 1000000000LL
 
-int main(int argv, char **argc)
+int main(int argc, char **argv)
 {
 	struct timex tx;
 	int ret, ppm;
tools/testing/selftests/timers/valid-adjtimex.c +1 -1
index 5397de708d3c..48b9a803235a 100644
@@ -40,7 +40,7 @@
 #define ADJ_SETOFFSET 0x0100
 
 #include <sys/syscall.h>
-static int clock_adjtime(clockid_t id, struct timex *tx)
+int clock_adjtime(clockid_t id, struct timex *tx)
 {
 	return syscall(__NR_clock_adjtime, id, tx);
 }
tools/testing/selftests/tpm2/settings new file +1 -0
new file mode 100644
index 000000000000..a62d2fa1275c
@@ -0,0 +1 @@
+timeout=600
tools/testing/selftests/vm/Makefile +0 -1
index 44f25acfbeca..108587cb327a 100644
@@ -94,7 +94,6 @@ TEST_PROGS := run_vmtests.sh
 TEST_FILES := test_vmalloc.sh
 TEST_FILES += test_hmm.sh
 
-KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
 $(OUTPUT)/madv_populate: vm_util.c
tools/testing/selftests/vm/userfaultfd.c +1 -1
index 0bdfc1955229..4bc24581760d 100644
@@ -860,7 +860,7 @@ static int stress(struct uffd_stats *uffd_stats)
 	/*
 	 * Be strict and immediately zap area_src, the whole area has
 	 * been transferred already by the background treads. The
-	 * area_src could then be faulted in in a racy way by still
+	 * area_src could then be faulted in a racy way by still
 	 * running uffdio_threads reading zeropages after we zapped
 	 * area_src (but they're guaranteed to get -EEXIST from
 	 * UFFDIO_COPY without writing zero pages into area_dst
maintainer
#1 lore raw

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

tools/testing/selftests/landlock/Makefile +5 -2
@@ -9,10 +9,13 @@ TEST_GEN_PROGS := $(src_test:.c=)
 TEST_GEN_PROGS_EXTENDED := true
 
 OVERRIDE_TARGETS := 1
+top_srcdir = ../../../..
 include ../lib.mk
 
+khdr_dir = $(top_srcdir)/usr/include
+
 $(OUTPUT)/true: true.c
 	$(LINK.c) $< $(LDLIBS) -o $@ -static
 
-$(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
-	$(LINK.c) $< $(LDLIBS) -o $@ -lcap
+$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
+	$(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)

This doesn't fix the header timestamp check though.

Regards,
Mickaël

[1] https://lore.kernel.org/all/b79c51ed97219b1c10e2e3f2bcd3269305f0f035.1657694067.git.guillaume.tucker@collabora.com/

Quoted 114 lines · Shuah Khan

Hi Linus,

Please pull the following Kselftest update for Linux 5.20-rc1.

This Kselftest update for Linux 5.20-rc1 consists of:

- timers test build fixes and cleanups for new tool chains
- removing khdr from kselftest framework and main Makefile
- changes to test output messages to improve reports

Please not that this update also included main Makefile change to kselftest build logic in it.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 03c765b0e3b4cb5063276b086c76f7a612856a9a:

    Linux 5.19-rc4 (2022-06-26 14:22:10 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-5.20-rc1

for you to fetch changes up to 4062eba9f3d072e72645860fbc5d160428a75c50:

    Makefile: replace headers_install with headers for kselftest (2022-07-26 18:06:33 -0600)

----------------------------------------------------------------
linux-kselftest-next-5.20-rc1

This Kselftest update for Linux 5.20-rc1 consists of:

- timers test build fixes and cleanups for new tool chains
- removing khdr from kselftest framework and main Makefile
- changes to test output messages to improve reports

----------------------------------------------------------------
Gautam (2):
kselftests: Enable the echo command to print newlines in Makefile kselftests/damon: add support for cases where debugfs cannot be read

Gautam Menghani (3):
selftests: Make the usage formatting consistent in kselftest_deps.sh selftests/drivers/gpu: Add error messages to drm_mm.sh selftests/kcmp: Make the test output consistent and clear

Guillaume Tucker (6):
selftests: drop khdr make target
selftests: stop using KSFT_KHDR_INSTALL
selftests: drop KSFT_KHDR_INSTALL make target
Makefile: add headers_install to kselftest targets selftests/landlock: drop deprecated headers dependency
Makefile: replace headers_install with headers for kselftest

Johannes Holland (1):
selftests/tpm2: increase timeout for kselftests

Soumya Negi (1):
selftests: drivers/dma-buf: Improve message in selftest summary

Wolfram Sang (9):
selftests: timers: valid-adjtimex: build fix for newer toolchains
selftests: timers: fix declarations of main()
selftests: timers: nanosleep: adapt to kselftest framework
selftests: timers: inconsistency-check: adapt to kselftest framework
selftests: timers: clocksource-switch: fix passing errors from child
selftests: timers: clocksource-switch: sort includes
selftests: timers: clocksource-switch: add command line switch to skip sanity check
selftests: timers: clocksource-switch: add 'runtime' command line parameter
selftests: timers: clocksource-switch: adapt to kselftest framework

Xiang wangx (1):
userfaultfd/selftests: Fix typo in comment

Zan Aziz (1):
selftests:timers: globals don't need initialization to 0

   Makefile                                           |  4 +-
   tools/testing/selftests/Makefile                   | 30 +--------
   tools/testing/selftests/arm64/mte/Makefile         |  1 -
   tools/testing/selftests/arm64/signal/Makefile      |  1 -
   .../testing/selftests/arm64/signal/test_signals.h  |  4 +-
   tools/testing/selftests/damon/_chk_dependency.sh   | 10 +++
   tools/testing/selftests/drivers/dma-buf/udmabuf.c  |  3 +-
   tools/testing/selftests/drivers/gpu/drm_mm.sh      |  4 +-
   .../selftests/drivers/s390x/uvdevice/Makefile      |  1 -
   tools/testing/selftests/futex/functional/Makefile  |  1 -
   tools/testing/selftests/kcmp/kcmp_test.c           |  6 +-
   tools/testing/selftests/kselftest_deps.sh          |  2 +-
   tools/testing/selftests/kvm/Makefile               |  1 -
   tools/testing/selftests/landlock/Makefile          | 10 +--
   tools/testing/selftests/lib.mk                     | 38 ------------
   tools/testing/selftests/net/Makefile               |  1 -
   tools/testing/selftests/net/mptcp/Makefile         |  1 -
   tools/testing/selftests/tc-testing/Makefile        |  1 -
   tools/testing/selftests/timers/adjtick.c           |  2 +-
   .../testing/selftests/timers/alarmtimer-suspend.c  |  2 +-
   tools/testing/selftests/timers/change_skew.c       |  2 +-
   .../testing/selftests/timers/clocksource-switch.c  | 71 ++++++++++++++--------
   .../testing/selftests/timers/inconsistency-check.c | 32 +++++-----
   tools/testing/selftests/timers/nanosleep.c         | 18 +++---
   tools/testing/selftests/timers/raw_skew.c          |  2 +-
   tools/testing/selftests/timers/skew_consistency.c  |  2 +-
   tools/testing/selftests/timers/valid-adjtimex.c    |  2 +-
   tools/testing/selftests/tpm2/settings              |  1 +
   tools/testing/selftests/vm/Makefile                |  1 -
   tools/testing/selftests/vm/userfaultfd.c           |  2 +-
   30 files changed, 111 insertions(+), 145 deletions(-)

create mode 100644 tools/testing/selftests/tpm2/settings
----------------------------------------------------------------

author maintainer
#2 lore raw
Quoted 4 lines · Mickaël Salaün

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

I did a build test from the top level before sending the pull request and didn't catch this breakage as a result. This breaks when build is run from the test directory.

We have had several problems related to khdr_dir and target and decided to move away from it with this change.

Quoted 4 lines

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

That is the usual practice and if I notice missing maintainers, I add them. We missed this one.

Quoted 2 lines

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

Guillaume,

Will you be able to look at this and send a patch on top? I will send another pull request before merge window closes?

Quoted 20 lines
tools/testing/selftests/landlock/Makefile +5 -2
@@ -9,10 +9,13 @@ TEST_GEN_PROGS := $(src_test:.c=)
  TEST_GEN_PROGS_EXTENDED := true
 
  OVERRIDE_TARGETS := 1
+top_srcdir = ../../../..
  include ../lib.mk
 
+khdr_dir = $(top_srcdir)/usr/include
+
  $(OUTPUT)/true: true.c
      $(LINK.c) $< $(LDLIBS) -o $@ -static
 
-$(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
-    $(LINK.c) $< $(LDLIBS) -o $@ -lcap
+$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
+    $(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)
Quoted 2 lines

This doesn't fix the header timestamp check though.

thanks,
-- Shuah

#3 lore raw
Quoted 21 lines · Shuah Khan
Quoted 4 lines · Mickaël Salaün

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

I did a build test from the top level before sending the pull request and didn't catch this breakage as a result. This breaks when build is run from the test directory.

We have had several problems related to khdr_dir and target and decided to move away from it with this change.

Quoted 4 lines

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

That is the usual practice and if I notice missing maintainers, I add them. We missed this one.

Quoted 7 lines
Quoted 2 lines

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

Guillaume,

Will you be able to look at this and send a patch on top? I will send another pull request before merge window closes?

Sure, I'll take a look today.

Also I'll see if we can add some extra build tests in KernelCI for the kselftest tree to catch issues like these automatically.

Best wishes,
Guillaume

Quoted 25 lines
Quoted 14 lines
tools/testing/selftests/landlock/Makefile +0 -0
@@ -9,10 +9,13 @@ TEST_GEN_PROGS := $(src_test:.c=)

  TEST_GEN_PROGS_EXTENDED := true

  OVERRIDE_TARGETS := 1
+top_srcdir = ../../../..
  include ../lib.mk

tools/testing/selftests/landlock/Makefile +2 -0
+khdr_dir = $(top_srcdir)/usr/include
+

  $(OUTPUT)/true: true.c
      $(LINK.c) $< $(LDLIBS) -o $@ -static

Quoted 8 lines

-$(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
-    $(LINK.c) $< $(LDLIBS) -o $@ -lcap
+$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h +    $(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)

This doesn't fix the header timestamp check though.

thanks,
-- Shuah

author maintainer
#4 lore raw
Quoted 25 lines · Guillaume Tucker
Quoted 24 lines · Shuah Khan
Quoted 4 lines · Mickaël Salaün

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

I did a build test from the top level before sending the pull request and didn't catch this breakage as a result. This breaks when build is run from the test directory.

We have had several problems related to khdr_dir and target and decided to move away from it with this change.

Quoted 4 lines

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

That is the usual practice and if I notice missing maintainers, I add them. We missed this one.

Quoted 2 lines

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

Quoted 7 lines
Quoted 4 lines

Guillaume,

Will you be able to look at this and send a patch on top? I will send another pull request before merge window closes?

Sure, I'll take a look today.

Thank you.

Quoted 3 lines

Also I'll see if we can add some extra build tests in KernelCI for the kselftest tree to catch issues like these automatically.

Yes. Adding tests to catch these automatically will be great. Please refer to use-cases for kselftest for tips on tests to add. Beig able to build from individual test directory is one of the use-cases.

thanks,
-- Shuah

#5 lore raw
Quoted 28 lines · Shuah Khan
Quoted 27 lines · Guillaume Tucker
Quoted 26 lines · Shuah Khan
Quoted 4 lines · Mickaël Salaün

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

I did a build test from the top level before sending the pull request and didn't catch this breakage as a result. This breaks when build is run from the test directory.

We have had several problems related to khdr_dir and target and decided to move away from it with this change.

Quoted 4 lines

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

That is the usual practice and if I notice missing maintainers, I add them. We missed this one.

Quoted 2 lines

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

Guillaume,

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Will you be able to look at this and send a patch on top? I will send another pull request before merge window closes?

Sure, I'll take a look today.

Thank you.

OK I just sent "selftests/landlock: fix broken include of linux/landlock.h"

This does fix the build when doing:

make -C tools/testing/selftests/landlock

However I've also noticed the landlock test is failing to build when make is invoked from the top-level directory and using a sub-directory for the build output, in other words my earlier patches didn't fix the build for this test, but that's not a regression.

I'll see if that can be fixed too while also not breaking the "-C" sub-make build.

Quoted 8 lines
Quoted 3 lines

Also I'll see if we can add some extra build tests in KernelCI for the kselftest tree to catch issues like these automatically.

Yes. Adding tests to catch these automatically will be great. Please refer to use-cases for kselftest for tips on tests to add. Beig able to build from individual test directory is one of the use-cases.

Great. Well I shall try and get that set up before making further changes ;)

Best wishes,
Guillaume

P.S. The output of gen_tar is showing "-ne " on every line, is that expected?
For example: -ne Emit Tests for alsa

author maintainer
#6 lore raw
Quoted 35 lines · Guillaume Tucker
Quoted 34 lines · Shuah Khan
Quoted 32 lines · Guillaume Tucker
Quoted 21 lines · Shuah Khan
Quoted 4 lines · Mickaël Salaün

Hi,

This change breaks the Landlock test build when performed on the tools/testing/selftests/landlock directory because the (non-system/up-to-date) kernel headers aren't found. Looking at the use of top_srcdir and HDR_PATH, it seems that multiple subsystems are using this feature. I consider this change a regression.

I did a build test from the top level before sending the pull request and didn't catch this breakage as a result. This breaks when build is run from the test directory.

We have had several problems related to khdr_dir and target and decided to move away from it with this change.

Quoted 4 lines

It also removes the check on up-to-date kernel headers (thanks to the Makefile's target timestamp).

I wasn't CCed for this change impacting Landlock [1]. Please keep in mind to add at least maintainers and related mailing-lists for changes on related subsystems.

That is the usual practice and if I notice missing maintainers, I add them. We missed this one.

Quoted 7 lines
Quoted 2 lines

The following patch almost revert commit a917dd94b832 ("selftests/landlock: drop deprecated headers dependency") and partially fixes commit 49de12ba06ef ("selftests: drop KSFT_KHDR_INSTALL make target"):

Guillaume,

Will you be able to look at this and send a patch on top? I will send another pull request before merge window closes?

Sure, I'll take a look today.

Quoted 8 lines
Quoted 1 line

Thank you.

OK I just sent "selftests/landlock: fix broken include of linux/landlock.h"

This does fix the build when doing:

make -C tools/testing/selftests/landlock

Thank you for fixing this quickly.

Quoted 6 lines

However I've also noticed the landlock test is failing to build when make is invoked from the top-level directory and using a sub-directory for the build output, in other words my earlier patches didn't fix the build for this test, but that's not a regression.

Okay.

Quoted 3 lines

I'll see if that can be fixed too while also not breaking the "-C" sub-make build.

Sounds good. Supporting all these use-cases makes it a bit hard.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Also I'll see if we can add some extra build tests in KernelCI for the kselftest tree to catch issues like these automatically.

Great. Well I shall try and get that set up before making further changes ;)

Thanks.

Quoted 4 lines

P.S. The output of gen_tar is showing "-ne " on every line, is that expected?
For example: -ne Emit Tests for alsa

Hmm. I will try and let you. I haven't used this one in a bit.

thanks,
-- Shuah

merge bot Merged
#7 lore raw
In reply to Shuah Khan
The pull request you sent on Mon, 1 Aug 2022 16:03:40 -0600:

The pull request you sent on Mon, 1 Aug 2022 16:03:40 -0600:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-5.20-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e05d5b9c5bbea80313d8f58c3a80a18839b25480

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html