public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Ihor Solodrai <ihor.solodrai@pm.me>
Cc: andrii.nakryiko@gmail.com, bpf@vger.kernel.org, ast@kernel.org,
	eddyz87@gmail.com, daniel@iogearbox.net, mykolal@fb.com,
	Anders Roxell <anders.roxell@linaro.org>,
	patchwork-bot+netdevbpf@kernel.org
Subject: Re: [PATCH bpf-next v4] selftests/bpf: use auto-dependencies for test objects
Date: Sat, 14 Sep 2024 12:54:14 +0200	[thread overview]
Message-ID: <87seu2a4kp.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <Q3BN2kW9Kgy6LkrDOwnyY4Pv7_YF8fInLCd2_QA3LimKYM3wD64kRdnwp7blwG2dI_s7UGnfUae-4_dOmuTrxpYCi32G_KTzB3PfmxIerH8=@pm.me>

Ihor Solodrai <ihor.solodrai@pm.me> writes:

> 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.

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

  reply	other threads:[~2024-09-14 10:54 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 22:57 [PATCH bpf-next v4] selftests/bpf: use auto-dependencies for test objects Ihor Solodrai
2024-07-19 18:18 ` Andrii Nakryiko
2024-07-19 19:03   ` Ihor Solodrai
2024-07-19 21:54   ` Tony Ambardar
2024-07-19 22:25     ` Andrii Nakryiko
2024-07-19 23:21       ` [PATCH bpf-next v1] selftests/bpf: Fix wrong binary in Makefile log output Tony Ambardar
2024-07-20  0:14         ` bot+bpf-ci
2024-07-20  1:23         ` Eduard Zingerman
2024-07-20  2:57         ` Andrii Nakryiko
2024-07-20  5:23           ` Tony Ambardar
2024-07-23  1:35             ` Tony Ambardar
2024-07-23  1:37               ` Eduard Zingerman
2024-07-23 20:28                 ` Andrii Nakryiko
2024-07-20  5:25         ` [PATCH bpf-next v2] " Tony Ambardar
2024-07-20  5:49           ` bot+bpf-ci
2024-07-22 15:17           ` bot+bpf-ci
2024-07-22 19:58           ` bot+bpf-ci
2024-07-23  1:40           ` bot+bpf-ci
2024-07-23  2:46           ` bot+bpf-ci
2024-07-23 20:30           ` patchwork-bot+netdevbpf
2024-07-19 18:20 ` [PATCH bpf-next v4] selftests/bpf: use auto-dependencies for test objects patchwork-bot+netdevbpf
2024-07-23  0:39   ` Alexei Starovoitov
2024-07-23  0:57     ` Eduard Zingerman
2024-07-23  1:49       ` Eduard Zingerman
2024-07-23  1:50       ` Ihor Solodrai
2024-07-23 19:25         ` Ihor Solodrai
2024-07-23 20:02           ` Andrii Nakryiko
2024-07-23 20:11             ` Ihor Solodrai
2024-09-13 14:51   ` Björn Töpel
2024-09-13 22:33     ` Ihor Solodrai
2024-09-14 10:54       ` Björn Töpel [this message]
2024-09-15  4:47         ` Ihor Solodrai
2024-09-15 15:41           ` Björn Töpel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seu2a4kp.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=anders.roxell@linaro.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@pm.me \
    --cc=mykolal@fb.com \
    --cc=patchwork-bot+netdevbpf@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox