bpf.vger.kernel.org archive mirror
 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>,
	brouer@redhat.com
Subject: Re: [PATCH bpf-next] selftests/bpf: test_progs option for listing test names
Date: Tue, 30 Jun 2020 22:32:24 +0200	[thread overview]
Message-ID: <20200630223224.16fb2377@carbon> (raw)
In-Reply-To: <CAEf4BzZ-Ryq+i1ez3Q8G1js6tuD8niAejJzA5Gf7N-vS=6AE_g@mail.gmail.com>

On Tue, 30 Jun 2020 08:46:01 -0700
Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:

> > @@ -688,9 +700,17 @@ int main(int argc, char **argv)
> >                         cleanup_cgroup_environment();
> >         }
> >         stdio_restore();
> > +
> > +       if (env.list_test_names) {
> > +               if (env.succ_cnt == 0)
> > +                       env.fail_cnt = 1;
> > +               goto out;
> > +       }
> > +  
> 
> Why failure if no test matched? Is that to catch bugs in whitelisting?

I would not call it catch bugs, but sort of.  The purpose is to know if
requested test is valid.  This can be used to e.g. run through all the
tests numbers, and stopping when a test number (-n) is no-longer valid,
by using this shell exit value as a test, like:

 n=1;
 while [ $(./test_progs --list -n $n) ] ; do \
   echo "./test_progs -n $n" ; n=$(( n+1 )); \
 done

Notice that this features that be used for looking up a test number,
and returning a testname, which was the original request from CI.  I
choose this implementation as it more generic and generally useful.

 $ ./test_progs --list -n 89
 xdp_adjust_tail


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


  reply	other threads:[~2020-06-30 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 15:40 [PATCH bpf-next] selftests/bpf: test_progs option for listing test names Jesper Dangaard Brouer
2020-06-30 15:46 ` Andrii Nakryiko
2020-06-30 20:32   ` Jesper Dangaard Brouer [this message]
2020-06-30 21:19     ` Andrii Nakryiko
2020-07-01 15:36       ` Alexei Starovoitov
2020-07-01 16:23         ` Jesper Dangaard Brouer
2020-07-01 16:31           ` Alexei Starovoitov

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=20200630223224.16fb2377@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 \
    /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).