[gdb/testsuite] Fix test names in gdb.base/longjmp.exp

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.
This commit is contained in:
Tom de Vries
2022-12-06 12:01:46 +01:00
parent 6e41445bb0
commit 8db40179f0

View File

@ -42,30 +42,35 @@ set bp_start_test_3 [gdb_get_line_number "patt3"]
# Pattern 1 - simple longjmp. # Pattern 1 - simple longjmp.
# #
delete_breakpoints with_test_prefix "pattern 1" {
gdb_test "break $bp_start_test_1" \ with_test_prefix setup {
"Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_1.*" \ delete_breakpoints
"breakpoint at pattern 1 start"
gdb_test "continue" "patt1.*" "continue to breakpoint at pattern 1 start"
# set safe-net break gdb_test "break $bp_start_test_1" \
gdb_test "break $bp_miss_step_1" \ "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_1.*" \
"Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_1.*" \ "breakpoint at pattern start"
"breakpoint at miss_step_1" gdb_test "continue" "patt1.*" "continue to breakpoint at pattern start"
gdb_test "next" "longjmps\\+\\+;.*" "next over setjmp (1)" # set safe-net break
gdb_test "next" "longjmp \\(env, 1\\);.*" "next to longjmp (1)" gdb_test "break $bp_miss_step_1" \
"Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_1.*" \
set msg "next over longjmp(1)" "breakpoint at safety net"
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)"
} }
-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. # Pattern 2 - longjmp from an inner function.
# #
delete_breakpoints with_test_prefix "pattern 2" {
gdb_test "break $bp_start_test_2" \ with_test_prefix setup {
"Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_2.*" \ delete_breakpoints
"breakpoint at pattern 2 start"
gdb_test "continue" "patt2.*" "continue to breakpoint at pattern 2 start"
# set safe-net break gdb_test "break $bp_start_test_2" \
gdb_test "break $bp_miss_step_2" \ "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_2.*" \
"Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_2.*" \ "breakpoint at pattern start"
"breakpoint at miss_step_2" gdb_test "continue" "patt2.*" "continue to breakpoint at pattern start"
gdb_test "next" "call_longjmp.*" "next over setjmp (2)" # set safe-net break
gdb_test "break $bp_miss_step_2" \
set msg "next over call_longjmp (2)" "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_2.*" \
gdb_test_multiple "next" $msg { "breakpoint at safety net"
-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" "call_longjmp.*" "next over setjmp"
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"
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. # Pattern 3 - setjmp/longjmp inside stepped-over function.
# #
delete_breakpoints with_test_prefix "pattern 3" {
gdb_test "break $bp_start_test_3" \ with_test_prefix setup {
"Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_3.*" \ delete_breakpoints
"breakpoint at pattern 3 start"
gdb_test "continue" "patt3.*" "continue to breakpoint at pattern 3 start"
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"
}