From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 204F83858D38 for ; Thu, 13 Aug 2020 01:46:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 204F83858D38 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357-KlPMSgy9Olq-MCdl6qjtFg-1; Wed, 12 Aug 2020 21:46:20 -0400 X-MC-Unique: KlPMSgy9Olq-MCdl6qjtFg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D03BB8712D9; Thu, 13 Aug 2020 01:46:19 +0000 (UTC) Received: from f32-m1.lan (ovpn-114-248.phx2.redhat.com [10.3.114.248]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8FBA1001B07; Thu, 13 Aug 2020 01:46:19 +0000 (UTC) Date: Wed, 12 Aug 2020 18:46:19 -0700 From: Kevin Buettner To: Simon Marchi via Gdb-patches Subject: Re: [PATCH] gdb: allow specifying multiple filters when running selftests Message-ID: <20200812184619.3e979092@f32-m1.lan> In-Reply-To: <20200812221245.69493-1-simon.marchi@polymtl.ca> References: <20200812221245.69493-1-simon.marchi@polymtl.ca> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2020 01:46:27 -0000 On Wed, 12 Aug 2020 18:12:45 -0400 Simon Marchi via Gdb-patches 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