]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
selftests: remove duplicated all and clean target
authorbamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com>
Tue, 29 Nov 2016 11:55:47 +0000 (19:55 +0800)
committerShuah Khan <shuahkh@osg.samsung.com>
Thu, 5 Jan 2017 20:41:35 +0000 (13:41 -0700)
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 <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
37 files changed:
Documentation/kselftest.txt
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/breakpoints/Makefile
tools/testing/selftests/capabilities/Makefile
tools/testing/selftests/efivarfs/Makefile
tools/testing/selftests/exec/Makefile
tools/testing/selftests/futex/functional/Makefile
tools/testing/selftests/ipc/Makefile
tools/testing/selftests/kcmp/Makefile
tools/testing/selftests/lib.mk
tools/testing/selftests/membarrier/Makefile
tools/testing/selftests/memfd/Makefile
tools/testing/selftests/mount/Makefile
tools/testing/selftests/mqueue/Makefile
tools/testing/selftests/net/Makefile
tools/testing/selftests/nsfs/Makefile
tools/testing/selftests/powerpc/alignment/Makefile
tools/testing/selftests/powerpc/benchmarks/Makefile
tools/testing/selftests/powerpc/context_switch/Makefile
tools/testing/selftests/powerpc/copyloops/Makefile
tools/testing/selftests/powerpc/dscr/Makefile
tools/testing/selftests/powerpc/math/Makefile
tools/testing/selftests/powerpc/mm/Makefile
tools/testing/selftests/powerpc/pmu/Makefile
tools/testing/selftests/powerpc/pmu/ebb/Makefile
tools/testing/selftests/powerpc/primitives/Makefile
tools/testing/selftests/powerpc/stringloops/Makefile
tools/testing/selftests/powerpc/switch_endian/Makefile
tools/testing/selftests/powerpc/syscalls/Makefile
tools/testing/selftests/powerpc/tm/Makefile
tools/testing/selftests/powerpc/vphn/Makefile
tools/testing/selftests/ptrace/Makefile
tools/testing/selftests/seccomp/Makefile
tools/testing/selftests/sigaltstack/Makefile
tools/testing/selftests/size/Makefile
tools/testing/selftests/timers/Makefile
tools/testing/selftests/vm/Makefile

index e5c7254e73d7d4c079638df02b376f81537bea48..d431dc82c2284faeee205ca9aaf8dcef7f0591c0 100644 (file)
@@ -95,3 +95,15 @@ In general, the rules for selftests are
 
  * Don't cause the top-level "make run_tests" to fail if your feature is
    unconfigured.
+
+Contributing new tests(details)
+===============================
+
+ * Use TEST_GEN_XXX if such binaries or files are generated during
+   compiling.
+   TEST_PROGS, TEST_GEN_PROGS mean it is the excutable tested by
+   default.
+   TEST_PROGS_EXTENDED, TEST_GEN_PROGS_EXTENDED mean it is the
+   executable which is not tested by default.
+   TEST_FILES, TEST_GEN_FILES mean it is the file which is used by
+   test.
index 7a5f24543a5f06fc92e2c0c139f6af7a05f9ea37..058351b0694fddd7d0c56163c77498297e4be4f6 100644 (file)
@@ -1,13 +1,7 @@
 CFLAGS += -Wall -O2 -I../../../../usr/include
 
-test_objs = test_verifier test_maps test_lru_map
+TEST_GEN_PROGS = test_verifier test_maps test_lru_map
 
-TEST_PROGS := test_verifier test_maps test_lru_map test_kmod.sh
-TEST_FILES := $(test_objs)
-
-all: $(test_objs)
+TEST_PROGS := test_kmod.sh
 
 include ../lib.mk
-
-clean:
-       $(RM) $(test_objs)
index 61b79e8df1f4587c655fd3c440575241196e3a92..72aa103e4141d3b252c00a8bcf680edc4cd2dfbb 100644 (file)
@@ -3,17 +3,13 @@ uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
 
 ifeq ($(ARCH),x86)
-TEST_PROGS := breakpoint_test
+TEST_GEN_PROGS := breakpoint_test
 endif
 ifeq ($(ARCH),aarch64)
