From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Hangbin Liu <haliu@redhat.com>,
Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Veronika Kabatova <vkabatov@redhat.com>,
Jiri Benc <jbenc@redhat.com>, Yonghong Song <yhs@fb.com>,
Martin Lau <kafai@fb.com>, Networking <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
brouer@redhat.com
Subject: Re: [PATCH bpf-next V2 2/2] selftests/bpf: test_progs avoid minus shell exit codes
Date: Tue, 7 Jul 2020 08:08:57 +0200 [thread overview]
Message-ID: <20200707080857.29d45856@carbon> (raw)
In-Reply-To: <CAEf4BzZ=v1fMxfxP9XdtEOmQV97XdwJ+Ago++VyVN19-TmeF3A@mail.gmail.com>
On Mon, 6 Jul 2020 15:17:57 -0700
Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> On Mon, Jul 6, 2020 at 10:00 AM Jesper Dangaard Brouer
> <brouer@redhat.com> wrote:
> >
> > There are a number of places in test_progs that use minus-1 as the argument
> > to exit(). This improper use as a process exit status is masked to be a
> > number between 0 and 255 as defined in man exit(3).
>
> nit: I wouldn't call it improper use, as it's a well defined behavior
> (lower byte of returned integer).
>
> >
> > This patch use two different positive exit codes instead, to allow a shell
>
> typo: uses
>
> > script to tell the two error cases apart.
> >
> > Fixes: fd27b1835e70 ("selftests/bpf: Reset process and thread affinity after each test/sub-test")
> > Fixes: 811d7e375d08 ("bpf: selftests: Restore netns after each test")
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
> > tools/testing/selftests/bpf/test_progs.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> > index e8f7cd5dbae4..50803b080593 100644
> > --- a/tools/testing/selftests/bpf/test_progs.c
> > +++ b/tools/testing/selftests/bpf/test_progs.c
> > @@ -12,7 +12,9 @@
> > #include <string.h>
> > #include <execinfo.h> /* backtrace */
> >
> > -#define EXIT_NO_TEST 2
> > +#define EXIT_NO_TEST 2
> > +#define EXIT_ERR_NETNS 3
> > +#define EXIT_ERR_RESET_AFFINITY 4
>
> Let's not overdo this with too granular error codes? All of those seem
> to be just a failure, is there any practical need to differentiate
> between NETNS vs RESET_AFFINITY failure?
I agree, because both cases (NETNS vs RESET_AFFINITY) print to stderr,
which makes it possible to troubleshoot for a human afterwards. The
shell script just need to differentiate that is an "infra" setup issue,
as we e.g. might want to allow the RPM build to continue in those cases.
> I'd go with 3 values:
>
> 1 - at least one test failed
> 2 - no tests were selected
> 3 - "infra" (not a test-specific failure) error (like netns or affinity failed).
>
> Thoughts?
Sure, I can do this.
What define name reflect this best:
EXIT_ERR_SETUP ?
EXIT_ERR_INFRA ?
EXIT_ERR_SETUP_INFRA ?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
prev parent reply other threads:[~2020-07-07 6:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 17:00 [PATCH bpf-next V2 0/2] BPF selftests test runner 'test_progs' use proper shell exit codes Jesper Dangaard Brouer
2020-07-06 17:00 ` [PATCH bpf-next V2 1/2] selftests/bpf: test_progs use another shell exit on non-actions Jesper Dangaard Brouer
2020-07-06 17:00 ` [PATCH bpf-next V2 2/2] selftests/bpf: test_progs avoid minus shell exit codes Jesper Dangaard Brouer
2020-07-06 22:17 ` Andrii Nakryiko
2020-07-07 6:08 ` Jesper Dangaard Brouer [this message]
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=20200707080857.29d45856@carbon \
--to=brouer@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=haliu@redhat.com \
--cc=jbenc@redhat.com \
--cc=kafai@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vkabatov@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).