diff options
author | bamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com> | 2016-11-29 06:55:49 -0500 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-01-05 15:42:01 -0500 |
commit | 7d758af257bc40a8a599a0aaa4768b30fb463e9c (patch) | |
tree | 00c4ae2a68d491c2d8849564211b1121cdd9cc2d | |
parent | 5fe59799352b2e2e2dfcf84585c6d780d6effb0e (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/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/lib.mk | 3 | ||||
-rw-r--r-- | tools/testing/selftests/mount/Makefile | 3 | ||||
-rw-r--r-- | tools/testing/selftests/net/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/size/Makefile | 4 | ||||
-rw-r--r-- | tools/testing/selftests/vm/Makefile | 17 |
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 | |||
11 | execveat.denatured: execveat | 11 | execveat.denatured: execveat |
12 | cp $< $@ | 12 | cp $< $@ |
13 | chmod -x $@ | 13 | chmod -x $@ |
14 | %: %.c | ||
15 | $(CC) $(CFLAGS) -o $@ $^ | ||
16 | 14 | ||
17 | TEST_GEN_PROGS := execveat | 15 | TEST_GEN_PROGS := execveat |
18 | TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir | 16 | TEST_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) | |||
45 | clean: | 45 | clean: |
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 @@ | |||
2 | CFLAGS = -Wall \ | 2 | CFLAGS = -Wall \ |
3 | -O2 | 3 | -O2 |
4 | 4 | ||
5 | unprivileged-remount-test: unprivileged-remount-test.c | ||
6 | $(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test | ||
7 | |||
8 | TEST_GEN_PROGS := unprivileged-remount-test | 5 | TEST_GEN_PROGS := unprivileged-remount-test |
9 | 6 | ||
10 | include ../lib.mk | 7 | include ../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 | |||
4 | CFLAGS += -I../../../../usr/include/ | 4 | CFLAGS += -I../../../../usr/include/ |
5 | 5 | ||
6 | reuseport_bpf_numa: LDFLAGS += -lnuma | 6 | reuseport_bpf_numa: LDFLAGS += -lnuma |
7 | %: %.c | ||
8 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ | ||
9 | 7 | ||
10 | TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh | 8 | TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh |
11 | TEST_GEN_FILES = socket | 9 | TEST_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 | 1 | CFLAGS := -static -ffreestanding -nostartfiles -s | |
2 | get_size: get_size.c | ||
3 | $(CC) -static -ffreestanding -nostartfiles -s $< -o $@ | ||
4 | 2 | ||
5 | TEST_GEN_PROGS := get_size | 3 | TEST_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 | ||
3 | CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) | 3 | CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) |
4 | LDLIBS = -lrt | ||
4 | TEST_GEN_FILES = compaction_test | 5 | TEST_GEN_FILES = compaction_test |
5 | TEST_GEN_FILES += hugepage-mmap | 6 | TEST_GEN_FILES += hugepage-mmap |
6 | TEST_GEN_FILES += hugepage-shm | 7 | TEST_GEN_FILES += hugepage-shm |
@@ -12,18 +13,12 @@ TEST_GEN_FILES += transhuge-stress | |||
12 | TEST_GEN_FILES += userfaultfd | 13 | TEST_GEN_FILES += userfaultfd |
13 | TEST_GEN_FILES += mlock-random-test | 14 | TEST_GEN_FILES += mlock-random-test |
14 | 15 | ||
15 | %: %.c | ||
16 | $(CC) $(CFLAGS) -o $@ $^ -lrt | ||
17 | userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h | ||
18 | $(CC) $(CFLAGS) -O2 -o $@ $< -lpthread | ||
19 | |||
20 | mlock-random-test: mlock-random-test.c | ||
21 | $(CC) $(CFLAGS) -o $@ $< -lcap | ||
22 | |||
23 | ../../../../usr/include/linux/kernel.h: | ||
24 | make -C ../../../.. headers_install | ||
25 | |||
26 | TEST_PROGS := run_vmtests | 16 | TEST_PROGS := run_vmtests |
27 | 17 | ||
28 | include ../lib.mk | 18 | include ../lib.mk |
29 | 19 | ||
20 | userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h | ||
21 | mlock-random-test: LDLIBS += -lcap | ||
22 | |||
23 | ../../../../usr/include/linux/kernel.h: | ||
24 | make -C ../../../.. headers_install | ||