-TEST_PROGS := breakpoint_test_arm64
+TEST_GEN_PROGS := breakpoint_test_arm64
 endif
 
-TEST_PROGS += step_after_suspend_test
-
-all: $(TEST_PROGS)
+TEST_GEN_PROGS += step_after_suspend_test
 
 include ../lib.mk
 
-clean:
-       rm -fr breakpoint_test breakpoint_test_arm64 step_after_suspend_test
index 008602aed9209237254ca334a0a745f06c0888c4..29b8adfdac717d76cd32def4aaf61e94744b733f 100644 (file)
@@ -1,15 +1,8 @@
-TEST_FILES := validate_cap
-TEST_PROGS := test_execve
-
-BINARIES := $(TEST_FILES) $(TEST_PROGS)
+TEST_GEN_FILES := validate_cap
+TEST_GEN_PROGS := test_execve
 
 CFLAGS += -O2 -g -std=gnu99 -Wall
 LDLIBS += -lcap-ng -lrt -ldl
 
-all: $(BINARIES)
-
-clean:
-       $(RM) $(BINARIES)
-
 include ../lib.mk
 
index 736c3ddfc787499a3a114ab87ad173054e5468c2..c49dcea69319a36e98eabb9a44bdc5b75ff94575 100644 (file)
@@ -1,13 +1,7 @@
 CFLAGS = -Wall
 
-test_objs = open-unlink create-read
-
-all: $(test_objs)
-
+TEST_GEN_FILES := open-unlink create-read
 TEST_PROGS := efivarfs.sh
-TEST_FILES := $(test_objs)
 
 include ../lib.mk
 
-clean:
-       rm -f $(test_objs)
index d4300602bf376a5f6e87b1eb17620d3652dd9795..b3bf091368ca9e1ec2d6bb926015bafde0c1061a 100644 (file)
@@ -1,7 +1,4 @@
 CFLAGS = -Wall
-BINARIES = execveat
-DEPS = execveat.symlink execveat.denatured script subdir
-all: $(BINARIES) $(DEPS)
 
 subdir:
        mkdir -p $@
@@ -17,11 +14,12 @@ execveat.denatured: execveat
 %: %.c
        $(CC) $(CFLAGS) -o $@ $^
 
-TEST_PROGS := execveat
+TEST_GEN_PROGS := execveat
+TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
 # Makefile is a run-time dependency, since it's accessed by the execveat test
-TEST_FILES := $(DEPS) Makefile
+TEST_FILES := Makefile
 
 include ../lib.mk
 
 clean:
-       rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
+       rm -rf $(TEST_GEN_PROGS) $(TEST_GEN_FILES) subdir.moved execveat.moved xxxxx*
index 9d6b75ef7b5d679a698862b2406b619e633e8672..ac35782ce1e5595d4255399aa4ee6ec4ec4a7f1d 100644 (file)
@@ -3,7 +3,7 @@ CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
 LDFLAGS := $(LDFLAGS) -pthread -lrt
 
 HEADERS := ../include/futextest.h
-TARGETS := \
+TEST_GEN_FILES := \
        futex_wait_timeout \
        futex_wait_wouldblock \
        futex_requeue_pi \
@@ -12,14 +12,8 @@ TARGETS := \
        futex_wait_uninitialized_heap \
        futex_wait_private_mapped_file
 
-TEST_PROGS := $(TARGETS) run.sh
-
-.PHONY: all clean
-all: $(TARGETS)
-
-$(TARGETS): $(HEADERS)
+TEST_PROGS := run.sh
 
 include ../../lib.mk
 
-clean:
-       rm -f $(TARGETS)
+$(TEST_GEN_FILES): $(HEADERS)
index 25d2e702c68a53f7021d47404fd59d69241f430c..30ef4c7f53eaa3d29baaa47b69fd9090e328b8a9 100644 (file)
@@ -11,12 +11,7 @@ endif
 
 CFLAGS += -I../../../../usr/include/
 
-all:
-       $(CC) $(CFLAGS) msgque.c -o msgque_test
-
-TEST_PROGS := msgque_test
+TEST_GEN_PROGS := msgque
 
 include ../lib.mk
 
