From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id B3C69393BC35 for ; Mon, 27 Apr 2020 22:01:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B3C69393BC35 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-wm1-x32f.google.com with SMTP id k12so572509wmj.3 for ; Mon, 27 Apr 2020 15:01:53 -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=Z79hjXNBIxMD0gmkhZ5N3QtnP+fctJtev+TJIUbkgRM=; b=C6BPObNzDAi3xPda+AJZL4c+z2ubz8jC4czeRqcesHrp4DlWQtxikU6BfxYF+UA7KX NXVF4hNHgSQgx+tzqeBz9dg12HplYNn43VxWoXzDZ87C+fVP/jhDMN+vcQ9boga9G0G+ qvqr16d7hwFSEV6maV6gRPxER0TCjRJ7oOcxv80SDPuFFdDhBX+Ar0y8pMIAKvH4kzzZ 8ZDRHo0E7avNrfdCGinIr5f4afMAoWCa8RAG3R0b0nOg2erlA5uVmLUTrN7zC7ZZboMD ZNV4XmGFuggHKHIsMO3KX1ybchzXuLEYbEhH1nHz3zTuo3e64BpyB38e6tYBBtR16JOR o/5w== 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=Z79hjXNBIxMD0gmkhZ5N3QtnP+fctJtev+TJIUbkgRM=; b=odsrZKZiGIRk5ax8gUQgGE3zpll9YhTsToOmcSQy89vS4RuuWLq4iGyhpGGTf9hQgQ wmxigfjU1g3bIYUy0yJjzgyK+tCrsvrTOZIfwkjzZtHk33/bpShMKMeAVvJ1/Kw7Nn2y F13OGt9aEuOAU9F6ghikieIKP09KG7QF3I0Im7DqluxBoW6KixrCCh3Zm9wOUdeo7YtE 9478uMm6l2R21SZess/8AyRwai0UwXIXdhAagsq+SKduPfK9xyzTxo7EJzUGOWozuy5x rjWvltXiHPOYwfEG/oQiAiyNEl/UxrUlhw2/WlO3doYLa0ET2phUBnsGjyd3CNqVXsMS 1RvQ== X-Gm-Message-State: AGi0Pub/XDTUDN4s7NB1a2uhl63aauHI7UfKP8RQovGRaqe+bLdlqmyg k0l3zAeTIBW1bxMWcHwU2Vb1YebFfwk= X-Google-Smtp-Source: APiQypIY5K0O/zfyYq40wMkj5HJq57TpvEkBgbqC0v3PKXC6bqqQCmjpP/rySn2PtAs+GKL6khjLqA== X-Received: by 2002:a1c:7f91:: with SMTP id a139mr841939wmd.164.1588024912494; Mon, 27 Apr 2020 15:01:52 -0700 (PDT) Received: from localhost (host81-151-181-184.range81-151.btcentralplus.com. [81.151.181.184]) by smtp.gmail.com with ESMTPSA id a10sm11971089wrg.32.2020.04.27.15.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 15:01:51 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCHv2 2/3] gdb/testsuite: Detect and warn about duplicate test names Date: Mon, 27 Apr 2020 23:01:45 +0100 Message-Id: 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.1 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: Mon, 27 Apr 2020 22:01:55 -0000 Building on the previous commit, this patch detects when two tests have the same test name and causes Dejagnu to print 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 | 32 +++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp index 702dc6ef406..15c5544c8e4 100644 --- a/gdb/testsuite/lib/check-test-names.exp +++ b/gdb/testsuite/lib/check-test-names.exp @@ -19,13 +19,18 @@ # to compare results between two runs of GDB from different trees. namespace eval ::CheckTestNames { - # An associative array of counts of tests that include a path in their - # test name. There are two counts, 'count', which counts occurrences - # within a single variant run, and 'total', which counts across all - # variants. + # An associative array of all test names to the number of times each + # name is seen. Used to detect duplicate test names. + variable all_test_names + array set all_test_names {} + + # An associative array of counts of tests that either include a path in + # their test name, or have a duplicate test name. There are two counts + # for each issue, 'count', which counts occurrences within a single + # variant run, and 'total', which counts across all variants. variable counts array set counts {} - foreach nm {paths} { + foreach nm {paths duplicates} { set counts($nm,count) 0 set counts($nm,total) 0 } @@ -46,6 +51,7 @@ namespace eval ::CheckTestNames { # incremented. proc check { message } { global srcdir objdir + variable all_test_names foreach path [list $srcdir $objdir] { if { [ string first $path $message ] >= 0 } { @@ -54,6 +60,16 @@ namespace eval ::CheckTestNames { 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} { + inc_count duplicates + } + incr all_test_names($message) + } } # If COUNT is greater than zero, disply PREFIX followed by COUNT. @@ -81,17 +97,21 @@ namespace eval ::CheckTestNames { maybe_show_count "# of paths in test names\t" \ $counts(paths,$which) + maybe_show_count "# of duplicate test names\t" \ + $counts(duplicates,$which) } # Rename Dejagnu's reset_vars procedure, and create do_reset_vars to # replace it. We arrange to have do_reset_vars called later. rename ::reset_vars reset_vars proc do_reset_vars {} { + variable all_test_names variable counts CheckTestNames::reset_vars - foreach nm {paths} { + unset all_test_names + foreach nm {paths duplicates} { set counts($nm,count) 0 } } -- 2.25.3