Commit e05d5b9c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-next-5.20-rc1' of...

Merge tag 'linux-kselftest-next-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest updates from Shuah Khan:

 - 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

* tag 'linux-kselftest-next-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (24 commits)
  Makefile: replace headers_install with headers for kselftest
  selftests/landlock: drop deprecated headers dependency
  selftests: timers: clocksource-switch: adapt to kselftest framework
  selftests: timers: clocksource-switch: add 'runtime' command line parameter
  selftests: timers: clocksource-switch: add command line switch to skip sanity check
  selftests: timers: clocksource-switch: sort includes
  selftests: timers: clocksource-switch: fix passing errors from child
  selftests: timers: inconsistency-check: adapt to kselftest framework
  selftests: timers: nanosleep: adapt to kselftest framework
  selftests: timers: fix declarations of main()
  selftests: timers: valid-adjtimex: build fix for newer toolchains
  Makefile: add headers_install to kselftest targets
  selftests: drop KSFT_KHDR_INSTALL make target
  selftests: stop using KSFT_KHDR_INSTALL
  selftests: drop khdr make target
  selftests: drivers/dma-buf: Improve message in selftest summary
  selftests/kcmp: Make the test output consistent and clear
  selftests:timers: globals don't need initialization to 0
  selftests/drivers/gpu: Add error messages to drm_mm.sh
  selftests/tpm2: increase timeout for kselftests
  ...
