Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/resctrl: Make resctrl_tests run using kselftest framework

In kselftest framework, all tests can be build/run at a time,
and a sub test also can be build/run individually. As follows:
$ make kselftest-all TARGETS=resctrl
$ make -C tools/testing/selftests run_tests
$ make -C tools/testing/selftests TARGETS=resctrl run_tests

However, resctrl_tests cannot be run using kselftest framework,
users have to change directory to tools/testing/selftests/resctrl/,
run "make" to build executable file "resctrl_tests",
and run "sudo ./resctrl_tests" to execute the test.

To build/run resctrl_tests using kselftest framework.
Modify tools/testing/selftests/Makefile
and tools/testing/selftests/resctrl/Makefile.

Even after this change, users can still build/run resctrl_tests
without using framework as before.

Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> # resctrl changes
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Shaopeng Tan and committed by
Shuah Khan
b733143c 3531d930

+5 -13
+1
tools/testing/selftests/Makefile
··· 53 53 TARGETS += pstore 54 54 TARGETS += ptrace 55 55 TARGETS += openat2 56 + TARGETS += resctrl 56 57 TARGETS += rlimits 57 58 TARGETS += rseq 58 59 TARGETS += rtc
+4 -13
tools/testing/selftests/resctrl/Makefile
··· 1 - CC = $(CROSS_COMPILE)gcc 2 1 CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 3 - SRCS=$(wildcard *.c) 4 - OBJS=$(SRCS:.c=.o) 2 + CFLAGS += $(KHDR_INCLUDES) 5 3 6 - all: resctrl_tests 4 + TEST_GEN_PROGS := resctrl_tests 7 5 8 - $(OBJS): $(SRCS) 9 - $(CC) $(CFLAGS) -c $(SRCS) 6 + include ../lib.mk 10 7 11 - resctrl_tests: $(OBJS) 12 - $(CC) $(CFLAGS) -o $@ $^ 13 - 14 - .PHONY: clean 15 - 16 - clean: 17 - $(RM) $(OBJS) resctrl_tests 8 + $(OUTPUT)/resctrl_tests: $(wildcard *.c)