aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com>2016-11-29 06:55:49 -0500
committerShuah Khan <shuahkh@osg.samsung.com>2017-01-05 15:42:01 -0500
commit7d758af257bc40a8a599a0aaa4768b30fb463e9c (patch)
tree00c4ae2a68d491c2d8849564211b1121cdd9cc2d
parent5fe59799352b2e2e2dfcf84585c6d780d6effb0e (diff)
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 <mpe@ellerman.id.au> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r--tools/testing/selftests/exec/Makefile2
-rw-r--r--tools/testing/selftests/lib.mk3
-rw-r--r--tools/testing/selftests/mount/Makefile3
-rw-r--r--tools/testing/selftests/net/Makefile2
-rw-r--r--tools/testing/selftests/size/Makefile4
-rw-r--r--tools/testing/selftests/vm/Makefile17
6 files changed, 10 insertions, 21 deletions
diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index b3bf091368ca..9eb1c3e4d339 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -11,8 +11,6 @@ execveat.symlink: execveat
11execveat.denatured: execveat 11execveat.denatured: execveat
12 cp $< $@ 12 cp $< $@
13 chmod -x $@ 13 chmod -x $@
14%: %.c
15 $(CC) $(CFLAGS) -o $@ $^
16 14
17TEST_GEN_PROGS := execveat 15TEST_GEN_PROGS := execveat
18TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir 16TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 5b8634cad092..68d7c01b9f06 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -45,4 +45,7 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
45clean: 45clean:
46 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) 46 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
47 47
48%: %.c
49 $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^
50
48.PHONY: run_tests all clean install emit_tests 51.PHONY: run_tests all clean install emit_tests
diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
index e8fb15e80172..9093d7ffe87f 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -2,9 +2,6 @@
2CFLAGS = -Wall \ 2CFLAGS = -Wall \
3 -O2 3 -O2
4 4
5unprivileged-remount-test: unprivileged-remount-test.c
6 $(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test
7
8TEST_GEN_PROGS := unprivileged-remount-test 5TEST_GEN_PROGS := unprivileged-remount-test
9 6
10include ../lib.mk 7include ../lib.mk
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index fe5b36dd7140..fbfe5d0d5c2e 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -4,8 +4,6 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
4CFLAGS += -I../../../../usr/include/ 4CFLAGS += -I../../../../usr/include/
5 5
6reuseport_bpf_numa: LDFLAGS += -lnuma 6reuseport_bpf_numa: LDFLAGS += -lnuma
7%: %.c
8 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
9 7
10TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh 8TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh
11TEST_GEN_FILES = socket 9TEST_GEN_FILES = socket
diff --git a/tools/testing/selftests/size/Makefile b/tools/testing/selftests/size/Makefile
index c67f3577e888..4685b3e421fc 100644
--- a/tools/testing/selftests/size/Makefile
+++ b/tools/testing/selftests/size/Makefile
@@ -1,6 +1,4 @@
1 1CFLAGS := -static -ffreestanding -nostartfiles -s
2get_size: get_size.c
3 $(CC) -static -ffreestanding -nostartfiles -s $< -o $@
4 2
5TEST_GEN_PROGS := get_size 3TEST_GEN_PROGS := get_size
6 4
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 @@
1# Makefile for vm selftests 1# Makefile for vm selftests
2 2
3CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) 3CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
4LDLIBS = -lrt
4TEST_GEN_FILES = compaction_test 5TEST_GEN_FILES = compaction_test
5TEST_GEN_FILES += hugepage-mmap 6TEST_GEN_FILES += hugepage-mmap
6TEST_GEN_FILES += hugepage-shm 7TEST_GEN_FILES += hugepage-shm
@@ -12,18 +13,12 @@ TEST_GEN_FILES += transhuge-stress
12TEST_GEN_FILES += userfaultfd 13TEST_GEN_FILES += userfaultfd
13TEST_GEN_FILES += mlock-random-test 14TEST_GEN_FILES += mlock-random-test
14 15
15%: %.c
16 $(CC) $(CFLAGS) -o $@ $^ -lrt
17userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h
18 $(CC) $(CFLAGS) -O2 -o $@ $< -lpthread
19
20mlock-random-test: mlock-random-test.c
21 $(CC) $(CFLAGS) -o $@ $< -lcap
22
23../../../../usr/include/linux/kernel.h:
24 make -C ../../../.. headers_install
25
26TEST_PROGS := run_vmtests 16TEST_PROGS := run_vmtests
27 17
28include ../lib.mk 18include ../lib.mk
29 19
20userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h
21mlock-random-test: LDLIBS += -lcap
22
23../../../../usr/include/linux/kernel.h:
24 make -C ../../../.. headers_install