parents 665fe72a 4062eba9
...@@ -1348,10 +1348,10 @@ tools/%: FORCE ...@@ -1348,10 +1348,10 @@ tools/%: FORCE
# Kernel selftest # Kernel selftest
PHONY += kselftest PHONY += kselftest
kselftest: kselftest: headers
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
kselftest-%: FORCE kselftest-%: headers FORCE
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $* $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
PHONY += kselftest-merge PHONY += kselftest-merge
......
...@@ -143,7 +143,6 @@ endif ...@@ -143,7 +143,6 @@ endif
# Prepare for headers install # Prepare for headers install
include $(top_srcdir)/scripts/subarch.include include $(top_srcdir)/scripts/subarch.include
ARCH ?= $(SUBARCH) ARCH ?= $(SUBARCH)
export KSFT_KHDR_INSTALL_DONE := 1
export BUILD export BUILD
export KHDR_INCLUDES export KHDR_INCLUDES
...@@ -151,30 +150,7 @@ export KHDR_INCLUDES ...@@ -151,30 +150,7 @@ export KHDR_INCLUDES
# all isn't the first target in the file. # all isn't the first target in the file.
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
# Install headers here once for all tests. KSFT_KHDR_INSTALL_DONE all:
# 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
@ret=1; \ @ret=1; \
for TARGET in $(TARGETS); do \ for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
...@@ -253,7 +229,7 @@ ifdef INSTALL_PATH ...@@ -253,7 +229,7 @@ ifdef INSTALL_PATH
for TARGET in $(TARGETS); do \ for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
[ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \ [ ! -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 \ $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
-C $$TARGET emit_tests >> $(TEST_LIST); \ -C $$TARGET emit_tests >> $(TEST_LIST); \
done; done;
...@@ -274,4 +250,4 @@ clean: ...@@ -274,4 +250,4 @@ clean:
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done; 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
...@@ -22,7 +22,6 @@ ifeq ($(mte_cc_support),1) ...@@ -22,7 +22,6 @@ ifeq ($(mte_cc_support),1)
TEST_GEN_PROGS := $(PROGS) TEST_GEN_PROGS := $(PROGS)
# Get Kernel headers installed and use them. # Get Kernel headers installed and use them.
KSFT_KHDR_INSTALL := 1
else else
$(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.) $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
$(warning test program "mte" will not be created.) $(warning test program "mte" will not be created.)
......
...@@ -11,7 +11,6 @@ PROGS := $(patsubst %.c,%,$(SRCS)) ...@@ -11,7 +11,6 @@ PROGS := $(patsubst %.c,%,$(SRCS))
TEST_GEN_PROGS := $(notdir $(PROGS)) TEST_GEN_PROGS := $(notdir $(PROGS))
# Get Kernel headers installed and use them. # Get Kernel headers installed and use them.
KSFT_KHDR_INSTALL := 1
# Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list # Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list
# to account for any OUTPUT target-dirs optionally provided by # to account for any OUTPUT target-dirs optionally provided by
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
#include <ucontext.h> #include <ucontext.h>
/* /*
* Using ARCH specific and sanitized Kernel headers installed by KSFT * Using ARCH specific and sanitized Kernel headers from the tree.
* framework since we asked for it by setting flag KSFT_KHDR_INSTALL
* in our Makefile.
*/ */
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/hwcap.h> #include <asm/hwcap.h>
......
...@@ -26,3 +26,13 @@ do ...@@ -26,3 +26,13 @@ do
exit 1 exit 1
fi fi
done 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
...@@ -32,7 +32,8 @@ int main(int argc, char *argv[]) ...@@ -32,7 +32,8 @@ int main(int argc, char *argv[])
devfd = open("/dev/udmabuf", O_RDWR); devfd = open("/dev/udmabuf", O_RDWR);
if (devfd < 0) { 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); exit(77);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Runs API tests for struct drm_mm (DRM range manager) # Runs API tests for struct drm_mm (DRM range manager)
if ! /sbin/modprobe -n -q test-drm_mm; then 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 exit 77
fi fi
...@@ -11,6 +11,6 @@ if /sbin/modprobe -q test-drm_mm; then ...@@ -11,6 +11,6 @@ if /sbin/modprobe -q test-drm_mm; then
/sbin/modprobe -q -r test-drm_mm /sbin/modprobe -q -r test-drm_mm
echo "drivers/gpu/drm_mm: ok" echo "drivers/gpu/drm_mm: ok"
else else
echo "drivers/gpu/drm_mm: [FAIL]" echo "drivers/gpu/drm_mm: module test-drm_mm could not be removed [FAIL]"
exit 1 exit 1
fi fi
...@@ -11,7 +11,6 @@ else ...@@ -11,7 +11,6 @@ else
TEST_GEN_PROGS := test_uvdevice TEST_GEN_PROGS := test_uvdevice
top_srcdir ?= ../../../../../.. top_srcdir ?= ../../../../../..
KSFT_KHDR_INSTALL := 1
khdr_dir = $(top_srcdir)/usr/include khdr_dir = $(top_srcdir)/usr/include
LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
......
...@@ -22,7 +22,6 @@ TEST_GEN_FILES := \ ...@@ -22,7 +22,6 @@ TEST_GEN_FILES := \
TEST_PROGS := run.sh TEST_PROGS := run.sh
top_srcdir = ../../../../.. top_srcdir = ../../../../..
KSFT_KHDR_INSTALL := 1
DEFAULT_INSTALL_HDR_PATH := 1 DEFAULT_INSTALL_HDR_PATH := 1
include ../../lib.mk include ../../lib.mk
......
...@@ -88,6 +88,9 @@ int main(int argc, char **argv) ...@@ -88,6 +88,9 @@ int main(int argc, char **argv)
int pid2 = getpid(); int pid2 = getpid();
int ret; int ret;
ksft_print_header();
ksft_set_plan(3);
fd2 = open(kpath, O_RDWR, 0644); fd2 = open(kpath, O_RDWR, 0644);
if (fd2 < 0) { if (fd2 < 0) {
perror("Can't open file"); perror("Can't open file");
...@@ -152,7 +155,6 @@ int main(int argc, char **argv) ...@@ -152,7 +155,6 @@ int main(int argc, char **argv)
ksft_inc_pass_cnt(); ksft_inc_pass_cnt();
} }
ksft_print_cnts();
if (ret) if (ret)
ksft_exit_fail(); ksft_exit_fail();
...@@ -162,5 +164,5 @@ int main(int argc, char **argv) ...@@ -162,5 +164,5 @@ int main(int argc, char **argv)
waitpid(pid2, &status, P_ALL); waitpid(pid2, &status, P_ALL);
return ksft_exit_pass(); return 0;
} }
...@@ -26,7 +26,7 @@ echo " main Makefile when optional -p is specified." ...@@ -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 dependency check for each tests/sub-test."
echo "- Prints pass/fail targets and libraries." echo "- Prints pass/fail targets and libraries."
echo "- Default: runs dependency checks on all tests." 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 exit 1
} }
......
...@@ -4,7 +4,6 @@ include ../../../build/Build.include ...@@ -4,7 +4,6 @@ include ../../../build/Build.include
all: all:
top_srcdir = ../../../.. top_srcdir = ../../../..
KSFT_KHDR_INSTALL := 1
# For cross-builds to work, UNAME_M has to map to ARCH and arch specific # 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 # directories and targets in this Makefile. "uname -m" doesn't map to
......
...@@ -8,17 +8,11 @@ TEST_GEN_PROGS := $(src_test:.c=) ...@@ -8,17 +8,11 @@ TEST_GEN_PROGS := $(src_test:.c=)
TEST_GEN_PROGS_EXTENDED := true TEST_GEN_PROGS_EXTENDED := true
KSFT_KHDR_INSTALL := 1
OVERRIDE_TARGETS := 1 OVERRIDE_TARGETS := 1
include ../lib.mk include ../lib.mk
khdr_dir = $(top_srcdir)/usr/include
$(khdr_dir)/linux/landlock.h: khdr
@:
$(OUTPUT)/true: true.c $(OUTPUT)/true: true.c
$(LINK.c) $< $(LDLIBS) -o $@ -static $(LINK.c) $< $(LDLIBS) -o $@ -static
$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h $(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
$(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir) $(LINK.c) $< $(LDLIBS) -o $@ -lcap
...@@ -51,45 +51,7 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) ...@@ -51,45 +51,7 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) 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) all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
endif
define RUN_TESTS define RUN_TESTS
BASE_DIR="$(selfdir)"; \ BASE_DIR="$(selfdir)"; \
......
...@@ -63,7 +63,6 @@ TEST_GEN_FILES += io_uring_zerocopy_tx ...@@ -63,7 +63,6 @@ TEST_GEN_FILES += io_uring_zerocopy_tx
TEST_FILES := settings TEST_FILES := settings
KSFT_KHDR_INSTALL := 1
include ../lib.mk include ../lib.mk
include bpf/Makefile include bpf/Makefile
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
top_srcdir = ../../../../.. top_srcdir = ../../../../..
KSFT_KHDR_INSTALL := 1
CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
......
...@@ -5,7 +5,6 @@ top_srcdir = $(abspath ../../../..) ...@@ -5,7 +5,6 @@ top_srcdir = $(abspath ../../../..)
APIDIR := $(top_scrdir)/include/uapi APIDIR := $(top_scrdir)/include/uapi
TEST_GEN_FILES = action.o TEST_GEN_FILES = action.o
KSFT_KHDR_INSTALL := 1
include ../lib.mk include ../lib.mk
PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1) PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
......
...@@ -165,7 +165,7 @@ int check_tick_adj(long tickval) ...@@ -165,7 +165,7 @@ int check_tick_adj(long tickval)
return 0; return 0;
} }
int main(int argv, char **argc) int main(int argc, char **argv)
{ {
struct timespec raw; struct timespec raw;
long tick, max, interval, err; long tick, max, interval, err;
......
...@@ -92,7 +92,7 @@ long long timespec_sub(struct timespec a, struct timespec b) ...@@ -92,7 +92,7 @@ long long timespec_sub(struct timespec a, struct timespec b)
return ret; return ret;
} }
int final_ret = 0; int final_ret;
void sigalarm(int signo) void sigalarm(int signo)
{ {
......
...@@ -55,7 +55,7 @@ int change_skew_test(int ppm) ...@@ -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; struct timex tx;
int i, ret; int i, ret;
......
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
*/ */
#include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/timex.h> #include <sys/timex.h>
#include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include "../kselftest.h" #include "../kselftest.h"
...@@ -110,21 +110,40 @@ int run_tests(int secs) ...@@ -110,21 +110,40 @@ int run_tests(int secs)
sprintf(buf, "./inconsistency-check -t %i", secs); sprintf(buf, "./inconsistency-check -t %i", secs);
ret = system(buf); ret = system(buf);
if (ret) if (WIFEXITED(ret) && WEXITSTATUS(ret))
return ret; return WEXITSTATUS(ret);
ret = system("./nanosleep"); ret = system("./nanosleep");
return ret; return WIFEXITED(ret) ? WEXITSTATUS(ret) : 0;
} }
char clocksource_list[10][30]; char clocksource_list[10][30];
int main(int argv, char **argc) int main(int argc, char **argv)
{ {
char orig_clk[512]; char orig_clk[512];
int count, i, status; int count, i, status, opt;
int do_sanity_check = 1;
int runtime = 60;
pid_t pid; pid_t pid;
/* Process arguments */
while ((opt = getopt(argc, argv, "st:")) != -1) {
switch (opt) {
case 's':
do_sanity_check = 0;
break;
case 't':
runtime = atoi(optarg);
break;
default:
printf("Usage: %s [-s] [-t <secs>]\n", argv[0]);
printf(" -s: skip sanity checks\n");
printf(" -t: Number of seconds to run\n");
exit(-1);
}
}
get_cur_clocksource(orig_clk, 512); get_cur_clocksource(orig_clk, 512);
count = get_clocksources(clocksource_list); count = get_clocksources(clocksource_list);
...@@ -135,8 +154,10 @@ int main(int argv, char **argc) ...@@ -135,8 +154,10 @@ int main(int argv, char **argc)
} }
/* Check everything is sane before we start switching asynchronously */ /* Check everything is sane before we start switching asynchronously */
if (do_sanity_check) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
printf("Validating clocksource %s\n", clocksource_list[i]); printf("Validating clocksource %s\n",
clocksource_list[i]);
if (change_clocksource(clocksource_list[i])) { if (change_clocksource(clocksource_list[i])) {
status = -1; status = -1;
goto out; goto out;
...@@ -146,12 +167,12 @@ int main(int argv, char **argc) ...@@ -146,12 +167,12 @@ int main(int argv, char **argc)
goto out; goto out;
} }
} }
}
printf("Running Asynchronous Switching Tests...\n"); printf("Running Asynchronous Switching Tests...\n");
pid = fork(); pid = fork();
if (!pid) if (!pid)
return run_tests(60); return run_tests(runtime);
while (pid != waitpid(pid, &status, WNOHANG)) while (pid != waitpid(pid, &status, WNOHANG))
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
...@@ -162,7 +183,9 @@ int main(int argv, char **argc) ...@@ -162,7 +183,9 @@ int main(int argv, char **argc)
out: out:
change_clocksource(orig_clk); change_clocksource(orig_clk);
if (status) /* Print at the end to not mix output with child process */
return ksft_exit_fail(); ksft_print_header();
return ksft_exit_pass(); ksft_set_plan(1);
ksft_test_result(!status, "clocksource-switch\n");
ksft_exit(!status);
} }
...@@ -122,30 +122,28 @@ int consistency_test(int clock_type, unsigned long seconds) ...@@ -122,30 +122,28 @@ int consistency_test(int clock_type, unsigned long seconds)
if (inconsistent >= 0) { if (inconsistent >= 0) {
unsigned long long delta; unsigned long long delta;
printf("\%s\n", start_str); ksft_print_msg("\%s\n", start_str);
for (i = 0; i < CALLS_PER_LOOP; i++) { for (i = 0; i < CALLS_PER_LOOP; i++) {
if (i == inconsistent) if (i == inconsistent)
printf("--------------------\n"); ksft_print_msg("--------------------\n");
printf("%lu:%lu\n", list[i].tv_sec, ksft_print_msg("%lu:%lu\n", list[i].tv_sec,
list[i].tv_nsec); list[i].tv_nsec);
if (i == inconsistent + 1) if (i == inconsistent + 1)
printf("--------------------\n"); ksft_print_msg("--------------------\n");
} }
delta = list[inconsistent].tv_sec * NSEC_PER_SEC; delta = list[inconsistent].tv_sec * NSEC_PER_SEC;
delta += list[inconsistent].tv_nsec; delta += list[inconsistent].tv_nsec;
delta -= list[inconsistent+1].tv_sec * NSEC_PER_SEC; delta -= list[inconsistent+1].tv_sec * NSEC_PER_SEC;
delta -= list[inconsistent+1].tv_nsec; delta -= list[inconsistent+1].tv_nsec;
printf("Delta: %llu ns\n", delta); ksft_print_msg("Delta: %llu ns\n", delta);
fflush(0); fflush(0);
/* timestamp inconsistency*/ /* timestamp inconsistency*/
t = time(0); t = time(0);
printf("%s\n", ctime(&t)); ksft_print_msg("%s\n", ctime(&t));
printf("[FAILED]\n");
return -1; return -1;
} }
now = list[0].tv_sec; now = list[0].tv_sec;
} }
printf("[OK]\n");
return 0; return 0;
} }
...@@ -178,16 +176,22 @@ int main(int argc, char *argv[]) ...@@ -178,16 +176,22 @@ int main(int argc, char *argv[])
setbuf(stdout, NULL); setbuf(stdout, NULL);
ksft_print_header();
ksft_set_plan(maxclocks - userclock);
for (clockid = userclock; clockid < maxclocks; clockid++) { 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; continue;
}
if (!clock_gettime(clockid, &ts)) { if (consistency_test(clockid, runtime)) {
printf("Consistent %-30s ", clockstring(clockid)); ksft_test_result_fail("%-31s\n", clockstring(clockid));
if (consistency_test(clockid, runtime)) ksft_exit_fail();
return ksft_exit_fail(); } else {
ksft_test_result_pass("%-31s\n", clockstring(clockid));
} }
} }
return ksft_exit_pass(); ksft_exit_pass();
} }
...@@ -133,33 +133,37 @@ int main(int argc, char **argv) ...@@ -133,33 +133,37 @@ int main(int argc, char **argv)
long long length; long long length;
int clockid, ret; int clockid, ret;
ksft_print_header();
ksft_set_plan(NR_CLOCKIDS);
for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) { for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) {
/* Skip cputime clockids since nanosleep won't increment cputime */ /* Skip cputime clockids since nanosleep won't increment cputime */
if (clockid == CLOCK_PROCESS_CPUTIME_ID || if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
clockid == CLOCK_THREAD_CPUTIME_ID || clockid == CLOCK_THREAD_CPUTIME_ID ||
clockid == CLOCK_HWSPECIFIC) clockid == CLOCK_HWSPECIFIC) {
ksft_test_result_skip("%-31s\n", clockstring(clockid));
continue; continue;
}
printf("Nanosleep %-31s ", clockstring(clockid));
fflush(stdout); fflush(stdout);
length = 10; length = 10;
while (length <= (NSEC_PER_SEC * 10)) { while (length <= (NSEC_PER_SEC * 10)) {
ret = nanosleep_test(clockid, length); ret = nanosleep_test(clockid, length);
if (ret == UNSUPPORTED) { if (ret == UNSUPPORTED) {
printf("[UNSUPPORTED]\n"); ksft_test_result_skip("%-31s\n", clockstring(clockid));
goto next; goto next;
} }
if (ret < 0) { if (ret < 0) {
printf("[FAILED]\n"); ksft_test_result_fail("%-31s\n", clockstring(clockid));
return ksft_exit_fail(); ksft_exit_fail();
} }
length *= 100; length *= 100;
} }
printf("[OK]\n"); ksft_test_result_pass("%-31s\n", clockstring(clockid));
next: next:
ret = 0; ret = 0;
} }
return ksft_exit_pass(); ksft_exit_pass();
} }
...@@ -89,7 +89,7 @@ void get_monotonic_and_raw(struct timespec *mon, struct timespec *raw) ...@@ -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; struct timespec mon, raw, start, end;
long long delta1, delta2, interval, eppm, ppm; long long delta1, delta2, interval, eppm, ppm;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define NSEC_PER_SEC 1000000000LL #define NSEC_PER_SEC 1000000000LL
int main(int argv, char **argc) int main(int argc, char **argv)
{ {
struct timex tx; struct timex tx;
int ret, ppm; int ret, ppm;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define ADJ_SETOFFSET 0x0100 #define ADJ_SETOFFSET 0x0100
#include <sys/syscall.h> #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); return syscall(__NR_clock_adjtime, id, tx);
} }
......
...@@ -94,7 +94,6 @@ TEST_PROGS := run_vmtests.sh ...@@ -94,7 +94,6 @@ TEST_PROGS := run_vmtests.sh
TEST_FILES := test_vmalloc.sh TEST_FILES := test_vmalloc.sh
TEST_FILES += test_hmm.sh TEST_FILES += test_hmm.sh
KSFT_KHDR_INSTALL := 1
include ../lib.mk include ../lib.mk
$(OUTPUT)/madv_populate: vm_util.c $(OUTPUT)/madv_populate: vm_util.c
......
...@@ -860,7 +860,7 @@ static int stress(struct uffd_stats *uffd_stats) ...@@ -860,7 +860,7 @@ static int stress(struct uffd_stats *uffd_stats)
/* /*
* Be strict and immediately zap area_src, the whole area has * Be strict and immediately zap area_src, the whole area has
* been transferred already by the background treads. The * 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 * running uffdio_threads reading zeropages after we zapped
* area_src (but they're guaranteed to get -EEXIST from * area_src (but they're guaranteed to get -EEXIST from
* UFFDIO_COPY without writing zero pages into area_dst * UFFDIO_COPY without writing zero pages into area_dst
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment