All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	brouer@redhat.com
Subject: Re: [PATCH bpf-next V2 3/3] selftests/bpf: test_progs indicate to shell on non-actions
Date: Wed, 1 Jul 2020 23:38:30 +0200	[thread overview]
Message-ID: <20200701233830.19ee0ec8@carbon> (raw)
In-Reply-To: <CAEf4BzYXAHMC=7DTEzqH563zuMsuZuMbDaBPN9TmX4P8PG49jA@mail.gmail.com>

On Wed, 1 Jul 2020 13:54:41 -0700
Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:

> On Wed, Jul 1, 2020 at 1:19 PM Jesper Dangaard Brouer <brouer@redhat.com> wrote:
> >
> > When a user selects a non-existing test the summary is printed with
> > indication 0 for all info types, and shell "success" (EXIT_SUCCESS) is
> > indicated. This can be understood by a human end-user, but for shell
> > scripting is it useful to indicate a shell failure (EXIT_FAILURE).
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
> >  tools/testing/selftests/bpf/test_progs.c |    9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> > index 3345cd977c10..75cf5b13cbd6 100644
> > --- a/tools/testing/selftests/bpf/test_progs.c
> > +++ b/tools/testing/selftests/bpf/test_progs.c
> > @@ -706,11 +706,8 @@ int main(int argc, char **argv)
> >                 goto out;
> >         }
> >
> > -       if (env.list_test_names) {
> > -               if (env.succ_cnt == 0)
> > -                       env.fail_cnt = 1;
> > +       if (env.list_test_names)
> >                 goto out;
> > -       }
> >
> >         fprintf(stdout, "Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n",
> >                 env.succ_cnt, env.sub_succ_cnt, env.skip_cnt, env.fail_cnt);
> > @@ -723,5 +720,9 @@ int main(int argc, char **argv)
> >         free_str_set(&env.subtest_selector.whitelist);
> >         free(env.subtest_selector.num_set);
> >
> > +       /* Return EXIT_FAILURE when options resulted in no actions */
> > +       if (!env.succ_cnt && !env.fail_cnt && !env.skip_cnt)
> > +               env.fail_cnt = 1;
> > +  
> 
> Heh, just suggested something like this in the previous patch. I think
> this change should go first in patch series and not churn on
> env.list_test_names above.
> 
> I'd also rewrite it as (no need to muck around with fail_cnt, less
> negation for integers):
> 
> if (env.succ_cnt + env.fail_cnt + env.skip_cnt == 0)
>     return EXIT_FAILURE;

All good suggestions, I'll respin.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


      reply	other threads:[~2020-07-01 21:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 20:18 [PATCH bpf-next V2 0/3] BPF selftests test runner test_progs improvement for scripting Jesper Dangaard Brouer
2020-07-01 20:18 ` [PATCH bpf-next V2 1/3] selftests/bpf: test_progs option for getting number of tests Jesper Dangaard Brouer
2020-07-01 20:19 ` [PATCH bpf-next V2 2/3] selftests/bpf: test_progs option for listing test names Jesper Dangaard Brouer
2020-07-01 20:51   ` Andrii Nakryiko
2020-07-01 20:19 ` [PATCH bpf-next V2 3/3] selftests/bpf: test_progs indicate to shell on non-actions Jesper Dangaard Brouer
2020-07-01 20:54   ` Andrii Nakryiko
2020-07-01 21:38     ` 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=20200701233830.19ee0ec8@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=vkabatov@redhat.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.