From 88baa78d1f318e57c7cccbfe55d485befd1ce696 Mon Sep 17 00:00:00 2001 From: "bamvor.zhangjian@huawei.com" Date: Tue, 29 Nov 2016 19:55:47 +0800 Subject: selftests: remove duplicated all and clean target Currently, kselftest use TEST_PROGS, TEST_PROGS_EXTENDED, TEST_FILES to indicate the test program, extended test program and test files. It is easy to understand the purpose of these files. But mix of compiled and uncompiled files lead to duplicated "all" and "clean" targets. In order to remove the duplicated targets, introduce TEST_GEN_PROGS, TEST_GEN_PROGS_EXTENDED, TEST_GEN_FILES to indicate the compiled objects. Also, the later patch will make use of TEST_GEN_XXX to redirect these files to output directory indicated by KBUILD_OUTPUT or O. And add this changes to "Contributing new tests(details)" of Documentation/kselftest.txt. Signed-off-by: Bamvor Jian Zhang Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/Makefile | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'tools/testing/selftests/vm') diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index bbab7f4664ac..323383ab4581 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -1,18 +1,17 @@ # Makefile for vm selftests CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) -BINARIES = compaction_test -BINARIES += hugepage-mmap -BINARIES += hugepage-shm -BINARIES += map_hugetlb -BINARIES += mlock2-tests -BINARIES += on-fault-limit -BINARIES += thuge-gen -BINARIES += transhuge-stress -BINARIES += userfaultfd -BINARIES += mlock-random-test +TEST_GEN_FILES = compaction_test +TEST_GEN_FILES += hugepage-mmap +TEST_GEN_FILES += hugepage-shm +TEST_GEN_FILES += map_hugetlb +TEST_GEN_FILES += mlock2-tests +TEST_GEN_FILES += on-fault-limit +TEST_GEN_FILES += thuge-gen +TEST_GEN_FILES += transhuge-stress +TEST_GEN_FILES += userfaultfd +TEST_GEN_FILES += mlock-random-test -all: $(BINARIES) %: %.c $(CC) $(CFLAGS) -o $@ $^ -lrt userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h @@ -25,9 +24,6 @@ mlock-random-test: mlock-random-test.c make -C ../../../.. headers_install TEST_PROGS := run_vmtests -TEST_FILES := $(BINARIES) include ../lib.mk -clean: - $(RM) $(BINARIES) -- cgit v1.2.3 From 7d758af257bc40a8a599a0aaa4768b30fb463e9c Mon Sep 17 00:00:00 2001 From: "bamvor.zhangjian@huawei.com" Date: Tue, 29 Nov 2016 19:55:49 +0800 Subject: selftests: add default rules for c source file There are difference rules for compiling c source file in different testcases. In order to enable KBUILD_OUTPUT support in later patch, this patch introduce the default rules in "tools/testing/selftest/lib.mk" and remove the existing rules in each testcase. Acked-by: Michael Ellerman Signed-off-by: Bamvor Jian Zhang Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/Makefile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tools/testing/selftests/vm') diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 323383ab4581..8141d5169f4d 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -1,6 +1,7 @@ # Makefile for vm selftests CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) +LDLIBS = -lrt TEST_GEN_FILES = compaction_test TEST_GEN_FILES += hugepage-mmap TEST_GEN_FILES += hugepage-shm @@ -12,18 +13,12 @@ TEST_GEN_FILES += transhuge-stress TEST_GEN_FILES += userfaultfd TEST_GEN_FILES += mlock-random-test -%: %.c - $(CC) $(CFLAGS) -o $@ $^ -lrt -userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h - $(CC) $(CFLAGS) -O2 -o $@ $< -lpthread - -mlock-random-test: mlock-random-test.c - $(CC) $(CFLAGS) -o $@ $< -lcap - -../../../../usr/include/linux/kernel.h: - make -C ../../../.. headers_install - TEST_PROGS := run_vmtests include ../lib.mk +userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h +mlock-random-test: LDLIBS += -lcap + +../../../../usr/include/linux/kernel.h: + make -C ../../../.. headers_install -- cgit v1.2.3 From a8ba798bc8ec663cf02e80b0dd770324de9bafd9 Mon Sep 17 00:00:00 2001 From: "bamvor.zhangjian@huawei.com" Date: Tue, 29 Nov 2016 19:55:52 +0800 Subject: selftests: enable O and KBUILD_OUTPUT Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest to another directory by passing O or KBUILD_OUTPUT. And O is high priority than KBUILD_OUTPUT. Signed-off-by: Bamvor Jian Zhang Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/testing/selftests/vm') diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 8141d5169f4d..983140e68661 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -17,8 +17,8 @@ TEST_PROGS := run_vmtests include ../lib.mk -userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h -mlock-random-test: LDLIBS += -lcap +$(OUTPUT)/userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h +$(OUTPUT)/mlock-random-test: LDLIBS += -lcap ../../../../usr/include/linux/kernel.h: make -C ../../../.. headers_install -- cgit v1.2.3