From: "Tan, Shaopeng" <tan.shaopeng@xxxxxxxxxxxxxx> This commit enables kselftest to be built/run in resctrl framework. Build/run resctrl_tests by build/run all tests of kselftest, or by using the "TARGETS" variable on the make command line to specify resctrl_tests. To make resctrl_tests run using kselftest framework, this commit modified the Makefile of kernel kselftest set and the Makefile of resctrl_tests. To ensure the resctrl_tests finish in limited time, this commit changed the default limited time(45s) to 120 seconds for resctrl_tests by adding "setting" file. Signed-off-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx> --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/resctrl/Makefile | 21 +++++++++------------ tools/testing/selftests/resctrl/settings | 1 + 3 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 tools/testing/selftests/resctrl/settings diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index c852eb4..7df397c 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -51,6 +51,7 @@ TARGETS += proc TARGETS += pstore TARGETS += ptrace TARGETS += openat2 +TARGETS += resctrl TARGETS += rlimits TARGETS += rseq TARGETS += rtc diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile index 6bcee2e..3786cbb 100644 --- a/tools/testing/selftests/resctrl/Makefile +++ b/tools/testing/selftests/resctrl/Makefile @@ -1,17 +1,14 @@ -CC = $(CROSS_COMPILE)gcc -CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -SRCS=$(wildcard *.c) -OBJS=$(SRCS:.c=.o) +# SPDX-License-Identifier: GPL-2.0 +# Makefile for resctrl selftests -all: resctrl_tests +CFLAGS += -g -Wall -O2 -D_FORTIFY_SOURCE=2 +LDLIBS += -lnuma -$(OBJS): $(SRCS) - $(CC) $(CFLAGS) -c $(SRCS) +TEST_GEN_PROGS := resctrl_tests +EXTRA_SOURCES := $(wildcard *.c) -resctrl_tests: $(OBJS) - $(CC) $(CFLAGS) -o $@ $^ +all: $(TEST_GEN_PROGS) -.PHONY: clean +$(TEST_GEN_PROGS): $(EXTRA_SOURCES) -clean: - $(RM) $(OBJS) resctrl_tests +include ../lib.mk diff --git a/tools/testing/selftests/resctrl/settings b/tools/testing/selftests/resctrl/settings new file mode 100644 index 0000000..6091b45 --- /dev/null +++ b/tools/testing/selftests/resctrl/settings @@ -0,0 +1 @@ +timeout=120 -- 1.8.3.1