public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/2] [gdb/testsuite] Fix test names in gdb.base/longjmp.exp
Date: Tue,  6 Dec 2022 12:02:11 +0100	[thread overview]
Message-ID: <20221206110211.20786-2-tdevries@suse.de> (raw)
In-Reply-To: <20221206110211.20786-1-tdevries@suse.de>

When running test-case gdb.base/longjmp.exp, we have:
...
PASS: gdb.base/longjmp.exp: next over setjmp (1)
  ...
PASS: gdb.base/longjmp.exp: next over setjmp (2)
...

The trailing " (1)" and " (2)" are interpreted as comments rather than parts
of the test name, and therefore this is a duplicate, which is currently not
detected by our duplicate detection mechanism (PR testsuite/29772).

Fix the duplicate by using with_test_prefix.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.base/longjmp.exp | 111 ++++++++++++++++-------------
 1 file changed, 63 insertions(+), 48 deletions(-)

diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp
index bd2fc21a442..10e440bfca8 100644
--- a/gdb/testsuite/gdb.base/longjmp.exp
+++ b/gdb/testsuite/gdb.base/longjmp.exp
@@ -42,30 +42,35 @@ set bp_start_test_3 [gdb_get_line_number "patt3"]
 # Pattern 1 - simple longjmp.
 #
 
-delete_breakpoints
-
-gdb_test "break $bp_start_test_1" \
-    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_1.*" \
-    "breakpoint at pattern 1 start"
-gdb_test "continue" "patt1.*" "continue to breakpoint at pattern 1 start"
-
-# set safe-net break
-gdb_test "break $bp_miss_step_1" \
-    "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_1.*" \
-    "breakpoint at miss_step_1"
-
-gdb_test "next" "longjmps\\+\\+;.*" "next over setjmp (1)"
-gdb_test "next" "longjmp \\(env, 1\\);.*" "next to longjmp (1)"
-
-set msg "next over longjmp(1)"
-gdb_test_multiple "next" $msg {
-    -re ".*patt1.*$gdb_prompt $" {
-	pass $msg
-	gdb_test "next" "resumes\\+\\+.*" "next into else block (1)"
-	gdb_test "next" "miss_step_1.*" "next into safety net (1)"
+with_test_prefix "pattern 1" {
+
+    with_test_prefix setup {
+	delete_breakpoints
+
+	gdb_test "break $bp_start_test_1" \
+	    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_1.*" \
+	    "breakpoint at pattern start"
+	gdb_test "continue" "patt1.*" "continue to breakpoint at pattern start"
+
+	# set safe-net break
+	gdb_test "break $bp_miss_step_1" \
+	    "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_1.*" \
+	    "breakpoint at safety net"
     }
-    -re "miss_step_1.*$gdb_prompt $" {
-	fail $msg
+
+    gdb_test "next" "longjmps\\+\\+;.*" "next over setjmp"
+    gdb_test "next" "longjmp \\(env, 1\\);.*" "next to longjmp"
+
+    set msg "next over longjmp"
+    gdb_test_multiple "next" $msg {
+	-re ".*patt1.*$gdb_prompt $" {
+	    pass $msg
+	    gdb_test "next" "resumes\\+\\+.*" "next into else block"
+	    gdb_test "next" "miss_step_1.*" "next into safety net"
+	}
+	-re "miss_step_1.*$gdb_prompt $" {
+	    fail $msg
+	}
     }
 }
 
@@ -73,30 +78,35 @@ gdb_test_multiple "next" $msg {
 # Pattern 2 - longjmp from an inner function.
 #
 
-delete_breakpoints
+with_test_prefix "pattern 2" {
+
+    with_test_prefix setup {
+	delete_breakpoints
 
-gdb_test "break $bp_start_test_2" \
-    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_2.*" \
-    "breakpoint at pattern 2 start"
-gdb_test "continue" "patt2.*" "continue to breakpoint at pattern 2 start"
+	gdb_test "break $bp_start_test_2" \
+	    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_2.*" \
+	    "breakpoint at pattern start"
+	gdb_test "continue" "patt2.*" "continue to breakpoint at pattern start"
 
-# set safe-net break
-gdb_test "break $bp_miss_step_2" \
-    "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_2.*" \
-    "breakpoint at miss_step_2"
+	# set safe-net break
+	gdb_test "break $bp_miss_step_2" \
+	    "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_2.*" \
+	    "breakpoint at safety net"
+    }
 
-gdb_test "next" "call_longjmp.*" "next over setjmp (2)"
+    gdb_test "next" "call_longjmp.*" "next over setjmp"
 
-set msg "next over call_longjmp (2)"
-gdb_test_multiple "next" $msg {
-    -re ".*patt2.*$gdb_prompt $" {
-	pass $msg
+    set msg "next over call_longjmp"
+    gdb_test_multiple "next" $msg {
+	-re ".*patt2.*$gdb_prompt $" {
+	    pass $msg
 
-	gdb_test "next" "resumes\\+\\+.*" "next into else block (2)"
-	gdb_test "next" "miss_step_2.*" "next into safety net (2)"
-    }
-    -re "miss_step_2.*$gdb_prompt $" {
-	fail $msg
+	    gdb_test "next" "resumes\\+\\+.*" "next into else block"
+	    gdb_test "next" "miss_step_2.*" "next into safety net"
+	}
+	-re "miss_step_2.*$gdb_prompt $" {
+	    fail $msg
+	}
     }
 }
 
@@ -104,11 +114,16 @@ gdb_test_multiple "next" $msg {
 # Pattern 3 - setjmp/longjmp inside stepped-over function.
 #
 
-delete_breakpoints
+with_test_prefix "pattern 3" {
 
-gdb_test "break $bp_start_test_3" \
-    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_3.*" \
-    "breakpoint at pattern 3 start"
-gdb_test "continue" "patt3.*" "continue to breakpoint at pattern 3 start"
+    with_test_prefix setup {
+	delete_breakpoints
 
-gdb_test "next" "longjmp caught.*" "next over patt3"
+	gdb_test "break $bp_start_test_3" \
+	    "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_3.*" \
+	    "breakpoint at pattern start"
+	gdb_test "continue" "patt3.*" "continue to breakpoint at pattern start"
+    }
+
+    gdb_test "next" "longjmp caught.*" "next over pattern"
+}
-- 
2.35.3


      reply	other threads:[~2022-12-06 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 11:02 [pushed 1/2] [gdb/testsuite] Make gdb.base/longjmp.exp FAIL more stable across archs Tom de Vries
2022-12-06 11:02 ` Tom de Vries [this message]

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=20221206110211.20786-2-tdevries@suse.de \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).