On Wed, May 18, 2022 at 7:44 PM Hangbin Liu liuhangbin@gmail.com wrote:
On Wed, May 18, 2022 at 03:36:53PM -0700, Andrii Nakryiko wrote:
On Fri, May 13, 2022 at 02:58:05PM -0700, Andrii Nakryiko wrote:
-TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
ima_setup.sh \
+TRUNNER_EXTRA_BUILD := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ $(wildcard progs/btf_dump_test_case_*.c)
note that progs/btf_dump_test_case_*.c are not built, they are just copied over (C source files), so I don't think this fix is necessary.
btw, I tried running `OUTPUT="/tmp/bpf" make test_progs` and it didn't error out. But tbh, I'd recommend building everything instead of building individual targets.
After update the code to latest bpf-next. It works this time, the ima_setup.sh was copied to target folder correctly.
EXT-COPY [test_progs] urandom_read bpf_testmod.ko liburandom_read.so ima_setup.sh btf_dump_test_case_bitfields.c btf_dump_test_case_multidim.c btf_dump_test_case_namespacing.c btf_dump_test_case_ordering.c btf_dump_test_case_packing.c btf_dump_test_case_padding.c btf_dump_test_case_syntax.c BINARY test_progs
Not sure why the previous kernel doesn't work. But anyway I will drop this patch.
On the other hand, when I build with latest bpf-next. I got error like:
""" # OUTPUT="/tmp/bpf" make test_progs BINARY urandom_read gcc -g -O0 -rdynamic -Wall -Werror -DHAVE_GENHDR -I/home/net/tools/testing/selftests/bpf -I/tmp/bpf/tools/include -I/home/net/include/generated -I/home/net/tools/lib -I/home/net/tools/include -I/home/net/tools/include/uapi -I/tmp/bpf urandom_read.c urandom_read_aux.c \ liburandom_read.so -lelf -lz -lrt -lpthread \ -Wl,-rpath=. -Wl,--build-id=sha1 -o /tmp/bpf/urandom_read
we assume liburandom_read.so is going to be under selftests/bpf here, but it's actually under $(OUTPUT)/
Can you try $(OUTPUT)/liburandom_read.so? I suspect this might break -rpath=., though, but let's try this first?
Sigh.. After rebase to latest bpf-next, to make clean and re-do `OUTPUT="/tmp/bpf" make test_progs`, There is no liburandom_read.so build issue but the ima_setup.sh error come up again...
LINK resolve_btfids LIB liburandom_read.so BINARY urandom_read MOD bpf_testmod.ko CC [M] /home/net/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.o MODPOST /home/net/tools/testing/selftests/bpf/bpf_testmod/Module.symvers CC [M] /home/net/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.mod.o LD [M] /home/net/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.ko BTF [M] /home/net/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.ko make: *** No rule to make target '/tmp/bpf/ima_setup.sh', needed by 'ima_setup.sh'. Stop.
Not sure if it's a build environment setup issue or others.
I don't use OUTPUT when building selftests and see no issues, so this must be related. If you care about OUTPUT working please try to debug and figure this out.
Hangbin