From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92032 invoked by alias); 6 Sep 2017 18:38:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 91389 invoked by uid 89); 6 Sep 2017 18:38:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Sep 2017 18:38:01 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v86IbsZI016116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 6 Sep 2017 14:37:59 -0400 Received: by simark.ca (Postfix, from userid 112) id 293A81EAA0; Wed, 6 Sep 2017 14:37:54 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 4C6E71EA18; Wed, 6 Sep 2017 14:37:53 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 06 Sep 2017 18:38:00 -0000 From: Simon Marchi To: Pedro Alves Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Add selftests run filtering In-Reply-To: <0cc25dd0-4311-28e8-f0ca-443719354bed@redhat.com> References: <1504612227-7159-1-git-send-email-simon.marchi@ericsson.com> <0cc25dd0-4311-28e8-f0ca-443719354bed@redhat.com> Message-ID: <148b3fcdbb9bfbbb51589f585d1f3f5b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 6 Sep 2017 18:37:54 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00162.txt.bz2 On 2017-09-06 17:25, Pedro Alves wrote: > Sounds useful. > > Patch looks fine to me. Nits and comments below. > > I wonder whether we'll want to be able to do select tests > with e.g., a regexp instead of exact matching. If we do, then > the std::vector->std::map change would seem pointless. Not sure I understand. I am not using exact matching now either, so using a map is probably already pointless. I am not sure what lead me there, maybe I started with the intent of using exact matching. I'll change it to a vector of a new struct type. > Do you plan on adding some command to list the existing tests? Yeah, why not. "maintenance info selftests"? > On 09/05/2017 12:50 PM, Simon Marchi wrote: >> static void >> maintenance_selftest (char *args, int from_tty) >> { >> - selftests::run_tests (); >> + selftests::selftests_results results_noarch = selftests::run_tests >> (args); >> + selftests::selftests_results results_arch = >> selftests::run_tests_with_arch (args); > > Line too long? You could also shorten "selftests_results" > to e.g., "test_results", since the type is already in the > "selftests" namespace. Done. >> + printf_filtered (_("Ran %d unit tests, %d failed\n"), >> + results_noarch.ran + results_arch.ran, >> + results_noarch.failed + results_arch.failed); > > Wonder whether it'd make sense to implement operator+= for > selftests_results so that you'd write: > > selftests::selftests_results results = selftests::run_tests (args); > results += selftests::run_tests_with_arch (args); > // etc. > > printf_filtered (_("Ran %d unit tests, %d failed\n"), > results.ran, results.failed); I thought it was a bit overkill for our needs, but on the other side there's no good argument against it and it's cleaner. I'll do that. >> _initialize_findvar (void) >> { >> #if GDB_SELF_TEST >> - selftests::register_test >> (selftests::findvar_tests::copy_integer_to_size_test); >> + selftests::register_test ( >> + "copy_integer_to_size", >> + selftests::findvar_tests::copy_integer_to_size_test); >> #endif > > In GNU style it's much more common to break the line > before "(", not after. Ah ok thanks, I always have a doubt in that situation. Simon