diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2018-09-04 06:47:21 -0400 |
---|---|---|
committer | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-09-05 10:12:09 -0400 |
commit | b2d35fa5fc80c27e868e393dcab4c94a0d71737f (patch) | |
tree | 1ff2d280109a4b5b43cc5ec6a4e70ff23131ca78 /tools | |
parent | c31d02d1290e1e82a08015199e408228e152991f (diff) |
selftests: add headers_install to lib.mk
If the kernel headers aren't installed we can't build all the tests.
Add a new make target rule 'khdr' in the file lib.mk to generate the
kernel headers and that gets include for every test-dir Makefile that
includes lib.mk If the testdir in turn have its own sub-dirs the
top_srcdir needs to be set to the linux-rootdir to be able to generate
the kernel headers.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Fathi Boudra <fathi.boudra@linaro.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/android/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/android/ion/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/futex/functional/Makefile | 1 | ||||
-rw-r--r-- | tools/testing/selftests/gpio/Makefile | 7 | ||||
-rw-r--r-- | tools/testing/selftests/kvm/Makefile | 7 | ||||
-rw-r--r-- | tools/testing/selftests/lib.mk | 12 | ||||
-rw-r--r-- | tools/testing/selftests/net/Makefile | 1 | ||||
-rw-r--r-- | tools/testing/selftests/networking/timestamping/Makefile | 1 | ||||
-rw-r--r-- | tools/testing/selftests/vm/Makefile | 4 |
9 files changed, 22 insertions, 15 deletions
diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile index 72c25a3cb658..d9a725478375 100644 --- a/tools/testing/selftests/android/Makefile +++ b/tools/testing/selftests/android/Makefile | |||
@@ -6,7 +6,7 @@ TEST_PROGS := run.sh | |||
6 | 6 | ||
7 | include ../lib.mk | 7 | include ../lib.mk |
8 | 8 | ||
9 | all: | 9 | all: khdr |
10 | @for DIR in $(SUBDIRS); do \ | 10 | @for DIR in $(SUBDIRS); do \ |
11 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ | 11 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
12 | mkdir $$BUILD_TARGET -p; \ | 12 | mkdir $$BUILD_TARGET -p; \ |
diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile index e03695287f76..88cfe88e466f 100644 --- a/tools/testing/selftests/android/ion/Makefile +++ b/tools/testing/selftests/android/ion/Makefile | |||
@@ -10,6 +10,8 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c | |||
10 | 10 | ||
11 | TEST_PROGS := ion_test.sh | 11 | TEST_PROGS := ion_test.sh |
12 | 12 | ||
13 | KSFT_KHDR_INSTALL := 1 | ||
14 | top_srcdir = ../../../../.. | ||
13 | include ../../lib.mk | 15 | include ../../lib.mk |
14 | 16 | ||
15 | $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c | 17 | $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c |
diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile index ff8feca49746..ad1eeb14fda7 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile | |||
@@ -18,6 +18,7 @@ TEST_GEN_FILES := \ | |||
18 | 18 | ||
19 | TEST_PROGS := run.sh | 19 | TEST_PROGS := run.sh |
20 | 20 | ||
21 | top_srcdir = ../../../../.. | ||
21 | include ../../lib.mk | 22 | include ../../lib.mk |
22 | 23 | ||
23 | $(TEST_GEN_FILES): $(HEADERS) | 24 | $(TEST_GEN_FILES): $(HEADERS) |
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 1bbb47565c55..4665cdbf1a8d 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile | |||
@@ -21,11 +21,8 @@ endef | |||
21 | CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ | 21 | CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ |
22 | LDLIBS += -lmount -I/usr/include/libmount | 22 | LDLIBS += -lmount -I/usr/include/libmount |
23 | 23 | ||
24 | $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h | 24 | $(BINARIES):| khdr |
25 | $(BINARIES): ../../../gpio/gpio-utils.o | ||
25 | 26 | ||
26 | ../../../gpio/gpio-utils.o: | 27 | ../../../gpio/gpio-utils.o: |
27 | make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio | 28 | make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio |
28 | |||
29 | ../../../../usr/include/linux/gpio.h: | ||
30 | make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/ | ||
31 | |||
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 03b0f551bedf..87d1a8488af8 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile | |||
@@ -37,9 +37,6 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c | |||
37 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) | 37 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) |
38 | $(AR) crs $@ $^ | 38 | $(AR) crs $@ $^ |
39 | 39 | ||
40 | $(LINUX_HDR_PATH): | 40 | all: $(STATIC_LIBS) |
41 | make -C $(top_srcdir) headers_install | ||
42 | |||
43 | all: $(STATIC_LIBS) $(LINUX_HDR_PATH) | ||
44 | $(TEST_GEN_PROGS): $(STATIC_LIBS) | 41 | $(TEST_GEN_PROGS): $(STATIC_LIBS) |
45 | $(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) | 42 | $(STATIC_LIBS):| khdr |
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 17ab36605a8e..0a8e75886224 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk | |||
@@ -16,8 +16,20 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) | |||
16 | TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) | 16 | TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) |
17 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) | 17 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) |
18 | 18 | ||
19 | top_srcdir ?= ../../../.. | ||
20 | include $(top_srcdir)/scripts/subarch.include | ||
21 | ARCH ?= $(SUBARCH) | ||
22 | |||
19 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) | 23 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) |
20 | 24 | ||
25 | .PHONY: khdr | ||
26 | khdr: | ||
27 | make ARCH=$(ARCH) -C $(top_srcdir) headers_install | ||
28 | |||
29 | ifdef KSFT_KHDR_INSTALL | ||
30 | $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr | ||
31 | endif | ||
32 | |||
21 | .ONESHELL: | 33 | .ONESHELL: |
22 | define RUN_TEST_PRINT_RESULT | 34 | define RUN_TEST_PRINT_RESULT |
23 | TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ | 35 | TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ |
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 9cca68e440a0..919aa2ac00af 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile | |||
@@ -15,6 +15,7 @@ TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx | |||
15 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa | 15 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa |
16 | TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls | 16 | TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls |
17 | 17 | ||
18 | KSFT_KHDR_INSTALL := 1 | ||
18 | include ../lib.mk | 19 | include ../lib.mk |
19 | 20 | ||
20 | $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma | 21 | $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma |
diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile index a728040edbe1..14cfcf006936 100644 --- a/tools/testing/selftests/networking/timestamping/Makefile +++ b/tools/testing/selftests/networking/timestamping/Makefile | |||
@@ -5,6 +5,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp | |||
5 | 5 | ||
6 | all: $(TEST_PROGS) | 6 | all: $(TEST_PROGS) |
7 | 7 | ||
8 | top_srcdir = ../../../../.. | ||
8 | include ../../lib.mk | 9 | include ../../lib.mk |
9 | 10 | ||
10 | clean: | 11 | clean: |
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 9881876d2aa0..e94b7b14bcb2 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile | |||
@@ -26,10 +26,6 @@ TEST_PROGS := run_vmtests | |||
26 | 26 | ||
27 | include ../lib.mk | 27 | include ../lib.mk |
28 | 28 | ||
29 | $(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h | ||
30 | $(OUTPUT)/userfaultfd: LDLIBS += -lpthread | 29 | $(OUTPUT)/userfaultfd: LDLIBS += -lpthread |
31 | 30 | ||
32 | $(OUTPUT)/mlock-random-test: LDLIBS += -lcap | 31 | $(OUTPUT)/mlock-random-test: LDLIBS += -lcap |
33 | |||
34 | ../../../../usr/include/linux/kernel.h: | ||
35 | make -C ../../../.. headers_install | ||