aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2018-09-04 06:47:21 -0400
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-09-05 10:12:09 -0400
commitb2d35fa5fc80c27e868e393dcab4c94a0d71737f (patch)
tree1ff2d280109a4b5b43cc5ec6a4e70ff23131ca78 /tools
parentc31d02d1290e1e82a08015199e408228e152991f (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/Makefile2
-rw-r--r--tools/testing/selftests/android/ion/Makefile2
-rw-r--r--tools/testing/selftests/futex/functional/Makefile1
-rw-r--r--tools/testing/selftests/gpio/Makefile7
-rw-r--r--tools/testing/selftests/kvm/Makefile7
-rw-r--r--tools/testing/selftests/lib.mk12
-rw-r--r--tools/testing/selftests/net/Makefile1
-rw-r--r--tools/testing/selftests/networking/timestamping/Makefile1
-rw-r--r--tools/testing/selftests/vm/Makefile4
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
7include ../lib.mk 7include ../lib.mk
8 8
9all: 9all: 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
11TEST_PROGS := ion_test.sh 11TEST_PROGS := ion_test.sh
12 12
13KSFT_KHDR_INSTALL := 1
14top_srcdir = ../../../../..
13include ../../lib.mk 15include ../../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
19TEST_PROGS := run.sh 19TEST_PROGS := run.sh
20 20
21top_srcdir = ../../../../..
21include ../../lib.mk 22include ../../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
21CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ 21CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
22LDLIBS += -lmount -I/usr/include/libmount 22LDLIBS += -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): 40all: $(STATIC_LIBS)
41 make -C $(top_srcdir) headers_install
42
43all: $(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))
16TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) 16TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
17TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) 17TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
18 18
19top_srcdir ?= ../../../..
20include $(top_srcdir)/scripts/subarch.include
21ARCH ?= $(SUBARCH)
22
19all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) 23all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
20 24
25.PHONY: khdr
26khdr:
27 make ARCH=$(ARCH) -C $(top_srcdir) headers_install
28
29ifdef KSFT_KHDR_INSTALL
30$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr
31endif
32
21.ONESHELL: 33.ONESHELL:
22define RUN_TEST_PRINT_RESULT 34define 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
15TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa 15TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
16TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls 16TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
17 17
18KSFT_KHDR_INSTALL := 1
18include ../lib.mk 19include ../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
6all: $(TEST_PROGS) 6all: $(TEST_PROGS)
7 7
8top_srcdir = ../../../../..
8include ../../lib.mk 9include ../../lib.mk
9 10
10clean: 11clean:
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
27include ../lib.mk 27include ../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