diff mbox series

[5/8] selftests/bpf: add output dir to include list

Message ID 20200522041310.233185-6-yauheni.kaliuta@redhat.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series selftests/bpf: installation and out of tree build fixes | expand

Commit Message

Yauheni Kaliuta May 22, 2020, 4:13 a.m. UTC
Some headers (skel) are generated in the output directory and used
for build (test_cpp.cpp), so add it to the list (as well as
CURDIR) otherwise out of tree build is broken.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
---
 tools/testing/selftests/bpf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andrii Nakryiko May 26, 2020, 10:13 p.m. UTC | #1
On Thu, May 21, 2020 at 9:14 PM Yauheni Kaliuta
<yauheni.kaliuta@redhat.com> wrote:
>
> Some headers (skel) are generated in the output directory and used
> for build (test_cpp.cpp), so add it to the list (as well as
> CURDIR) otherwise out of tree build is broken.
>

So this is needed only for test_cpp, right? Because test_prog's tests
are built with a special rule changing their workdir to the one that
contains proper skeleton. Let's just add -I$(OUTPUT) to test_cpp rule
instead of adding it to every single .c build rule? If we later still
need this, then we should consider adding it widely.


> Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
> ---
>  tools/testing/selftests/bpf/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 1ba3d72c3261..efab82151ce2 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -22,7 +22,8 @@ LLVM_OBJCOPY  ?= llvm-objcopy
>  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$(CURDIR) -I$(abspath $(OUTPUT))                            \
> +         -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)                      \
>           -I$(TOOLSINCDIR) -I$(APIDIR)                                  \
>           -Dbpf_prog_load=bpf_prog_test_load                            \
>           -Dbpf_load_program=bpf_test_load_program
> --
> 2.26.2
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 1ba3d72c3261..efab82151ce2 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -22,7 +22,8 @@  LLVM_OBJCOPY	?= llvm-objcopy
 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$(CURDIR) -I$(abspath $(OUTPUT)) 				\
+	  -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)			\
 	  -I$(TOOLSINCDIR) -I$(APIDIR)					\
 	  -Dbpf_prog_load=bpf_prog_test_load				\
 	  -Dbpf_load_program=bpf_test_load_program