Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix DUPLICATEs in gdb.base/multi-forks.exp
Date: Tue, 27 Oct 2020 23:18:13 +0100	[thread overview]
Message-ID: <20201027221811.GA23354@delia> (raw)

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.

                 reply	other threads:[~2020-10-27 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027221811.GA23354@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox