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 <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This commit is contained in:
bamvor.zhangjian@huawei.com
2016-11-29 19:55:47 +08:00
committed by Shuah Khan
parent 7ce7d89f48
commit 88baa78d1f
37 changed files with 120 additions and 257 deletions

View 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

View 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

View 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

View 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)

View 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

View 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

View File

@@ -1,19 +1,15 @@
noarg:
$(MAKE) -C ../
TEST_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
TEST_FILES := tempfile
all: $(TEST_PROGS) $(TEST_FILES)
$(TEST_PROGS): ../harness.c
prot_sao: ../utils.c
TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
TEST_GEN_FILES := tempfile
include ../../lib.mk
$(TEST_GEN_PROGS): ../harness.c
prot_sao: ../utils.c
tempfile:
dd if=/dev/zero of=tempfile bs=64k count=1
clean:
rm -f $(TEST_PROGS) tempfile

View 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
$(TEST_PROGS): $(EXTRA_SOURCES)
all: $(TEST_GEN_PROGS) ebb
$(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:

View 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)

View 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

View 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)

View 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

View 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

View 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

View 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