From: Jakub Sitnicki <jakub@cloudflare.com>
To: Po-Hsu Lin <po-hsu.lin@canonical.com>
Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
hawk@kernel.org, kuba@kernel.org, davem@davemloft.net,
kpsingh@kernel.org, john.fastabend@gmail.com, yhs@fb.com,
songliubraving@fb.com, kafai@fb.com, andrii@kernel.org,
daniel@iogearbox.net, ast@kernel.org, skhan@linuxfoundation.org
Subject: Re: [PATCH] selftests/bpf: Use kselftest skip code for skipped tests
Date: Wed, 25 Aug 2021 11:44:00 +0200 [thread overview]
Message-ID: <87h7fdg8pr.fsf@cloudflare.com> (raw)
In-Reply-To: <20210823030143.29937-1-po-hsu.lin@canonical.com>
On Mon, Aug 23, 2021 at 05:01 AM CEST, Po-Hsu Lin wrote:
> There are several test cases in the bpf directory are still using
> exit 0 when they need to be skipped. Use kselftest framework skip
> code instead so it can help us to distinguish the return status.
>
> Criterion to filter out what should be fixed in bpf directory:
> grep -r "exit 0" -B1 | grep -i skip
>
> This change might cause some false-positives if people are running
> these test scripts directly and only checking their return codes,
> which will change from 0 to 4. However I think the impact should be
> small as most of our scripts here are already using this skip code.
> And there will be no such issue if running them with the kselftest
> framework.
>
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---
> tools/testing/selftests/bpf/test_bpftool_build.sh | 5 ++++-
> tools/testing/selftests/bpf/test_xdp_meta.sh | 5 ++++-
> tools/testing/selftests/bpf/test_xdp_vlan.sh | 7 +++++--
> 3 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_bpftool_build.sh b/tools/testing/selftests/bpf/test_bpftool_build.sh
> index ac349a5..b6fab1e 100755
> --- a/tools/testing/selftests/bpf/test_bpftool_build.sh
> +++ b/tools/testing/selftests/bpf/test_bpftool_build.sh
> @@ -1,6 +1,9 @@
> #!/bin/bash
> # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>
> +# Kselftest framework requirement - SKIP code is 4.
> +ksft_skip=4
> +
> case $1 in
> -h|--help)
> echo -e "$0 [-j <n>]"
> @@ -22,7 +25,7 @@ KDIR_ROOT_DIR=$(realpath $PWD/$SCRIPT_REL_DIR/../../../../)
> cd $KDIR_ROOT_DIR
> if [ ! -e tools/bpf/bpftool/Makefile ]; then
> echo -e "skip: bpftool files not found!\n"
> - exit 0
> + exit $ksft_skip
> fi
>
> ERROR=0
This bit has been fixed a couple days ago by a similar change:
https://lore.kernel.org/bpf/20210820025549.28325-1-lizhijian@cn.fujitsu.com
> diff --git a/tools/testing/selftests/bpf/test_xdp_meta.sh b/tools/testing/selftests/bpf/test_xdp_meta.sh
> index 637fcf4..fd3f218 100755
> --- a/tools/testing/selftests/bpf/test_xdp_meta.sh
> +++ b/tools/testing/selftests/bpf/test_xdp_meta.sh
> @@ -1,5 +1,8 @@
> #!/bin/sh
>
> +# Kselftest framework requirement - SKIP code is 4.
> +ksft_skip=4
> +
> cleanup()
> {
> if [ "$?" = "0" ]; then
Would consider making it read-only:
readonly KSFT_SKIP=4
[...]
next prev parent reply other threads:[~2021-08-25 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 3:01 [PATCH] selftests/bpf: Use kselftest skip code for skipped tests Po-Hsu Lin
2021-08-25 1:32 ` Dylan Hatch
2021-08-25 9:44 ` Jakub Sitnicki [this message]
2021-09-29 5:22 ` Po-Hsu Lin
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=87h7fdg8pr.fsf@cloudflare.com \
--to=jakub@cloudflare.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=po-hsu.lin@canonical.com \
--cc=skhan@linuxfoundation.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.