From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KEkXCaucmF8mUgAAWB0awg (envelope-from ) for ; Tue, 27 Oct 2020 18:18:19 -0400 Received: by simark.ca (Postfix, from userid 112) id 230D41EFBB; Tue, 27 Oct 2020 18:18:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8390E1E590 for ; Tue, 27 Oct 2020 18:18:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48D353851C09; Tue, 27 Oct 2020 22:18:18 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 7C5473851C09 for ; Tue, 27 Oct 2020 22:18:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7C5473851C09 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 926F1AC2F for ; Tue, 27 Oct 2020 22:18:14 +0000 (UTC) Date: Tue, 27 Oct 2020 23:18:13 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix DUPLICATEs in gdb.base/multi-forks.exp Message-ID: <20201027221811.GA23354@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.base/multi-forks.exp I get: ... DUPLICATE: gdb.base/multi-forks.exp: run to exit 2 DUPLICATE: gdb.base/multi-forks.exp: run to exit 2 ... Fix these by using test_with_prefix. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix DUPLICATEs in gdb.base/multi-forks.exp --- gdb/testsuite/gdb.base/multi-forks.exp | 46 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index 59d953b04d..8aa349bc11 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -104,26 +104,32 @@ proc continue_to_exit_bp_loc {} { # zero means to take the child's branch; a pid means to take the # parent's branch. -# First set gdb to follow the child. -# The result should be that each of the 4 forks returns zero. - -clean_restart ${binfile} -runto_main -gdb_test_no_output "set follow-fork child" -continue_to_exit_bp_loc - -gdb_test "print pids" "\\$.* = \\{0, 0, 0, 0\\}.*" "follow child, print pids" - -# Now set gdb to follow the parent. -# Result should be that none of the 4 forks returns zero. - -clean_restart ${binfile} -runto_main -gdb_test_no_output "set follow-fork parent" "" -continue_to_exit_bp_loc - -gdb_test "print pids\[0\]==0 || pids\[1\]==0 || pids\[2\]==0 || pids\[3\]==0" \ - " = 0" "follow parent, print pids" +foreach mode { "child" "parent" } { + clean_restart ${binfile} + runto_main + + gdb_test_no_output "set follow-fork $mode" + with_test_prefix "follow $mode" { + continue_to_exit_bp_loc + + set test "print pids" + if { $mode eq "child" } { + # Gdb is set to follow the child. + # The result should be that each of the 4 forks returns zero. + gdb_test "print pids" "\\$.* = \\{0, 0, 0, 0\\}.*" $test + } else { + # Gdb is set to follow the parent. + # Result should be that none of the 4 forks returns zero. + set val \ + [join [list \ + "pids\[0\]==0" \ + "pids\[1\]==0" \ + "pids\[2\]==0" \ + "pids\[3\]==0"] " || "] + gdb_test "print $val" " = 0" $test + } + } +} # # Now test with detach-on-fork off.