Skip to contentSkip to conversation

tests: fix bpf ops build error

PATCH Applied Haiyue Wang 2 participants 3 messages Apr 26 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 tests: fix bpf ops build error

If removed the previous install by 'rm -rf /usr/include/liburing', the test build will fail:

make[1]: Entering directory '/root/linux/liburing/test'
CC helpers.o
mkdir -p output/bpf
CC output/bpf/nops.bpf.o
mkdir -p output/bpf
CC output/bpf/cp.bpf.o
In file included from /root/linux/liburing/test/bpf-progs/nops.bpf.c:2:
/root/linux/liburing/test/bpf-progs/../bpf_defs.h:9:10: fatal error: 'liburing/io_uring.h' file not found
9 | #include "liburing/io_uring.h"
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:387: output/bpf/nops.bpf.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from /root/linux/liburing/test/bpf-progs/cp.bpf.c:2:
/root/linux/liburing/test/bpf-progs/../bpf_defs.h:9:10: fatal error: 'liburing/io_uring.h' file not found
9 | #include "liburing/io_uring.h"
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:387: output/bpf/cp.bpf.o] Error 1
make[1]: Leaving directory '/root/linux/liburing/test'
make: *** [Makefile:14: all] Error 2

Add the include option in 'CPPFLAGS' for bpf build.

Fixes fd8a6e66c739 ("tests: test io_uring bpf ops")
---
 test/Makefile | 1 +
 1 file changed, 1 insertion(+)
test/Makefile +1 -0
index bcb97da1..05e1f9e9 100644
@@ -385,6 +385,7 @@ CLANG_BPF_SYS_INCLUDES ?= $(shell $(CLANG) -v -E - </dev/null 2>&1 \
 $(BPF_OUTPUT)/%.bpf.o: $(BPF_PROGS_DIR)/%.bpf.c $(wildcard %.h)
 	mkdir -p ${BPF_OUTPUT}
 	$(QUIET_CC)$(CLANG) -g -O2 -target bpf \
+		     -I../src/include/ \
 		     -I$(BPF_OUTPUT) $(CLANG_BPF_SYS_INCLUDES) \
 		     -Wno-missing-declarations \
 		     -c $(filter %.c,$^) -o $(patsubst %.bpf.o,%.tmp.bpf.o,$@) -mcpu=v4
Signature · 1 line
2.54.0
#1 lore raw

PATCH 2/2 .gitignore: add new test build output

These two files are new added build output:
test/bpf_cp.tt
test/bpf_nops.tt

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index c6936314..e901d9b0 100644
@@ -31,6 +31,7 @@
 /examples/zcrx
 
 /test/*.t
+/test/*.tt
 /test/*.dmesg
 /test/output/
 
Signature · 1 line
2.54.0
maintainer Applied
#2 lore raw
In reply to Haiyue Wang
Quoted 25 lines · Haiyue Wang

If removed the previous install by 'rm -rf /usr/include/liburing', the test build will fail:

make[1]: Entering directory '/root/linux/liburing/test'
CC helpers.o
mkdir -p output/bpf
CC output/bpf/nops.bpf.o
mkdir -p output/bpf
CC output/bpf/cp.bpf.o
In file included from /root/linux/liburing/test/bpf-progs/nops.bpf.c:2:
/root/linux/liburing/test/bpf-progs/../bpf_defs.h:9:10: fatal error: 'liburing/io_uring.h' file not found
9 | #include "liburing/io_uring.h"
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:387: output/bpf/nops.bpf.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from /root/linux/liburing/test/bpf-progs/cp.bpf.c:2:
/root/linux/liburing/test/bpf-progs/../bpf_defs.h:9:10: fatal error: 'liburing/io_uring.h' file not found
9 | #include "liburing/io_uring.h"
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:387: output/bpf/cp.bpf.o] Error 1
make[1]: Leaving directory '/root/linux/liburing/test'
make: *** [Makefile:14: all] Error 2

Quoted 1 line

[...]

Applied, thanks!

[1/2] tests: fix bpf ops build error

      commit: 49f1a2ab7833a3563329fd9a86f58f84875d57e4
[2/2] .gitignore: add new test build output
      commit: 4330d09391470154ba4e453d01b1cf2f1f5ef32d

Best regards,

Signature · 1 line
Jens Axboe