Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: allow specifying multiple filters when running selftests
Date: Wed, 12 Aug 2020 18:46:19 -0700	[thread overview]
Message-ID: <20200812184619.3e979092@f32-m1.lan> (raw)
In-Reply-To: <20200812221245.69493-1-simon.marchi@polymtl.ca>

On Wed, 12 Aug 2020 18:12:45 -0400
Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> wrote:

> I found myself wanting to run a few specific selftests while developing.
> I thought it would be nice to be able to provide multiple test names
> when running `maintenant selftests`.  The arguments to that command is
> currently interpreted as a single filter (not split by spaces), it now
> becomes a list a filters, split by spaces.  A test is executed when it
> matches at least one filter.
> 
> Here's an example of the result in GDB:
> 
>     (gdb) maintenance selftest xml
>     Running selftest xml_escape_text.
>     Running selftest xml_escape_text_append.
>     Ran 2 unit tests, 0 failed
>     (gdb) maintenance selftest xml unord
>     Running selftest unordered_remove.
>     Running selftest xml_escape_text.
>     Running selftest xml_escape_text_append.
>     Ran 3 unit tests, 0 failed
>     (gdb) maintenance selftest xml unord foobar
>     Running selftest unordered_remove.
>     Running selftest xml_escape_text.
>     Running selftest xml_escape_text_append.
>     Ran 3 unit tests, 0 failed
> 
> Since the selftest machinery is also shared with gdbserver, I also
> adapted gdbserver.  It accepts a `--selftest` switch, which accepts an
> optional filter argument.  I made it so you can now pass `--selftest`
> multiple time to add filters.
> 
> It's not so useful right now though: there's only a single selftest
> right now in GDB and it's for an architecture I can't compile.  So I
> tested by adding dummy tests, here's an example of the result:
> 
>     $ ./gdbserver --selftest=foo
>     Running selftest foo.
>     foo
>     Running selftest foobar.
>     foobar
>     Ran 2 unit tests, 0 failed
>     $ ./gdbserver --selftest=foo --selftest=bar
>     Running selftest bar.
>     bar
>     Running selftest foo.
>     foo
>     Running selftest foobar.
>     foobar
>     Ran 3 unit tests, 0 failed
> 
> gdbsupport/ChangeLog:
> 
> 	* selftest.h (run_tests): Change parameter to array_view.
> 	* selftest.c (run_tests): Change parameter to array_view and use
> 	it.
> 
> gdb/ChangeLog:
> 
> 	* maint.c (maintenance_selftest): Split args and pass array_view
> 	to run_tests.
> 
> gdbserver/ChangeLog:
> 
> 	* server.cc (captured_main): Accept multiple `--selftest=`
> 	options.  Pass all `--selftest=` arguments to run_tests.

LGTM.

Kevin



  reply	other threads:[~2020-08-13  1:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 22:12 Simon Marchi
2020-08-13  1:46 ` Kevin Buettner [this message]
2020-08-13 12:06   ` Simon Marchi
2020-08-13 14:06 ` Tom Tromey
2020-08-13 15:01   ` Simon Marchi
2020-08-13 16:12     ` Tom Tromey
2020-08-13 22:24       ` [PATCH] gdb: add gdb_argv::as_array_view method Simon Marchi
2020-08-14 15:33         ` Tom Tromey
2020-08-14 16:33           ` Simon Marchi

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=20200812184619.3e979092@f32-m1.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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