From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 3089D395ACC2 for ; Thu, 23 Apr 2020 20:28:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3089D395ACC2 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-57-ry9apq00PlqFuwSfz_cvMw-1; Thu, 23 Apr 2020 16:28:10 -0400 X-MC-Unique: ry9apq00PlqFuwSfz_cvMw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3AE711083E81; Thu, 23 Apr 2020 20:28:09 +0000 (UTC) Received: from theo.uglyboxes.com (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8DD65C1D0; Thu, 23 Apr 2020 20:28:08 +0000 (UTC) Subject: Re: [PATCH 3/4] gdb/testsuite: Detect and warn about duplicate test names To: Andrew Burgess , gdb-patches@sourceware.org References: <6f747a57bd458c013a6f61452e568c30a85cf9a4.1587663712.git.andrew.burgess@embecosm.com> From: Keith Seitz Message-ID: Date: Thu, 23 Apr 2020 13:28:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <6f747a57bd458c013a6f61452e568c30a85cf9a4.1587663712.git.andrew.burgess@embecosm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-26.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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, 23 Apr 2020 20:28:16 -0000 On 4/23/20 10:53 AM, Andrew Burgess wrote: > Spots when tests reuse the same test name and prints a new result type > '# of duplicate test names' in the result summary. The above reads awkwardly. Or I'm awkward. Take your pick. :-) > Currently if the tests are run in parallel mode the new result type is > not merged into the combined summary file so users will need to run in > non-parallel mode to check this result. A later commit will fix this. I don't know how others approach testing, but when I add new/modify tests, I always run them separately first without parallelization. This would still catch any mistakes I might make. So from my perspective, it's a still a win! My only comment is a reiteration of the namespace wrapping I encouraged in the last patch. Keith > diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp > index 6377ace3fc3..85520191f27 100644 > --- a/gdb/testsuite/lib/check-test-names.exp > +++ b/gdb/testsuite/lib/check-test-names.exp > @@ -22,6 +22,13 @@ > # or the build path. > set paths_in_test_names 0 > > +# An associative array of all test names to the number of times each > +# name is seen. Used to detect duplicate test names. > +array set all_test_names {} > + > +# A count of the number of duplicte test names seen. > +set duplicate_test_names_seen 0 > + > # Check if MESSAGE contains either the source path or the build path. > # This will result in test names that can't easily be compared between > # different runs of GDB. > @@ -31,6 +38,8 @@ set paths_in_test_names 0 > proc check_test_names { message } { > global srcdir objdir > global paths_in_test_names > + global all_test_names > + global duplicate_test_names_seen > > foreach pattern [list $srcdir $objdir] { > if { [ regexp $pattern $message ] } { > @@ -39,6 +48,16 @@ proc check_test_names { message } { > return > } > } > + > + # Initialise a count, or increment the count for this test name. > + if {![info exists all_test_names($message)]} { > + set all_test_names($message) 0 > + } else { > + if {$all_test_names($message) == 0} { > + incr duplicate_test_names_seen > + } > + incr all_test_names($message) > + } > } > > # Arrange for CHECK_TEST_NAMES to be called. > @@ -58,6 +77,7 @@ set local_record_procs(unsupported) "check_test_names" > rename log_summary original_log_summary > proc log_summary { args } { > global paths_in_test_names > + global duplicate_test_names_seen > > # If ARGS is the empty list then we don't want to pass a single > # empty string as a parameter here. > @@ -66,6 +86,10 @@ proc log_summary { args } { > if { $paths_in_test_names > 0 } { > clone_output "# of paths in test names\t${paths_in_test_names}" > } > + > + if { $duplicate_test_names_seen > 0 } { > + clone_output "# of duplicate test names\t${duplicate_test_names_seen}" > + } > } > > # Wrapper around the global Dejagnu RESET_VARS procedure, resets our > @@ -73,7 +97,12 @@ proc log_summary { args } { > rename reset_vars original_reset_vars > proc reset_vars {} { > global paths_in_test_names > + global all_test_names > + global duplicate_test_names_seen > > original_reset_vars > + > set paths_in_test_names 0 > + unset all_test_names > + set duplicate_test_names_seen 0 > } >