* [PATCH bpf-next 1/5] selftests/bpf: Enable cross-building
2021-01-12 13:59 [PATCH bpf-next 0/5] selftests/bpf: Some build fixes Jean-Philippe Brucker
@ 2021-01-12 13:59 ` Jean-Philippe Brucker
2021-01-12 20:57 ` Andrii Nakryiko
2021-01-12 13:59 ` [PATCH bpf-next 2/5] selftests/bpf: Fix out-of-tree build Jean-Philippe Brucker
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-12 13:59 UTC (permalink / raw)
To: bpf
Cc: shuah, ast, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, linux-kselftest, Jean-Philippe Brucker
Build bpftool and resolve_btfids using the host toolchain when
cross-compiling, since they are executed during build to generate the
selftests. Add a host build directory in order to build both host and
target version of libbpf. Build host tools using $(HOSTCC) defined in
Makefile.include.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
tools/testing/selftests/bpf/Makefile | 43 ++++++++++++++++++++++------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c51df6b91bef..1d85565883ea 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
include ../../../../scripts/Kbuild.include
include ../../../scripts/Makefile.arch
+include ../../../scripts/Makefile.include
CXX ?= $(CROSS_COMPILE)g++
@@ -113,7 +114,20 @@ SCRATCH_DIR := $(OUTPUT)/tools
BUILD_DIR := $(SCRATCH_DIR)/build
INCLUDE_DIR := $(SCRATCH_DIR)/include
BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
-RESOLVE_BTFIDS := $(BUILD_DIR)/resolve_btfids/resolve_btfids
+ifneq ($(CROSS_COMPILE),)
+HOST_BUILD_DIR := $(BUILD_DIR)/host
+HOST_SCRATCH_DIR := $(OUTPUT)/host-tools
+else
+HOST_BUILD_DIR := $(BUILD_DIR)
+HOST_SCRATCH_DIR := $(SCRATCH_DIR)
+endif
+HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf.a
+RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_btfids/resolve_btfids
+
+# sort removes libbpf duplicates when not cross-building
+MAKE_DIRS := $(sort $(BUILD_DIR)/libbpf $(HOST_BUILD_DIR)/libbpf \
+ $(HOST_BUILD_DIR)/bpftool $(HOST_BUILD_DIR)/resolve_btfids \
+ $(INCLUDE_DIR))
VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
@@ -157,7 +171,7 @@ $(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
$(call msg,CC,,$@)
$(Q)$(CC) -c $(CFLAGS) -o $@ $<
-DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
+DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
$(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL)
$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
@@ -182,10 +196,11 @@ $(OUTPUT)/test_sysctl: cgroup_helpers.c
BPFTOOL ?= $(DEFAULT_BPFTOOL)
$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
- $(BPFOBJ) | $(BUILD_DIR)/bpftool
+ $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
$(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) \
- OUTPUT=$(BUILD_DIR)/bpftool/ \
- prefix= DESTDIR=$(SCRATCH_DIR)/ install
+ CC=$(HOSTCC) LD=$(HOSTLD) \
+ OUTPUT=$(HOST_BUILD_DIR)/bpftool/ \
+ prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
$(Q)mkdir -p $(BUILD_DIR)/bpftool/Documentation
$(Q)RST2MAN_OPTS="--exit-status=1" $(MAKE) $(submake_extras) \
-C $(BPFTOOLDIR)/Documentation \
@@ -198,7 +213,16 @@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
$(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
-$(BUILD_DIR)/libbpf $(BUILD_DIR)/bpftool $(BUILD_DIR)/resolve_btfids $(INCLUDE_DIR):
+ifneq ($(BPFOBJ),$(HOST_BPFOBJ))
+$(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
+ ../../../include/uapi/linux/bpf.h \
+ | $(INCLUDE_DIR) $(HOST_BUILD_DIR)/libbpf
+ $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) \
+ OUTPUT=$(HOST_BUILD_DIR)/libbpf/ CC=$(HOSTCC) LD=$(HOSTLD) \
+ DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
+endif
+
+$(MAKE_DIRS):
$(call msg,MKDIR,,$@)
$(Q)mkdir -p $@
@@ -211,7 +235,7 @@ else
$(Q)cp "$(VMLINUX_H)" $@
endif
-$(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \
+$(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
$(TOOLSDIR)/bpf/resolve_btfids/main.c \
$(TOOLSDIR)/lib/rbtree.c \
$(TOOLSDIR)/lib/zalloc.c \
@@ -219,7 +243,8 @@ $(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \
$(TOOLSDIR)/lib/ctype.c \
$(TOOLSDIR)/lib/str_error_r.c
$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/resolve_btfids \
- OUTPUT=$(BUILD_DIR)/resolve_btfids/ BPFOBJ=$(BPFOBJ)
+ CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) \
+ OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)
# Get Clang's default includes on this system, as opposed to those seen by
# '-target bpf'. This fixes "missing" files on some architectures/distros,
@@ -450,7 +475,7 @@ $(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \
$(call msg,BINARY,,$@)
$(Q)$(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS)
-EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) \
+EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \
prog_tests/tests.h map_tests/tests.h verifier/tests.h \
feature \
$(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc bpf_testmod.ko)
--
2.30.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH bpf-next 1/5] selftests/bpf: Enable cross-building
2021-01-12 13:59 ` [PATCH bpf-next 1/5] selftests/bpf: Enable cross-building Jean-Philippe Brucker
@ 2021-01-12 20:57 ` Andrii Nakryiko
0 siblings, 0 replies; 11+ messages in thread
From: Andrii Nakryiko @ 2021-01-12 20:57 UTC (permalink / raw)
To: Jean-Philippe Brucker
Cc: bpf, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
john fastabend, KP Singh, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Jan 12, 2021 at 6:01 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> Build bpftool and resolve_btfids using the host toolchain when
> cross-compiling, since they are executed during build to generate the
> selftests. Add a host build directory in order to build both host and
> target version of libbpf. Build host tools using $(HOSTCC) defined in
> Makefile.include.
>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
Makes sense.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
> tools/testing/selftests/bpf/Makefile | 43 ++++++++++++++++++++++------
> 1 file changed, 34 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index c51df6b91bef..1d85565883ea 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0
> include ../../../../scripts/Kbuild.include
> include ../../../scripts/Makefile.arch
> +include ../../../scripts/Makefile.include
>
> CXX ?= $(CROSS_COMPILE)g++
>
> @@ -113,7 +114,20 @@ SCRATCH_DIR := $(OUTPUT)/tools
> BUILD_DIR := $(SCRATCH_DIR)/build
> INCLUDE_DIR := $(SCRATCH_DIR)/include
> BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
> -RESOLVE_BTFIDS := $(BUILD_DIR)/resolve_btfids/resolve_btfids
> +ifneq ($(CROSS_COMPILE),)
> +HOST_BUILD_DIR := $(BUILD_DIR)/host
> +HOST_SCRATCH_DIR := $(OUTPUT)/host-tools
> +else
> +HOST_BUILD_DIR := $(BUILD_DIR)
> +HOST_SCRATCH_DIR := $(SCRATCH_DIR)
> +endif
> +HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf.a
> +RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_btfids/resolve_btfids
> +
> +# sort removes libbpf duplicates when not cross-building
> +MAKE_DIRS := $(sort $(BUILD_DIR)/libbpf $(HOST_BUILD_DIR)/libbpf \
> + $(HOST_BUILD_DIR)/bpftool $(HOST_BUILD_DIR)/resolve_btfids \
> + $(INCLUDE_DIR))
>
> VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
> $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
> @@ -157,7 +171,7 @@ $(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
> $(call msg,CC,,$@)
> $(Q)$(CC) -c $(CFLAGS) -o $@ $<
>
> -DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
> +DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
>
> $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL)
> $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
> @@ -182,10 +196,11 @@ $(OUTPUT)/test_sysctl: cgroup_helpers.c
>
> BPFTOOL ?= $(DEFAULT_BPFTOOL)
> $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
> - $(BPFOBJ) | $(BUILD_DIR)/bpftool
> + $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
> $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) \
> - OUTPUT=$(BUILD_DIR)/bpftool/ \
> - prefix= DESTDIR=$(SCRATCH_DIR)/ install
> + CC=$(HOSTCC) LD=$(HOSTLD) \
> + OUTPUT=$(HOST_BUILD_DIR)/bpftool/ \
> + prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
> $(Q)mkdir -p $(BUILD_DIR)/bpftool/Documentation
> $(Q)RST2MAN_OPTS="--exit-status=1" $(MAKE) $(submake_extras) \
> -C $(BPFTOOLDIR)/Documentation \
> @@ -198,7 +213,16 @@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
> $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
> DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
>
> -$(BUILD_DIR)/libbpf $(BUILD_DIR)/bpftool $(BUILD_DIR)/resolve_btfids $(INCLUDE_DIR):
> +ifneq ($(BPFOBJ),$(HOST_BPFOBJ))
> +$(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
> + ../../../include/uapi/linux/bpf.h \
> + | $(INCLUDE_DIR) $(HOST_BUILD_DIR)/libbpf
> + $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) \
> + OUTPUT=$(HOST_BUILD_DIR)/libbpf/ CC=$(HOSTCC) LD=$(HOSTLD) \
> + DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
> +endif
> +
> +$(MAKE_DIRS):
> $(call msg,MKDIR,,$@)
> $(Q)mkdir -p $@
>
nit: I'd just put this rule right next to MAKE_DIRS definition
> @@ -211,7 +235,7 @@ else
> $(Q)cp "$(VMLINUX_H)" $@
> endif
>
> -$(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \
> +$(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
> $(TOOLSDIR)/bpf/resolve_btfids/main.c \
> $(TOOLSDIR)/lib/rbtree.c \
> $(TOOLSDIR)/lib/zalloc.c \
> @@ -219,7 +243,8 @@ $(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \
> $(TOOLSDIR)/lib/ctype.c \
> $(TOOLSDIR)/lib/str_error_r.c
> $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/resolve_btfids \
> - OUTPUT=$(BUILD_DIR)/resolve_btfids/ BPFOBJ=$(BPFOBJ)
> + CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) \
> + OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)
>
> # Get Clang's default includes on this system, as opposed to those seen by
> # '-target bpf'. This fixes "missing" files on some architectures/distros,
> @@ -450,7 +475,7 @@ $(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \
> $(call msg,BINARY,,$@)
> $(Q)$(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS)
>
> -EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) \
> +EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \
> prog_tests/tests.h map_tests/tests.h verifier/tests.h \
> feature \
> $(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc bpf_testmod.ko)
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH bpf-next 2/5] selftests/bpf: Fix out-of-tree build
2021-01-12 13:59 [PATCH bpf-next 0/5] selftests/bpf: Some build fixes Jean-Philippe Brucker
2021-01-12 13:59 ` [PATCH bpf-next 1/5] selftests/bpf: Enable cross-building Jean-Philippe Brucker
@ 2021-01-12 13:59 ` Jean-Philippe Brucker
2021-01-12 20:57 ` Andrii Nakryiko
2021-01-12 13:59 ` [PATCH bpf-next 3/5] selftests/bpf: Move generated test files to $(TEST_GEN_FILES) Jean-Philippe Brucker
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-12 13:59 UTC (permalink / raw)
To: bpf
Cc: shuah, ast, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, linux-kselftest, Jean-Philippe Brucker
When building out-of-tree, the .skel.h files are generated into the
$(OUTPUT) directory, rather than $(CURDIR). Add $(OUTPUT) to the include
paths.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 1d85565883ea..3ff7e79cc497 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -25,7 +25,7 @@ BPF_GCC ?= $(shell command -v bpf-gcc;)
SAN_CFLAGS ?=
CFLAGS += -g -rdynamic -Wall -O2 $(GENFLAGS) $(SAN_CFLAGS) \
-I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
- -I$(TOOLSINCDIR) -I$(APIDIR) \
+ -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \
-Dbpf_prog_load=bpf_prog_test_load \
-Dbpf_load_program=bpf_test_load_program
LDLIBS += -lcap -lelf -lz -lrt -lpthread
--
2.30.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH bpf-next 2/5] selftests/bpf: Fix out-of-tree build
2021-01-12 13:59 ` [PATCH bpf-next 2/5] selftests/bpf: Fix out-of-tree build Jean-Philippe Brucker
@ 2021-01-12 20:57 ` Andrii Nakryiko
0 siblings, 0 replies; 11+ messages in thread
From: Andrii Nakryiko @ 2021-01-12 20:57 UTC (permalink / raw)
To: Jean-Philippe Brucker
Cc: bpf, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
john fastabend, KP Singh, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Jan 12, 2021 at 6:01 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> When building out-of-tree, the .skel.h files are generated into the
> $(OUTPUT) directory, rather than $(CURDIR). Add $(OUTPUT) to the include
> paths.
>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
Acked-by: Andrii Nakryiko <andrii@kernel.org>
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 1d85565883ea..3ff7e79cc497 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -25,7 +25,7 @@ BPF_GCC ?= $(shell command -v bpf-gcc;)
> SAN_CFLAGS ?=
> CFLAGS += -g -rdynamic -Wall -O2 $(GENFLAGS) $(SAN_CFLAGS) \
> -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
> - -I$(TOOLSINCDIR) -I$(APIDIR) \
> + -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \
> -Dbpf_prog_load=bpf_prog_test_load \
> -Dbpf_load_program=bpf_test_load_program
> LDLIBS += -lcap -lelf -lz -lrt -lpthread
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH bpf-next 3/5] selftests/bpf: Move generated test files to $(TEST_GEN_FILES)
2021-01-12 13:59 [PATCH bpf-next 0/5] selftests/bpf: Some build fixes Jean-Philippe Brucker
2021-01-12 13:59 ` [PATCH bpf-next 1/5] selftests/bpf: Enable cross-building Jean-Philippe Brucker
2021-01-12 13:59 ` [PATCH bpf-next 2/5] selftests/bpf: Fix out-of-tree build Jean-Philippe Brucker
@ 2021-01-12 13:59 ` Jean-Philippe Brucker
2021-01-12 13:59 ` [PATCH bpf-next 4/5] selftests/bpf: Fix installation of urandom_read Jean-Philippe Brucker
2021-01-12 14:00 ` [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases Jean-Philippe Brucker
4 siblings, 0 replies; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-12 13:59 UTC (permalink / raw)
To: bpf
Cc: shuah, ast, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, linux-kselftest, Jean-Philippe Brucker
During an out-of-tree build, attempting to install the $(TEST_FILES)
into the $(OUTPUT) directory fails, because the objects were already
generated into $(OUTPUT):
rsync: [sender] link_stat "tools/testing/selftests/bpf/test_lwt_ip_encap.o" failed: No such file or directory (2)
rsync: [sender] link_stat "tools/testing/selftests/bpf/test_tc_edt.o" failed: No such file or directory (2)
Use $(TEST_GEN_FILES) instead.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
tools/testing/selftests/bpf/Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 3ff7e79cc497..046848c508d1 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -44,10 +44,9 @@ ifneq ($(BPF_GCC),)
TEST_GEN_PROGS += test_progs-bpf_gcc
endif
-TEST_GEN_FILES =
-TEST_FILES = test_lwt_ip_encap.o \
- test_tc_edt.o \
- xsk_prereqs.sh
+TEST_GEN_FILES = test_lwt_ip_encap.o \
+ test_tc_edt.o
+TEST_FILES = xsk_prereqs.sh
# Order correspond to 'make run_tests' order
TEST_PROGS := test_kmod.sh \
--
2.30.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH bpf-next 4/5] selftests/bpf: Fix installation of urandom_read
2021-01-12 13:59 [PATCH bpf-next 0/5] selftests/bpf: Some build fixes Jean-Philippe Brucker
` (2 preceding siblings ...)
2021-01-12 13:59 ` [PATCH bpf-next 3/5] selftests/bpf: Move generated test files to $(TEST_GEN_FILES) Jean-Philippe Brucker
@ 2021-01-12 13:59 ` Jean-Philippe Brucker
2021-01-12 20:57 ` Andrii Nakryiko
2021-01-12 14:00 ` [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases Jean-Philippe Brucker
4 siblings, 1 reply; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-12 13:59 UTC (permalink / raw)
To: bpf
Cc: shuah, ast, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, linux-kselftest, Jean-Philippe Brucker
For out-of-tree builds, $(TEST_CUSTOM_PROGS) require the $(OUTPUT)
prefix, otherwise the kselftest lib doesn't know how to install them:
rsync: [sender] link_stat "tools/testing/selftests/bpf/urandom_read" failed: No such file or directory (2)
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 046848c508d1..bffb4ad59a3d 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -82,7 +82,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \
xdpxceiver
-TEST_CUSTOM_PROGS = urandom_read
+TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read
# Emit succinct information message describing current building step
# $1 - generic step name (e.g., CC, LINK, etc);
--
2.30.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH bpf-next 4/5] selftests/bpf: Fix installation of urandom_read
2021-01-12 13:59 ` [PATCH bpf-next 4/5] selftests/bpf: Fix installation of urandom_read Jean-Philippe Brucker
@ 2021-01-12 20:57 ` Andrii Nakryiko
0 siblings, 0 replies; 11+ messages in thread
From: Andrii Nakryiko @ 2021-01-12 20:57 UTC (permalink / raw)
To: Jean-Philippe Brucker
Cc: bpf, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
john fastabend, KP Singh, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Jan 12, 2021 at 6:01 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> For out-of-tree builds, $(TEST_CUSTOM_PROGS) require the $(OUTPUT)
> prefix, otherwise the kselftest lib doesn't know how to install them:
>
> rsync: [sender] link_stat "tools/testing/selftests/bpf/urandom_read" failed: No such file or directory (2)
>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
Acked-by: Andrii Nakryiko <andrii@kernel.org>
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 046848c508d1..bffb4ad59a3d 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -82,7 +82,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
> test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \
> xdpxceiver
>
> -TEST_CUSTOM_PROGS = urandom_read
> +TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read
>
> # Emit succinct information message describing current building step
> # $1 - generic step name (e.g., CC, LINK, etc);
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases
2021-01-12 13:59 [PATCH bpf-next 0/5] selftests/bpf: Some build fixes Jean-Philippe Brucker
` (3 preceding siblings ...)
2021-01-12 13:59 ` [PATCH bpf-next 4/5] selftests/bpf: Fix installation of urandom_read Jean-Philippe Brucker
@ 2021-01-12 14:00 ` Jean-Philippe Brucker
2021-01-12 20:55 ` Andrii Nakryiko
4 siblings, 1 reply; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-12 14:00 UTC (permalink / raw)
To: bpf
Cc: shuah, ast, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, linux-kselftest, Jean-Philippe Brucker
The btf_dump test cannot access the original source files for comparison
when running the selftests out of tree, causing several failures:
awk: btf_dump_test_case_syntax.c: No such file or directory
...
Add those files to $(TEST_FILES) to have "make install" pick them up.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
tools/testing/selftests/bpf/Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index bffb4ad59a3d..fb8cddc410c0 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -46,7 +46,14 @@ endif
TEST_GEN_FILES = test_lwt_ip_encap.o \
test_tc_edt.o
-TEST_FILES = xsk_prereqs.sh
+TEST_FILES = xsk_prereqs.sh \
+ progs/btf_dump_test_case_syntax.c \
+ progs/btf_dump_test_case_ordering.c \
+ progs/btf_dump_test_case_padding.c \
+ progs/btf_dump_test_case_packing.c \
+ progs/btf_dump_test_case_bitfields.c \
+ progs/btf_dump_test_case_multidim.c \
+ progs/btf_dump_test_case_namespacing.c
# Order correspond to 'make run_tests' order
TEST_PROGS := test_kmod.sh \
--
2.30.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases
2021-01-12 14:00 ` [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases Jean-Philippe Brucker
@ 2021-01-12 20:55 ` Andrii Nakryiko
2021-01-13 9:59 ` Jean-Philippe Brucker
0 siblings, 1 reply; 11+ messages in thread
From: Andrii Nakryiko @ 2021-01-12 20:55 UTC (permalink / raw)
To: Jean-Philippe Brucker
Cc: bpf, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
john fastabend, KP Singh, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Jan 12, 2021 at 6:01 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> The btf_dump test cannot access the original source files for comparison
> when running the selftests out of tree, causing several failures:
>
> awk: btf_dump_test_case_syntax.c: No such file or directory
> ...
>
> Add those files to $(TEST_FILES) to have "make install" pick them up.
>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
> tools/testing/selftests/bpf/Makefile | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index bffb4ad59a3d..fb8cddc410c0 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -46,7 +46,14 @@ endif
>
> TEST_GEN_FILES = test_lwt_ip_encap.o \
> test_tc_edt.o
> -TEST_FILES = xsk_prereqs.sh
> +TEST_FILES = xsk_prereqs.sh \
> + progs/btf_dump_test_case_syntax.c \
> + progs/btf_dump_test_case_ordering.c \
> + progs/btf_dump_test_case_padding.c \
> + progs/btf_dump_test_case_packing.c \
> + progs/btf_dump_test_case_bitfields.c \
> + progs/btf_dump_test_case_multidim.c \
> + progs/btf_dump_test_case_namespacing.c
maybe wildcard(progs/btf_dump_test_case_*) instead? one less thing to
remember to update, if we ever add another test case
>
> # Order correspond to 'make run_tests' order
> TEST_PROGS := test_kmod.sh \
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH bpf-next 5/5] selftests/bpf: Install btf_dump test cases
2021-01-12 20:55 ` Andrii Nakryiko
@ 2021-01-13 9:59 ` Jean-Philippe Brucker
0 siblings, 0 replies; 11+ messages in thread
From: Jean-Philippe Brucker @ 2021-01-13 9:59 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: bpf, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
john fastabend, KP Singh, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Jan 12, 2021 at 12:55:02PM -0800, Andrii Nakryiko wrote:
> > -TEST_FILES = xsk_prereqs.sh
> > +TEST_FILES = xsk_prereqs.sh \
> > + progs/btf_dump_test_case_syntax.c \
> > + progs/btf_dump_test_case_ordering.c \
> > + progs/btf_dump_test_case_padding.c \
> > + progs/btf_dump_test_case_packing.c \
> > + progs/btf_dump_test_case_bitfields.c \
> > + progs/btf_dump_test_case_multidim.c \
> > + progs/btf_dump_test_case_namespacing.c
>
>
> maybe wildcard(progs/btf_dump_test_case_*) instead? one less thing to
> remember to update, if we ever add another test case
Sure, I'll send a v2
Thanks,
Jean
^ permalink raw reply [flat|nested] 11+ messages in thread