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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ihor Solodrai <ihor.solodrai@xxxxx> writes:

> On Friday, September 13th, 2024 at 7:51 AM, Björn Töpel <bjorn@xxxxxxxxxx> 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.

I don't even get that far in the "install" target. When I revert the
patch, I get to the issue you describe above (trying to install
non-existing file).

Here's an excerpt from a failed "install":

  |   BINARY   test_progs
  |   BINARY   test_progs-no_alu32
  |   BINARY   test_progs-cpuv4
  | make[1]: Leaving directory '/home/bjorn/src/linux/linux/tools/testing/selftests/bpf'

At this point the "all" target is complete; All good, and the "install"
is started. 

  | mkdir -p /home/bjorn/output/foo/kselftest/kselftest
  | install -m 744 kselftest/module.sh /home/bjorn/output/foo/kselftest/kselftest/
  | install -m 744 kselftest/runner.sh /home/bjorn/output/foo/kselftest/kselftest/
  | install -m 744 kselftest/prefix.pl /home/bjorn/output/foo/kselftest/kselftest/
  | install -m 744 kselftest/ktap_helpers.sh /home/bjorn/output/foo/kselftest/kselftest/
  | install -m 744 kselftest/ksft.py /home/bjorn/output/foo/kselftest/kselftest/
  | install -m 744 run_kselftest.sh /home/bjorn/output/foo/kselftest/
  | rm -f /home/bjorn/output/foo/kselftest/kselftest-list.txt

This is from the top-level "tools/testing/selftests/Makefile", and we
enter the BPF directory for "install".

  | make[1]: Entering directory '/home/bjorn/src/linux/linux/tools/testing/selftests/bpf'
  | 
  | Auto-detecting system features:
  | ...                                    llvm: [ OFF ]
  | 
  |   LINK-BPF [test_progs] test_static_linked.bpf.o
  |   LINK-BPF [test_progs] linked_funcs.bpf.o
  |   LINK-BPF [test_progs] linked_vars.bpf.o
  |   LINK-BPF [test_progs] linked_maps.bpf.o
  |   LINK-BPF [test_progs] test_subskeleton.bpf.o
  |   LINK-BPF [test_progs] test_subskeleton_lib.bpf.o
  | ...
  |   EXT-COPY [test_maps]
  | make[1]: *** No rule to make target 'atomics.lskel.h', needed by '/home/bjorn/output/foo/kselftest/bpf/atomics.test.o'.  Stop.
  | make[1]: *** Waiting for unfinished jobs....
  | make[1]: Leaving directory '/home/bjorn/src/linux/linux/tools/testing/selftests/bpf'
  | make: *** [Makefile:259: install] Error 2
  | make: Leaving directory '/home/bjorn/src/linux/linux/tools/testing/selftests'

...and for some reason the auto-dependencies decides to re-build, and
fails.

So, unfortunately it's something else related to your patch.

A reproducer:
  | $ docker run --rm -it --volume ${PWD}:/build/my-linux ghcr.io/linux-riscv/pw-builder bash -l
  | # cd /build/my-linux
  | # cat > ./build.sh <<EOF
  | #!/bin/bash
  | set -euo pipefail
  | 
  | rm -rf /output/foo
  | mkdir -p /output/foo
  | 
  | export PATH=\$(echo \$PATH | tr : "\n"| grep -v ^/opt | tr "\n" :)
  | 
  | make -j \$((\$(nproc)-1)) O=/output/foo defconfig
  | make -j \$((\$(nproc)-1)) O=/output/foo kselftest-merge
  | make -j \$((\$(nproc)-1)) O=/output/foo
  | make -j \$((\$(nproc)-1)) O=/output/foo headers
  | make -j \$((\$(nproc)-1)) O=/output/foo TARGETS=bpf SKIP_TARGETS="" KSFT_INSTALL_PATH=/output/foo/kselftest -C tools/testing/selftests install
  | EOF
  | 
  | # chmod +x ./build.sh
  | # ./build.sh


Björn





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux