[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbcXAhRakTAvh8PC2QTnr+zO7U-NbL4VO+VY7QZd_8Ezw@mail.gmail.com>
Date: Sun, 3 Apr 2022 17:02:48 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yuntao Wang <ytcoode@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Shuah Khan <shuah@...nel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix cd_flavor_subdir() of test_progs
On Sun, Apr 3, 2022 at 6:53 AM Yuntao Wang <ytcoode@...il.com> wrote:
>
> Currently, when we run test_progs with just executable file name, for
> example 'PATH=. test_progs-no_alu32', cd_flavor_subdir() will not check
First time seeing this PATH=. trick just to avoid
./test_progs-no_alu32, but sure, the fix makes sense. Applied to
bpf-next.
> if test_progs is running as a flavored test runner and switch into
> corresponding sub-directory.
>
> This will cause test_progs-no_alu32 executed by the
> 'PATH=. test_progs-no_alu32' command to run in the wrong directory and
> load the wrong BPF objects.
>
> Signed-off-by: Yuntao Wang <ytcoode@...il.com>
> ---
> tools/testing/selftests/bpf/test_progs.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> index 2ecb73a65206..0a4b45d7b515 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -761,8 +761,10 @@ int cd_flavor_subdir(const char *exec_name)
> const char *flavor = strrchr(exec_name, '/');
>
> if (!flavor)
> - return 0;
> - flavor++;
> + flavor = exec_name;
> + else
> + flavor++;
> +
> flavor = strrchr(flavor, '-');
> if (!flavor)
> return 0;
> --
> 2.35.1
>
Powered by blists - more mailing lists