-clean:
-       rm -fr ./msgque_test
index 2ae7450a9a8984e2f0ba86a96842010375076757..9e8b673d41b126637e2164a48bbf3a3a19f54f41 100644 (file)
@@ -1,10 +1,8 @@
 CFLAGS += -I../../../../usr/include/
 
-all: kcmp_test
-
-TEST_PROGS := kcmp_test
+TEST_GEN_PROGS := kcmp_test
 
 include ../lib.mk
 
 clean:
-       $(RM) kcmp_test kcmp-test-file
+       $(RM) $(TEST_GEN_PROGS) kcmp-test-file
index 50a93f5f13d64d5b0f9b4851d03f955da9b6e1d9..9fddffd066ca9eb07d81b51befae5cebe6424e33 100644 (file)
@@ -3,7 +3,7 @@
 CC := $(CROSS_COMPILE)gcc
 
 define RUN_TESTS
-       @for TEST in $(TEST_PROGS); do \
+       @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
                (./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
        done;
 endef
@@ -14,8 +14,13 @@ run_tests: all
 define INSTALL_RULE
        @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then                                        \
                mkdir -p ${INSTALL_PATH};                                                                               \
-               echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/";       \
-               rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/;              \
+               echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/";       \
+               rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/;              \
+       fi
+       @if [ "X$(TEST_GEN_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then                                    \
+               mkdir -p ${INSTALL_PATH};                                                                               \
+               echo "rsync -a $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/";        \
+               rsync -a $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/;               \
        fi
 endef
 
@@ -27,7 +32,7 @@ else
 endif
 
 define EMIT_TESTS
-       @for TEST in $(TEST_PROGS); do \
+       @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
                echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
        done;
 endef
@@ -35,4 +40,9 @@ endef
 emit_tests:
        $(EMIT_TESTS)
 
+all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
+
+clean:
+       $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
+
 .PHONY: run_tests all clean install emit_tests
index a1a97085847d2e173f836864f35dfccc38229c2a..02845532b0592315399ed384c98efb25a79c1034 100644 (file)
@@ -1,10 +1,6 @@
 CFLAGS += -g -I../../../../usr/include/
 
-TEST_PROGS := membarrier_test
-
-all: $(TEST_PROGS)
+TEST_GEN_PROGS := membarrier_test
 
 include ../lib.mk
 
-clean:
-       $(RM) $(TEST_PROGS)
index fd396ac811b6a73f086e605ef93e0d2c92401ad6..2c87f2376e5986a501658815f7864862c4f3a02c 100644 (file)
@@ -4,19 +4,11 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 CFLAGS += -I../../../../usr/include/
 
-TEST_PROGS := memfd_test
-
-all: $(TEST_PROGS)
-
-include ../lib.mk
-
-build_fuse: fuse_mnt fuse_test
+TEST_PROGS := run_fuse_test.sh
+TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
 fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
 
-run_fuse: build_fuse
-       @./run_fuse_test.sh || echo "fuse_test: [FAIL]"
+include ../lib.mk
 
-clean:
-       $(RM) memfd_test fuse_test
index 5e35c9c50b72bbebcfb9393928bc10a03fb44479..e8fb15e801722748fad1f2b2d2ac24a56cf82a65 100644 (file)
@@ -1,14 +1,14 @@
 # Makefile for mount selftests.
 CFLAGS = -Wall \
          -O2
-all: unprivileged-remount-test
 
 unprivileged-remount-test: unprivileged-remount-test.c
        $(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test
 
+TEST_GEN_PROGS := unprivileged-remount-test
+
 include ../lib.mk
 
-TEST_PROGS := unprivileged-remount-test
 override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
                      then      \
                                ./unprivileged-remount-test ; \
@@ -17,5 +17,3 @@ override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
                      fi
 override EMIT_TESTS := echo "$(RUN_TESTS)"
 
-clean:
-       rm -f unprivileged-remount-test
index eebac29acbd91fc6d10b6258f006834834e4b243..79a664aeb8d76509a2f8e46aadf742571765a26a 100644 (file)
@@ -1,8 +1,6 @@
 CFLAGS += -O2
 LDLIBS = -lrt -lpthread -lpopt
-TEST_PROGS := mq_open_tests mq_perf_tests
-
-all: $(TEST_PROGS)
+TEST_GEN_PROGS := mq_open_tests mq_perf_tests
 
 include ../lib.mk
 
@@ -16,5 +14,3 @@ override define EMIT_TESTS
        echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
 endef
 
-clean:
-       rm -f mq_open_tests mq_perf_tests
index e24e4c82542e076856c0b99463e9e8cbb1363211..fe5b36dd7140d43d3c40700acba4b7f082005dbb 100644 (file)
@@ -3,20 +3,15 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-NET_PROGS =  socket
-NET_PROGS += psock_fanout psock_tpacket
-NET_PROGS += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-NET_PROGS += reuseport_dualstack
-
-all: $(NET_PROGS)
 reuseport_bpf_numa: LDFLAGS += -lnuma
 %: %.c
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh
-TEST_FILES := $(NET_PROGS)
+TEST_GEN_FILES =  socket
+TEST_GEN_FILES += psock_fanout psock_tpacket
+TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
+TEST_GEN_FILES += reuseport_dualstack
 
 include ../lib.mk
 
-clean:
-       $(RM) $(NET_PROGS)
index 2306054a901a4059102eecf7d47bbab6fe1de630..9ff7c7f80625c18b97edc0854193c6ab48f936a4 100644 (file)
@@ -1,12 +1,5 @@
-TEST_PROGS := owner pidns
+TEST_GEN_PROGS := owner pidns
 
 CFLAGS := -Wall -Werror
 
-all: owner pidns
-owner: owner.c
-pidns: pidns.c
-
-clean:
-       $(RM) owner pidns
-
 include ../lib.mk
index ad6a4e49da916e0da10d68b0311efb2c7d2d95b8..16b22004e75f4526e3b527f410fa78a9ce4bcc44 100644 (file)
@@ -1,10 +1,5 @@
-TEST_PROGS := copy_unaligned copy_first_unaligned paste_unaligned paste_last_unaligned
-
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c ../utils.c copy_paste_unaligned_common.c
+TEST_GEN_PROGS := copy_unaligned copy_first_unaligned paste_unaligned paste_last_unaligned
 
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS)
+$(TEST_GEN_PROGS): ../harness.c ../utils.c copy_paste_unaligned_common.c
index 545077f98f72d72ea5fce37892812295c0ebe32b..08a55bd178005699bb8ad93da09ec9fa3b7eda99 100644 (file)
@@ -1,16 +1,11 @@
-TEST_PROGS := gettimeofday context_switch mmap_bench futex_bench null_syscall
+TEST_GEN_PROGS := gettimeofday context_switch mmap_bench futex_bench null_syscall
 
 CFLAGS += -O2
 
-all: $(TEST_PROGS)
+$(TEST_GEN_PROGS): ../harness.c
 
-$(TEST_PROGS): ../harness.c
+include ../../lib.mk
 
 context_switch: ../utils.c
 context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
 context_switch: LDLIBS += -lpthread
-
-include ../../lib.mk
-
-clean:
-       rm -f $(TEST_PROGS) *.o
index e164d14664661a72b43f4d11df41c08d5c5b54f2..e9351bb4285d086c67677c47193d9a3be8251b56 100644 (file)
@@ -1,10 +1,5 @@
-TEST_PROGS := cp_abort
-
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c ../utils.c
+TEST_GEN_PROGS := cp_abort
 
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS)
+$(TEST_GEN_PROGS): ../harness.c ../utils.c
index 384843ea0d40b66f06e96fde05a7a2b6abb53751..9ad1558e2ea9ca749277c1bd03dd9888474ddce8 100644 (file)
@@ -7,19 +7,14 @@ CFLAGS += -maltivec
 # Use our CFLAGS for the implicit .S rule
 ASFLAGS = $(CFLAGS)
 
-TEST_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
+TEST_GEN_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
 EXTRA_SOURCES := validate.c ../harness.c
 
-all: $(TEST_PROGS)
+include ../../lib.mk
 
 copyuser_64:     CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
 copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
 memcpy_64:       CPPFLAGS += -D COPY_LOOP=test_memcpy
 memcpy_power7:   CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
 
-$(TEST_PROGS): $(EXTRA_SOURCES)
-
-include ../../lib.mk
-
-clean:
-       rm -f $(TEST_PROGS) *.o
+$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
index 49327ee84e3a32fc26415afe04f8075e52a8872e..4262de42017bc4eae1f8860054516316d6250a09 100644 (file)
@@ -1,14 +1,9 @@
-TEST_PROGS := dscr_default_test dscr_explicit_test dscr_user_test      \
+TEST_GEN_PROGS := dscr_default_test dscr_explicit_test dscr_user_test  \
              dscr_inherit_test dscr_inherit_exec_test dscr_sysfs_test  \
              dscr_sysfs_thread_test
 
-dscr_default_test: LDLIBS += -lpthread
-
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c
-
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS) *.o
+dscr_default_test: LDLIBS += -lpthread
+
+$(TEST_GEN_PROGS): ../harness.c
index a505b66d408a67d4392a7efda885b436d0456587..814c38591b13a922bf6452092e4575e9b0505cde 100644 (file)
@@ -1,9 +1,9 @@
-TEST_PROGS := fpu_syscall fpu_preempt fpu_signal vmx_syscall vmx_preempt vmx_signal vsx_preempt
+TEST_GEN_PROGS := fpu_syscall fpu_preempt fpu_signal vmx_syscall vmx_preempt vmx_signal vsx_preempt
 
-all: $(TEST_PROGS)
+include ../../lib.mk
 
-$(TEST_PROGS): ../harness.c
-$(TEST_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
+$(TEST_GEN_PROGS): ../harness.c
+$(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
 
 fpu_syscall: fpu_asm.S
 fpu_preempt: fpu_asm.S
@@ -15,8 +15,3 @@ vmx_signal: vmx_asm.S
 
 vsx_preempt: CFLAGS += -mvsx
 vsx_preempt: vsx_asm.S
-
-include ../../lib.mk
-
-clean:
-       rm -f $(TEST_PROGS) *.o
index 3bdb96eae55869e04a988f0d6cc30ef9d01fc6ce..d5633783c82e03c784d8cebbbc8ecdfb5f36b33b 100644 (file)
@@ -1,19 +1,15 @@
 noarg:
        $(MAKE) -C ../
 
-TEST_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
-TEST_FILES := tempfile
+TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
+TEST_GEN_FILES := tempfile
 
-all: $(TEST_PROGS) $(TEST_FILES)
+include ../../lib.mk
 
-$(TEST_PROGS): ../harness.c
+$(TEST_GEN_PROGS): ../harness.c
 
 prot_sao: ../utils.c
 
-include ../../lib.mk
-
 tempfile:
        dd if=/dev/zero of=tempfile bs=64k count=1
 
-clean:
-       rm -f $(TEST_PROGS) tempfile
index ac41a7177f2e2cd659ca89c9a56c8473a502dde3..ab0f9026c21c7c1802ee9f928fab031af1b7d542 100644 (file)
@@ -1,12 +1,14 @@
 noarg:
        $(MAKE) -C ../
 
-TEST_PROGS := count_instructions l3_bank_test per_event_excludes
+TEST_GEN_PROGS := count_instructions l3_bank_test per_event_excludes
 EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
 
-all: $(TEST_PROGS) ebb
+include ../../lib.mk
+
+all: $(TEST_GEN_PROGS) ebb
 
-$(TEST_PROGS): $(EXTRA_SOURCES)
+$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
 
 # loop.S can only be built 64-bit
 count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
@@ -14,8 +16,6 @@ count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
 
 per_event_excludes: ../utils.c
 
-include ../../lib.mk
-
 DEFAULT_RUN_TESTS := $(RUN_TESTS)
 override define RUN_TESTS
        $(DEFAULT_RUN_TESTS)
@@ -35,7 +35,7 @@ override define INSTALL_RULE
 endef
 
 clean:
-       rm -f $(TEST_PROGS) loop.o
+       $(RM) $(TEST_PROGS) loop.o
        $(MAKE) -C ebb clean
 
 ebb:
index 8d2279c4bb4b6a81cb5713f6ba3bf92b72f2e3e7..0bc2bd6db51181f1ab09d150bc0464d841d791e1 100644 (file)
@@ -4,7 +4,7 @@ noarg:
 # The EBB handler is 64-bit code and everything links against it
 CFLAGS += -m64
 
-TEST_PROGS := reg_access_test event_attributes_test cycles_test        \
+TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test    \
         cycles_with_freeze_test pmc56_overflow_test            \
         ebb_vs_cpu_event_test cpu_event_vs_ebb_test            \
         cpu_event_pinned_vs_ebb_test task_event_vs_ebb_test    \
@@ -16,16 +16,11 @@ TEST_PROGS := reg_access_test event_attributes_test cycles_test     \
         lost_exception_test no_handler_test                    \
         cycles_with_mmcr2_test
 
-all: $(TEST_PROGS)
+include ../../../lib.mk
 
-$(TEST_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
+$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
               ebb.c ebb_handler.S trace.c busy_loop.S
 
 instruction_count_test: ../loop.S
 
 lost_exception_test: ../lib.c
-
-include ../../../lib.mk
-
-clean:
-       rm -f $(TEST_PROGS)
index b68c6221d3d1bdad82a50356fa5c73083611d948..175366db7be8bc1261194ac80d009cd33e0c9c59 100644 (file)
@@ -1,12 +1,7 @@
 CFLAGS += -I$(CURDIR)
 
-TEST_PROGS := load_unaligned_zeropad
-
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c
+TEST_GEN_PROGS := load_unaligned_zeropad
 
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS) *.o
+$(TEST_GEN_PROGS): ../harness.c
index 2a728f4d2873de636379c277feae38f004c60934..557b9379f3bb9c83ebc1326c27a77e21f855119e 100644 (file)
@@ -2,14 +2,9 @@
 CFLAGS += -m64
 CFLAGS += -I$(CURDIR)
 
-TEST_PROGS := memcmp
+TEST_GEN_PROGS := memcmp
 EXTRA_SOURCES := memcmp_64.S ../harness.c
 
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): $(EXTRA_SOURCES)
-
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS) *.o
+$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
index e21d10674e54135637b540ae8b0457e0ea3075cd..bd0122306da669427c670f5c89390552ceb83225 100644 (file)
@@ -1,8 +1,8 @@
-TEST_PROGS := switch_endian_test
+TEST_GEN_PROGS := switch_endian_test
 
 ASFLAGS += -O2 -Wall -g -nostdlib -m64
 
-all: $(TEST_PROGS)
+include ../../lib.mk
 
 switch_endian_test: check-reversed.S
 
@@ -12,7 +12,5 @@ check-reversed.o: check.o
 check-reversed.S: check-reversed.o
        hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
 
-include ../../lib.mk
-
 clean:
-       rm -f $(TEST_PROGS) *.o check-reversed.S
+       $(RM) $(TEST_GEN_PROGS) *.o check-reversed.S
index b35c7945bec550210c36269308352e7f25d0c2e4..da22ca7c38c185a5bb4df90a81fa71a9fbccc6c1 100644 (file)
@@ -1,12 +1,7 @@
-TEST_PROGS := ipc_unmuxed
+TEST_GEN_PROGS := ipc_unmuxed
 
 CFLAGS += -I../../../../../usr/include
 
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c
-
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS) *.o
+$(TEST_GEN_PROGS): ../harness.c
index c6c53c82fdd64fddb16aef156870e0f1656a4f81..117c6247928a845c04b03913905c7e311baac1ef 100644 (file)
@@ -1,12 +1,12 @@
 SIGNAL_CONTEXT_CHK_TESTS := tm-signal-context-chk-gpr tm-signal-context-chk-fpu \
        tm-signal-context-chk-vmx tm-signal-context-chk-vsx
 
-TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
+TEST_GEN_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
        tm-vmxcopy tm-fork tm-tar tm-tmspr $(SIGNAL_CONTEXT_CHK_TESTS)
 
-all: $(TEST_PROGS)
+include ../../lib.mk
 
-$(TEST_PROGS): ../harness.c ../utils.c
+$(TEST_GEN_PROGS): ../harness.c ../utils.c
 
 CFLAGS += -mhtm
 
@@ -16,8 +16,3 @@ tm-tmspr: CFLAGS += -pthread
 
 $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
 $(SIGNAL_CONTEXT_CHK_TESTS): CFLAGS += -mhtm -m64 -mvsx
-
-include ../../lib.mk
-
-clean:
-       rm -f $(TEST_PROGS) *.o
index a485f2e286ae22cae0706c7cd0fc735d4c7206e3..f8ced26748f84408d902cc4ce58012874c545a58 100644 (file)
@@ -1,12 +1,8 @@
-TEST_PROGS := test-vphn
+TEST_GEN_PROGS := test-vphn
 
 CFLAGS += -m64
 
-all: $(TEST_PROGS)
-
-$(TEST_PROGS): ../harness.c
-
 include ../../lib.mk
 
-clean:
-       rm -f $(TEST_PROGS)
+$(TEST_GEN_PROGS): ../harness.c
+
index 453927fea90cae7b65005fb661bf7b8254686d32..8a2bc5562179b4c2c489976b1861aac6968c0fee 100644 (file)
@@ -1,11 +1,5 @@
 CFLAGS += -iquote../../../../include/uapi -Wall
-peeksiginfo: peeksiginfo.c
 
-all: peeksiginfo
-
-clean:
-       rm -f peeksiginfo
-
-TEST_PROGS := peeksiginfo
+TEST_GEN_PROGS := peeksiginfo
 
 include ../lib.mk
index 8401e87e34e17e8103a6d02925c57e486f017f38..5fa6fd2246b18a45290efef20789a4948d9425d9 100644 (file)
@@ -1,10 +1,6 @@
-TEST_PROGS := seccomp_bpf
+TEST_GEN_PROGS := seccomp_bpf
 CFLAGS += -Wl,-no-as-needed -Wall
 LDFLAGS += -lpthread
 
-all: $(TEST_PROGS)
-
 include ../lib.mk
 
-clean:
-       $(RM) $(TEST_PROGS)
index 56af56eda6fa50fc259716dd397de5cb15cfc07c..f68fbf80d8bea52a94ac38b3c80b185ad138dc1c 100644 (file)
@@ -1,8 +1,5 @@
 CFLAGS = -Wall
-BINARIES = sas
-all: $(BINARIES)
+TEST_GEN_PROGS = sas
 
 include ../lib.mk
 
-clean:
-       rm -rf $(BINARIES)
index bbd0b5398b613c08ee77eb4fbf9740383d874c0d..c67f3577e888d5c91486471fa60f4b9253ec4cfb 100644 (file)
@@ -1,11 +1,7 @@
-all: get_size
 
 get_size: get_size.c
        $(CC) -static -ffreestanding -nostartfiles -s $< -o $@
 
-TEST_PROGS := get_size
+TEST_GEN_PROGS := get_size
 
 include ../lib.mk
-
-clean:
-       $(RM) get_size
index 1d5556869137929564c490473c35386ca3be3692..4a3bffed990198b844a6e741e47432f03d25f20e 100644 (file)
@@ -5,16 +5,13 @@ LDFLAGS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privledges
-TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
+TEST_GEN_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
             inconsistency-check raw_skew threadtest rtctest
 
-TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
+TEST_GEN_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
                      skew_consistency clocksource-switch leap-a-day \
                      leapcrash set-tai set-2038 set-tz
 
-bins = $(TEST_PROGS) $(TEST_PROGS_EXTENDED)
-
-all: ${bins}
 
 include ../lib.mk
 
@@ -34,5 +31,3 @@ run_destructive_tests: run_tests
        ./set-tai
        ./set-2038
 
-clean:
-       rm -f ${bins}
index bbab7f4664acdc6a0d535b2787c59f00253e127b..323383ab45810744874aae098e3d64de0bc51f00 100644 (file)
@@ -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)