This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gdb.btrace/*.exp: Make test names unique


This patch makes the btrace test names unique.  I was trying to
understand why rn-dl-bind.exp fails on my machine, and saw that it
failed at test "next".  Given that there are multiple "next" in that
test, it's hard to know which one doesn't work.

In most cases, I simply added a "#N" suffix to the test cases, since I
couldn't find a more appropriate name from the context.

For the record, I still don't know why rt-dl-bind.exp fails, but I don't
intend to spend more time on it (at least for now).

gdb/testsuite/ChangeLog:

	* gdb.btrace/data.exp: Make test names unique.
	* gdb.btrace/delta.exp: Likewise.
	* gdb.btrace/enable.exp: Likewise.
	* gdb.btrace/function_call_history.exp: Likewise.
	* gdb.btrace/nohist.exp: Likewise.
	* gdb.btrace/non-stop.exp: Likewise.
	* gdb.btrace/rn-dl-bind.exp: Likewise.
	* gdb.btrace/step.exp: Likewise.
	* gdb.btrace/stepi.exp: Likewise.
	* gdb.btrace/tailcall.exp: Likewise.
---
 gdb/testsuite/gdb.btrace/data.exp                  | 24 ++++++++-----
 gdb/testsuite/gdb.btrace/delta.exp                 | 10 +++---
 gdb/testsuite/gdb.btrace/enable.exp                |  4 +--
 gdb/testsuite/gdb.btrace/function_call_history.exp |  4 +--
 gdb/testsuite/gdb.btrace/nohist.exp                |  9 ++---
 gdb/testsuite/gdb.btrace/non-stop.exp              | 36 +++++++++++++------
 gdb/testsuite/gdb.btrace/rn-dl-bind.exp            | 14 ++++----
 gdb/testsuite/gdb.btrace/step.exp                  | 16 ++++-----
 gdb/testsuite/gdb.btrace/stepi.exp                 | 42 +++++++++++-----------
 gdb/testsuite/gdb.btrace/tailcall.exp              | 12 +++----
 10 files changed, 97 insertions(+), 74 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/data.exp b/gdb/testsuite/gdb.btrace/data.exp
index f39b24f..2561099 100644
--- a/gdb/testsuite/gdb.btrace/data.exp
+++ b/gdb/testsuite/gdb.btrace/data.exp
@@ -37,17 +37,25 @@ gdb_test "next" ".*main\.3.*"
 gdb_test "reverse-step" ".*test\.4.*"
 
 # we can't read memory while we're replaying
-gdb_test "print glob" "unavailable\[^\\\r\\\n\]*"
-gdb_test "print loc" "unavailable\[^\\\r\\\n\]*"
+with_test_prefix "replaying, replay-memory-access = default" {
+    gdb_test "print glob" "unavailable\[^\\\r\\\n\]*"
+    gdb_test "print loc" "unavailable\[^\\\r\\\n\]*"
+}
 
 # we can read memory if we explicitly allow it.
-gdb_test_no_output "set record btrace replay-memory-access read-write"
-gdb_test "print glob" "1"
+with_test_prefix "replaying, replay-memory-access = read-write" {
+    gdb_test_no_output "set record btrace replay-memory-access read-write"
+    gdb_test "print glob" "1"
+}
 
 # we can't if we don't explicitly allow it.
-gdb_test_no_output "set record btrace replay-memory-access read-only"
-gdb_test "print glob" "unavailable\[^\\\r\\\n\]*"
+with_test_prefix "replaying, replay-memory-access = read-only" {
+    gdb_test_no_output "set record btrace replay-memory-access read-only"
+    gdb_test "print glob" "unavailable\[^\\\r\\\n\]*"
+}
 
 # stop replaying and try again
-gdb_test "record goto end" ".*main\.3.*"
-gdb_test "print glob" "1"
+with_test_prefix "live" {
+    gdb_test "record goto end" ".*main\.3.*"
+    gdb_test "print glob" "1"
+}
diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp
index c9dbf38..c822400 100644
--- a/gdb/testsuite/gdb.btrace/delta.exp
+++ b/gdb/testsuite/gdb.btrace/delta.exp
@@ -47,7 +47,7 @@ with_test_prefix "no trace" {
 }
 
 # we record each single-step, even if we have not seen a branch, yet.
-gdb_test "stepi"
+gdb_test "stepi" "main\.4.*" "stepi #1"
 
 proc check_trace {} {
   gdb_test "info record" [multi_line \
@@ -70,18 +70,18 @@ with_test_prefix "twice" {
 }
 
 # check that we can reverse-stepi that instruction
-gdb_test "reverse-stepi"
+gdb_test "reverse-stepi" "main\.3.*"
 gdb_test "info record" [multi_line \
   "Active record target: record-btrace" \
   "Recording format: .*" \
   "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \
   "Replay in progress\.  At instruction 1\." \
-  ] "reverse-stepi"
+  ] "info record #1"
 
 # and back
-gdb_test "stepi"
+gdb_test "stepi" "main\.4.*" "stepi #2"
 gdb_test "info record" [multi_line \
   "Active record target: record-btrace" \
   "Recording format: .*" \
   "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \
-  ] "and back"
+  ] "info record #2"
diff --git a/gdb/testsuite/gdb.btrace/enable.exp b/gdb/testsuite/gdb.btrace/enable.exp
index fd63006..fec26db 100644
--- a/gdb/testsuite/gdb.btrace/enable.exp
+++ b/gdb/testsuite/gdb.btrace/enable.exp
@@ -45,7 +45,7 @@ if ![runto_main] {
 }
 
 # enable btrace
-gdb_test_no_output "record btrace" "record btrace"
+gdb_test_no_output "record btrace" "record btrace #1"
 gdb_test "record function-call-history" "No trace\\." "record function-call-history without trace"
 gdb_test "record instruction-history" "No trace\\." "record instruction-history without trace"
 
@@ -90,7 +90,7 @@ clean_restart $testfile
 if ![runto_main] {
     return -1
 }
-gdb_test_no_output "record btrace"
+gdb_test_no_output "record btrace" "record btrace #2"
 if ![runto_main] {
     return -1
 }
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp
index 7d1e4049..53fd239 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.exp
+++ b/gdb/testsuite/gdb.btrace/function_call_history.exp
@@ -30,7 +30,7 @@ if ![runto_main] {
 }
 
 # start btrace
-gdb_test_no_output "record btrace"
+gdb_test_no_output "record btrace" "record btrace #1"
 
 # set bp after increment loop and continue
 set bp_location [gdb_get_line_number "bp.1" $testfile.c]
@@ -236,7 +236,7 @@ gdb_continue_to_breakpoint "cont to fib.3"
 gdb_continue_to_breakpoint "cont to fib.4"
 
 # start tracing
-gdb_test_no_output "record btrace"
+gdb_test_no_output "record btrace" "record btrace #2"
 
 # continue until line 30 above
 delete_breakpoints
diff --git a/gdb/testsuite/gdb.btrace/nohist.exp b/gdb/testsuite/gdb.btrace/nohist.exp
index b309218..946ad45 100644
--- a/gdb/testsuite/gdb.btrace/nohist.exp
+++ b/gdb/testsuite/gdb.btrace/nohist.exp
@@ -30,18 +30,19 @@ if ![runto_main] {
     return -1
 }
 
-proc check_not_replaying {} {
+proc check_not_replaying { test } {
   gdb_test "info record" [multi_line \
     "Active record target: record-btrace" \
     "Recording format: .*" \
 	"Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
-    ]
+    ] \
+    $test
 }
 
 gdb_test_no_output "record btrace"
 
-check_not_replaying
+check_not_replaying "check not replaying #1"
 
 gdb_test "reverse-continue" "No more reverse-execution history\.\r\n.*"
 
-check_not_replaying
+check_not_replaying "check not replaying #2"
diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp b/gdb/testsuite/gdb.btrace/non-stop.exp
index 0d5cbe2..71a6aba 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.exp
+++ b/gdb/testsuite/gdb.btrace/non-stop.exp
@@ -92,9 +92,13 @@ proc gdb_cont_to_no_history { threads cmd nthreads } {
 }
 
 # trace the code between the two breakpoints
-gdb_cont_to_bp_line "$srcfile:$bp_1" all 2
+with_test_prefix "continue to breakpoint 1" {
+    gdb_cont_to_bp_line "$srcfile:$bp_1" all 2
+}
 gdb_test_no_output "record btrace"
-gdb_cont_to_bp_line "$srcfile:$bp_2" all 2
+with_test_prefix "continue to breakpoint 2" {
+    gdb_cont_to_bp_line "$srcfile:$bp_2" all 2
+}
 
 # we don't need those breakpoints any longer.
 # they will only disturb our stepping.
@@ -104,14 +108,16 @@ delete_breakpoints
 gdb_test "thread apply all info rec" ".*"
 gdb_test "info threads" ".*"
 
-with_test_prefix "navigate" {
+with_test_prefix "navigate #1" {
     gdb_test "thread apply 1 record goto 2" "$loop_line"
     gdb_test "thread apply 2 record goto 4" "$loop_line"
     gdb_test "thread apply 1 info record" \
         ".*Replay in progress\.  At instruction 2\."
     gdb_test "thread apply 2 info record" \
         ".*Replay in progress\.  At instruction 4\."
+}
 
+with_test_prefix "navigate #2" {
     gdb_test "thread apply all record goto 5" "$loop_line"
     gdb_test "thread apply 1 info record" \
         ".*Replay in progress\.  At instruction 5\."
@@ -175,29 +181,37 @@ with_test_prefix "continue" {
     with_test_prefix "thread 1" {
         gdb_cont_to_no_history 1 "continue" 1
         gdb_test "thread apply 1 info record" \
-            ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
+            ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" \
+            "thread apply 1 info record #1"
         gdb_test "thread apply 2 info record" \
-            ".*Replay in progress\.  At instruction 5\."
+            ".*Replay in progress\.  At instruction 5\." \
+            "thread apply 2 info record #1"
 
         gdb_cont_to_no_history 1 "reverse-continue" 1
         gdb_test "thread apply 1 info record" \
-            ".*Replay in progress\.  At instruction 1\."
+            ".*Replay in progress\.  At instruction 1\." \
+            "thread apply 1 info record #2"
         gdb_test "thread apply 2 info record" \
-            ".*Replay in progress\.  At instruction 5\."
+            ".*Replay in progress\.  At instruction 5\." \
+            "thread apply 2 info record #2"
     }
 
     with_test_prefix "thread 2" {
         gdb_cont_to_no_history 2 "continue" 1
         gdb_test "thread apply 1 info record" \
-            ".*Replay in progress\.  At instruction 1\."
+            ".*Replay in progress\.  At instruction 1\." \
+            "thread apply 1 info record #1"
         gdb_test "thread apply 2 info record" \
-            ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*"
+            ".*Recorded \[0-9\]+ instructions \[^\\\r\\\n\]*" \
+            "thread apply 2 info record #1"
 
         gdb_cont_to_no_history 2 "reverse-continue" 1
         gdb_test "thread apply 1 info record" \
-            ".*Replay in progress\.  At instruction 1\."
+            ".*Replay in progress\.  At instruction 1\." \
+            "thread apply 1 info record #2"
         gdb_test "thread apply 2 info record" \
-            ".*Replay in progress\.  At instruction 1\."
+            ".*Replay in progress\.  At instruction 1\." \
+            "thread apply 2 info record #2"
     }
 }
 
diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
index 0f92975..0c3033e 100644
--- a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
@@ -35,18 +35,18 @@ if ![runto_main] {
 
 # trace the code for the call to test
 gdb_test_no_output "record btrace"
-gdb_test "next" ".*main\.2.*"
+gdb_test "next" ".*main\.2.*" "next #1"
 
 # just dump the function-call-history to help debugging
 gdb_test_no_output "set record function-call-history-size 0"
 gdb_test "record function-call-history /cli 1" ".*"
 
 # check that we can reverse-next and next
-gdb_test "reverse-next" ".*main\.1.*"
-gdb_test "next" ".*main\.2.*"
+gdb_test "reverse-next" ".*main\.1.*" "reverse-next #1"
+gdb_test "next" ".*main\.2.*" "next #2"
 
 # now go into test and try to reverse-next and next over the library call
-gdb_test "reverse-step" ".*test\.3.*"
-gdb_test "reverse-step" ".*test\.2.*"
-gdb_test "reverse-next" ".*test\.1.*"
-gdb_test "next" ".*test\.2.*"
+gdb_test "reverse-step" ".*test\.3.*" "reverse-step #1"
+gdb_test "reverse-step" ".*test\.2.*" "reverse-step #2"
+gdb_test "reverse-next" ".*test\.1.*" "reverse-next #2"
+gdb_test "next" ".*test\.2.*" "next #3"
diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp
index 1122ff1..e3ccb45 100644
--- a/gdb/testsuite/gdb.btrace/step.exp
+++ b/gdb/testsuite/gdb.btrace/step.exp
@@ -33,15 +33,15 @@ if ![runto_main] {
 
 # trace the call to the test function
 gdb_test_no_output "record btrace"
-gdb_test "next"
+gdb_test "next" ".*main\.3.*" "next #1"
 
 # let's step around a bit
-gdb_test "reverse-next" ".*main\.2.*"
-gdb_test "step" ".*fun4\.2.*"
-gdb_test "next" ".*fun4\.3.*"
-gdb_test "step" ".*fun2\.2.*"
+gdb_test "reverse-next" ".*main\.2.*" "reverse-next #1"
+gdb_test "step" ".*fun4\.2.*" "step #1"
+gdb_test "next" ".*fun4\.3.*" "next #2"
+gdb_test "step" ".*fun2\.2.*" "step #2"
 gdb_test "finish" ".*fun4\.4.*"
 gdb_test "reverse-step" ".*fun2\.3.*"
-gdb_test "reverse-finish" ".*fun4\.3.*"
-gdb_test "reverse-next" ".*fun4\.2.*"
-gdb_test "reverse-finish" ".*main\.2.*"
+gdb_test "reverse-finish" ".*fun4\.3.*" "reverse-finish #1"
+gdb_test "reverse-next" ".*fun4\.2.*" "reverse-next #2"
+gdb_test "reverse-finish" ".*main\.2.*" "reverse-finish #2"
diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp
index b21e4e5..54cde46 100644
--- a/gdb/testsuite/gdb.btrace/stepi.exp
+++ b/gdb/testsuite/gdb.btrace/stepi.exp
@@ -67,18 +67,18 @@ gdb_test_no_output "record btrace"
 gdb_test "next"
 
 # we start with stepping to make sure that the trace is fetched automatically
-gdb_test "reverse-stepi" ".*fun4\.5.*"
-gdb_test "reverse-stepi" ".*fun4\.5.*"
+gdb_test "reverse-stepi" ".*fun4\.5.*" "reverse-stepi #1"
+gdb_test "reverse-stepi" ".*fun4\.5.*" "reverse-stepi #2"
 
 # let's check where we are in the trace
 with_test_prefix "reverse-stepi to 39" { check_replay_at 39 }
 
 # let's step forward and check again
-gdb_test "stepi" ".*fun4\.5.*"
+gdb_test "stepi" ".*fun4\.5.*" "stepi #1"
 with_test_prefix "stepi to 40" { check_replay_at 40 }
 
 # with the next step, we stop replaying
-gdb_test "stepi" ".*main\.3.*"
+gdb_test "stepi" ".*main\.3.*" "stepi #2"
 gdb_test "info record" [multi_line \
   "Active record target: record-btrace" \
   ".*" \
@@ -86,12 +86,12 @@ gdb_test "info record" [multi_line \
   ] "stepi to live"
 
 # let's try nexti
-gdb_test "reverse-nexti" ".*main\.2.*"
-with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+gdb_test "reverse-nexti" ".*main\.2.*" "reverse-nexti #1"
+with_test_prefix "reverse-nexti - 1 #1" { check_replay_at 1 }
 
 # we can't reverse-nexti any further
-gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
-with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-nexti #2"
+with_test_prefix "reverse-nexti - 1 #2" { check_replay_at 1 }
 
 # but we can step back again
 gdb_test "nexti" ".*main\.3.*" "next, 1.5"
@@ -105,36 +105,36 @@ gdb_test "info record" [multi_line \
 gdb_test "record goto 22" ".*fun3\.2.*"
 with_test_prefix "goto 22" { check_replay_at 22 }
 
-gdb_test "stepi" ".*fun1\.1.*"
+gdb_test "stepi" ".*fun1\.1.*" "stepi #3"
 with_test_prefix "stepi to 23" { check_replay_at 23 }
 
-gdb_test "reverse-stepi" ".*fun3\.2.*"
+gdb_test "reverse-stepi" ".*fun3\.2.*" "reverse-stepi #3"
 with_test_prefix "reverse-stepi to 22" { check_replay_at 22 }
 
 gdb_test "nexti" ".*fun3\.3.*"
 with_test_prefix "nexti to 27" { check_replay_at 27 }
 
-gdb_test "reverse-nexti" ".*fun3\.2.*"
+gdb_test "reverse-nexti" ".*fun3\.2.*" "reverse-nexti #3"
 with_test_prefix "reverse-nexti to 22" { check_replay_at 22 }
 
 # let's try to step off the left end
 gdb_test "record goto begin" ".*main\.2.*"
 with_test_prefix "goto begin" { check_replay_at 1 }
 
-gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
-gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
-with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-stepi #4"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-stepi #5"
+with_test_prefix "reverse-stepi at begin #1" { check_replay_at 1 }
 
-gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
-gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-nexti #4"
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-nexti #5"
 with_test_prefix "reverse-nexti at begin" { check_replay_at 1 }
 
 # we can step forward, though
-gdb_test "stepi" ".*fun4\.1.*"
+gdb_test "stepi" ".*fun4\.1.*" "stepi #4"
 with_test_prefix "stepi to 2" { check_replay_at 2 }
 
 # let's try to step off the left end again
-gdb_test "reverse-stepi" ".*main\.2.*"
-gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
-gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
-with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
+gdb_test "reverse-stepi" ".*main\.2.*" "reverse-stepi #6"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-stepi #7"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" "reverse-stepi #8"
+with_test_prefix "reverse-stepi at begin #2" { check_replay_at 1 }
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index bc8afc4..822aec2 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -90,13 +90,13 @@ gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main"
 gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo"
 
 # test stepping into and out of tailcalls.
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*"
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" "finish #1"
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" "reverse-step #1"
 gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*"
-gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*"
+gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "reverse-step #2"
 gdb_test "next" "\[^\r\n\]*38.*"
 gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*"
 gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*"
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" "finish #2"
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" "reverse-step #3"
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" "finish #3"
-- 
2.9.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]