Re: [PATCH bpf-next v4] selftests/bpf: use auto-dependencies for test objects

Ihor Solodrai
2024-09-13T22:33:28Z

On Friday, September 13th, 2024 at 7:51 AM, Björn Töpel <bjorn@kernel.org> wrote:

> I'm getting some build regressions for out-of-tree selftest build with
> this patch on bpf-next/master. I'm building the selftests from the
> selftest root, typically:
>
> make O=/output/foo SKIP_TARGETS="" \
> KSFT_INSTALL_PATH=/output/foo/kselftest \
> -C tools/testing/selftests install
>
> and then package the whole output kselftest directory, and use that to
> populate the DUT.
>
> Reverting this patch, resolves the issues.
>
> Two issues:
>
> 1. The install target fails, resulting in many test scripts not copied
> to the install directory (e.g. test_kmod.sh).
> 2. Building "all" target fails the second time.
>
> To reproduce, do the following:
>
> Pre-requisite
> Build the kernel for yourfavorite arch -- my is RISC-V at moment ;-)
>
> make O=/output/foo defconfig
> make O=/output/foo kselftest-merge
> make O=/output/foo
> make O=/output/foo headers
>
> 1. Install fail
> make O=/output/foo TARGETS=bpf SKIP_TARGETS="" \
> KSFT_INSTALL_PATH=/output/foo/kselftest \
> -C tools/testing/selftests install
>
> 2. Build "all" fails the second time
> make O=/output/foo TARGETS=bpf SKIP_TARGETS="" \
> KSFT_INSTALL_PATH=/output/foo/kselftest \
> -C tools/testing/selftests
>
> make O=/output/foo TARGETS=bpf SKIP_TARGETS="" \
> KSFT_INSTALL_PATH=/output/foo/kselftest \
> -C tools/testing/selftests
>
>
> Any ideas on a workaround?

Hi Björn.

I was able to reproduce the problem on bpf-next/master.

I found that in commit
https://git.kernel.org/bpf/bpf-next/c/f957c230e173 [1] the file
tools/testing/selftests/bpf/test_skb_cgroup_id.sh was deleted, but not
removed from the TEST_PROGS list in tools/testing/selftests/bpf/Makefile

Because of that rsync command (invoked by install target) fails:

rsync: [sender] link_stat "/opt/linux/tools/testing/selftests/bpf/test_skb_cgroup_id.sh" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]
make[1]: *** [../lib.mk:175: install] Error 23
make[1]: Leaving directory '/opt/linux/tools/testing/selftests/bpf'
make: *** [Makefile:259: install] Error 2
make: Leaving directory '/opt/linux/tools/testing/selftests'

After I removed test_skb_cgroup_id.sh from TEST_PROGS list, the
install target completed successfully.

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index f04af11df8eb..df75f1beb731 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -132,7 +132,6 @@ TEST_PROGS := test_kmod.sh \
test_tunnel.sh \
test_lwt_seg6local.sh \
test_lirc_mode2.sh \
- test_skb_cgroup_id.sh \
test_flow_dissector.sh \
test_xdp_vlan_mode_generic.sh \
test_xdp_vlan_mode_native.sh \

Could you please check on your side if this helps? Maybe there are
other issues.

[1] https://lore.kernel.org/bpf/20240813-convert_cgroup_tests-v4-4-a33c03458cf6@bootlin.com/

>
> (And not related to this patch; It's annoying that "bpf" is the default
> SKIP_TARGETS in kselftest. A bit meh 2024. ;-))
>
>
> Björn
>