From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 77A13385DC0B for ; Thu, 23 Apr 2020 17:54:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77A13385DC0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x436.google.com with SMTP id f13so7832555wrm.13 for ; Thu, 23 Apr 2020 10:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=95Sq3/bJse+0qE38eGW8g6eS1h3++eFr3sdrrepR6GA=; b=Idh5hzy18kJM71tDv2+vLR8CduWpwlCIhF0IPkRc9pjwwvRI1+FBxKhQ6ul42o2Z5o usE7jABoxrELfCH6FJCXtUCGnZXMAJyojuWtmomTNmYOqamYGbMZrw67LsrUmdzU4DJ+ ozrclVRNi088Cuu2mxJHEF8TxAmhoT5BIvD/arp6e+eH7WKEC7cUmnY/bFfva8zUBluj YtNlafcPI18udIoID2QhfLz1+e/G/xxwF+8jTY5EfJoJyRr7+m+Wfs2GCUimD+5OG801 pqdNU71W2WCA3Yx09XvvqTtfP2MZQSxC3d89N8H0blK9siOx71qCoxytjJCE4jiTY8WO Y1Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=95Sq3/bJse+0qE38eGW8g6eS1h3++eFr3sdrrepR6GA=; b=o98rIqAhM6kcoQgIIUDb6eOJq5mb2zvg4z/UXJwRo5FbQyM6QpSN4SngGXKR5j70nA CMD8hNMU87DdzGwllUBMjgp7m6K+Mbl6lfWbHEoCzaViAxlfZuHL2NF5ARH0jdUuHOFo rqKmO4+jAGeuFG3A9vzM82UeFu8X+R9RBAitoRpfVN+jw/ya8ds9troMd05K960VnFBd 7RzxSTLrB1DrJpkqlJPZJlD0YfeCLd4VEWkKBMGx8WYiyiVhtrYEGmmDVGOqCD/Q6qJL txD2A7TOug7u9f6EoZ3HEUXyBT/v0kxhPDbgLPFigPCRpaSmwvk34QGeHFrfWs/l1e+b /s/Q== X-Gm-Message-State: AGi0PuaeNkm9SA8JAmbncRJb75Rzux+fOcqVx3N2CSwK++tGSxAd8A1H k18gHYCQqwUB7jwx2S4LkF3uM8WlbPY= X-Google-Smtp-Source: APiQypIYMPQyOTlcOIbeGhiOYN6nYf5rhVtbc3a9Y619JQcmPC4JtF7ZEXL3OavPcVfJSdn1Yql/yg== X-Received: by 2002:a05:6000:1008:: with SMTP id a8mr6340330wrx.189.1587664446155; Thu, 23 Apr 2020 10:54:06 -0700 (PDT) Received: from localhost (host81-151-181-184.range81-151.btcentralplus.com. [81.151.181.184]) by smtp.gmail.com with ESMTPSA id d13sm4462609wmb.39.2020.04.23.10.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 10:54:05 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 3/4] gdb/testsuite: Detect and warn about duplicate test names Date: Thu, 23 Apr 2020 18:53:57 +0100 Message-Id: <6f747a57bd458c013a6f61452e568c30a85cf9a4.1587663712.git.andrew.burgess@embecosm.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-24.0 required=5.0 tests=BAYES_00, 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, 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 17:54:08 -0000 Spots when tests reuse the same test name and prints a new result type '# of duplicate test names' in the result summary. 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. gdb/testsuite/ChangeLog: * lib/check-test-names.exp (all_test_names): New global. (duplicate_test_names_seen): New global. (check_test_names): Check for duplicate test names. (log_summary): Warn about duplicate test names. (reset_vars): Reset counters for duplicate test names. --- gdb/testsuite/ChangeLog | 8 +++++++ gdb/testsuite/lib/check-test-names.exp | 29 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) 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 } -- 2.25.3