public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb.btrace/*.exp: Make test names unique
@ 2016-10-03 19:17 Simon Marchi
  2016-10-06  8:44 ` Yao Qi
  2016-10-06 13:58 ` Metzger, Markus T
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Marchi @ 2016-10-03 19:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gdb.btrace/*.exp: Make test names unique
  2016-10-03 19:17 [PATCH] gdb.btrace/*.exp: Make test names unique Simon Marchi
@ 2016-10-06  8:44 ` Yao Qi
  2016-10-06 13:58 ` Metzger, Markus T
  1 sibling, 0 replies; 6+ messages in thread
From: Yao Qi @ 2016-10-06  8:44 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On Mon, Oct 3, 2016 at 8:17 PM, Simon Marchi

Patch is good to me, some nits below,

>  # 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"

Nit, I'd like to move this test out of with_test_prefix block, as it is unique.

> +    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"

Likewise.

> +    gdb_test "print glob" "unavailable\[^\\\r\\\n\]*"
> +}
>

> 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.*"

This doesn't change the test message in gdb.sum, but good
to have it.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] gdb.btrace/*.exp: Make test names unique
  2016-10-03 19:17 [PATCH] gdb.btrace/*.exp: Make test names unique Simon Marchi
  2016-10-06  8:44 ` Yao Qi
@ 2016-10-06 13:58 ` Metzger, Markus T
  2016-10-06 14:32   ` Simon Marchi
  1 sibling, 1 reply; 6+ messages in thread
From: Metzger, Markus T @ 2016-10-06 13:58 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Simon Marchi
> Sent: Monday, October 3, 2016 9:17 PM
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi <simon.marchi@ericsson.com>
> Subject: [PATCH] gdb.btrace/*.exp: Make test names unique

Hi Simon,

Thanks for your patch.


> 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).

On what system are you seeing those fails?


> 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"

I wouldn't count on the stepi landing there.  This is also not relevant for the
test.

I'd rather add test prefixes for the below groups of tests and leave the initial
"next" and "stepi" that move to the relevant code and record the trace as
they are.

I.e. here...

>  # check that we can reverse-stepi that instruction

... and here ...

>  # and back

We also wouldn't need to count the "info record" commands in this case.


> diff --git a/gdb/testsuite/gdb.btrace/enable.exp

Instead of adding a counter here ...

>  # enable btrace
> -gdb_test_no_output "record btrace" "record btrace"
> +gdb_test_no_output "record btrace" "record btrace #1"

... we might want to add a test prefix here ...

> @@ -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"

The bottom of this file from the second "runto_main" is really an
independent test.

We might either prefix the entire test from the second runto_main until
the end of the file or split the file into two.



> diff --git a/gdb/testsuite/gdb.btrace/nohist.exp

> -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"

I think a couple of test prefixes would be more helpful, here.


> diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp

> -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"
>      }

Could we do the same trick you did with the "navigate" tests here, as well?
I.e. split the "continue" tests into sub-groups with separate prefixes.


> 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 }

We could extend the test prefix to cover the stepping command in addition
to the check.  We'd still need to count in a few cases where we need two
identical stepping commands.


Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gdb.btrace/*.exp: Make test names unique
  2016-10-06 13:58 ` Metzger, Markus T
@ 2016-10-06 14:32   ` Simon Marchi
  2016-10-07  7:43     ` Metzger, Markus T
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2016-10-06 14:32 UTC (permalink / raw)
  To: Metzger, Markus T, gdb-patches

Hi Markus,

On 16-10-06 09:58 AM, Metzger, Markus T wrote:
>> 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

(I typo'ed here, it's rn-dl-bind.exp)

>> intend to spend more time on it (at least for now).
> 
> On what system are you seeing those fails?

Distro: Ubuntu 14.04.5 LTS
Kernel: 4.7.0 x86_64
CPU: Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz

Here's the gdb.log, if it can help you.

http://paste.ubuntu.com/23284745/

>> 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"
> 
> I wouldn't count on the stepi landing there.  This is also not relevant for the
> test.
> 
> I'd rather add test prefixes for the below groups of tests and leave the initial
> "next" and "stepi" that move to the relevant code and record the trace as
> they are.

Ok.  Could we test_prefix them with maybe "setup", so it's clear what they're for?

> I.e. here...
> 
>>  # check that we can reverse-stepi that instruction
> 
> ... and here ...
> 
>>  # and back
> 
> We also wouldn't need to count the "info record" commands in this case.

Right, so maybe prefix those blocks with "backwards" and "forward"?

>> diff --git a/gdb/testsuite/gdb.btrace/enable.exp
> 
> Instead of adding a counter here ...
> 
>>  # enable btrace
>> -gdb_test_no_output "record btrace" "record btrace"
>> +gdb_test_no_output "record btrace" "record btrace #1"
> 
> ... we might want to add a test prefix here ...

Perhaps "first record", "second record" and "record after re-run"?

>> @@ -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"
> 
> The bottom of this file from the second "runto_main" is really an
> independent test.
> 
> We might either prefix the entire test from the second runto_main until
> the end of the file or split the file into two.

If they test different aspects of the same feature, it's fine if they are in the same file.
I like to at least separate logically independent tests in procs:

  proc test_some_thing { } {
    ...
  }

  proc test_some_other_thing { } {
    ...
  }

  with_test_prefix "test some thing" { test_some_thing }
  with_test_prefix "test some other thing" { test_some_other_thing }

And as much as possible, have them be independent, meaning that one does not
rely on the state left by the other, so you can comment out all but one, reorder
them, and it would still work.  If you agree with that I can try to modify this
test so it looks like that.

>> diff --git a/gdb/testsuite/gdb.btrace/nohist.exp
> 
>> -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"
> 
> I think a couple of test prefixes would be more helpful, here.

Ok.

>> diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp
> 
>> -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"
>>      }
> 
> Could we do the same trick you did with the "navigate" tests here, as well?
> I.e. split the "continue" tests into sub-groups with separate prefixes.

Do you mean:

with_test_prefix "thread 1" {
  with_test_prefix "continue forward" {
    gdb_cont_to_no_history 1 "continue" 1
    ...
  }

  with_test_prefix "continue backward" {
    gdb_cont_to_no_history 1 "reverse-continue" 1
    ...
  }
}

?

> 
>> 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 }
> 
> We could extend the test prefix to cover the stepping command in addition
> to the check.  We'd still need to count in a few cases where we need two
> identical stepping commands.

I can try that.

Thanks!

Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] gdb.btrace/*.exp: Make test names unique
  2016-10-06 14:32   ` Simon Marchi
@ 2016-10-07  7:43     ` Metzger, Markus T
  2016-10-07 13:04       ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Metzger, Markus T @ 2016-10-07  7:43 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

> -----Original Message-----
> From: Simon Marchi [mailto:simon.marchi@ericsson.com]
> Sent: Thursday, October 6, 2016 4:32 PM
> To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH] gdb.btrace/*.exp: Make test names unique

Hi Simon,

> >> 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.
[...]
> Here's the gdb.log, if it can help you.
> 
> http://paste.ubuntu.com/23284745/

Thanks for sharing the log.  It does help.

You don't have debug information installed, which makes things more
difficult for GDB.  The current tail-call detection heuristic is too aggressive
if there are no symbols available.

I posted a patch some time ago to make it less aggressive in this case:
https://sourceware.org/ml/gdb-patches/2016-07/msg00277.html

This fixes (or hides, if you prefer) the issue you're seeing.  I don't want to
rule out that there might be other cases where we get the call stack wrong
if we don't have symbols available.

Let me ping again for this patch series.


> >> 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"
> >
> > I wouldn't count on the stepi landing there.  This is also not relevant for the
> > test.
> >
> > I'd rather add test prefixes for the below groups of tests and leave the initial
> > "next" and "stepi" that move to the relevant code and record the trace as
> > they are.
> 
> Ok.  Could we test_prefix them with maybe "setup", so it's clear what they're
> for?

Sounds good.  I was suggesting to leave them without but a "setup" test prefix
sounds even better.


> > I.e. here...
> >
> >>  # check that we can reverse-stepi that instruction
> >
> > ... and here ...
> >
> >>  # and back
> >
> > We also wouldn't need to count the "info record" commands in this case.
> 
> Right, so maybe prefix those blocks with "backwards" and "forward"?

OK.


> >> diff --git a/gdb/testsuite/gdb.btrace/enable.exp
> >
> > Instead of adding a counter here ...
> >
> >>  # enable btrace
> >> -gdb_test_no_output "record btrace" "record btrace"
> >> +gdb_test_no_output "record btrace" "record btrace #1"
> >
> > ... we might want to add a test prefix here ...
> 
> Perhaps "first record", "second record" and "record after re-run"?

How about a test prefix "re-run" for the first block from the second
runto_main until the second clean_restart (exclusive) and "re-run, enable"
for the remainder of the file?


> >> 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"
> >
> > The bottom of this file from the second "runto_main" is really an
> > independent test.
> >
> > We might either prefix the entire test from the second runto_main until
> > the end of the file or split the file into two.
> 
> If they test different aspects of the same feature, it's fine if they are in the same
> file.
> I like to at least separate logically independent tests in procs:
> 
>   proc test_some_thing { } {
>     ...
>   }
> 
>   proc test_some_other_thing { } {
>     ...
>   }
> 
>   with_test_prefix "test some thing" { test_some_thing }
>   with_test_prefix "test some other thing" { test_some_other_thing }
> 
> And as much as possible, have them be independent, meaning that one does not
> rely on the state left by the other, so you can comment out all but one, reorder
> them, and it would still work.  If you agree with that I can try to modify this
> test so it looks like that.

I agree in general.  In this case, we have two different recordings and a bunch
of tests for each.  The tests must be different because the recordings are different.
Are you suggesting to add one test prefix around the first group of recording and
tests and another test prefix around the second group?

I'd be OK with that but it sounds like more effort than just splitting the file.


> >> diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp
[...]
> >> @@ -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"
> >>      }
> >
> > Could we do the same trick you did with the "navigate" tests here, as well?
> > I.e. split the "continue" tests into sub-groups with separate prefixes.
> 
> Do you mean:
> 
> with_test_prefix "thread 1" {
>   with_test_prefix "continue forward" {
>     gdb_cont_to_no_history 1 "continue" 1
>     ...
>   }
> 
>   with_test_prefix "continue backward" {
>     gdb_cont_to_no_history 1 "reverse-continue" 1
>     ...
>   }
> }
> 
> ?

Yes.  There's already a test prefix "continue" around the group so you may
just say "forward" and "backward".


Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gdb.btrace/*.exp: Make test names unique
  2016-10-07  7:43     ` Metzger, Markus T
@ 2016-10-07 13:04       ` Simon Marchi
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2016-10-07 13:04 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: Simon Marchi, gdb-patches

On 2016-10-07 03:42, Metzger, Markus T wrote:
>> -----Original Message-----
>> From: Simon Marchi [mailto:simon.marchi@ericsson.com]
>> Sent: Thursday, October 6, 2016 4:32 PM
>> To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
>> patches@sourceware.org
>> Subject: Re: [PATCH] gdb.btrace/*.exp: Make test names unique
> 
> Hi Simon,
> 
>> >> 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.
> [...]
>> Here's the gdb.log, if it can help you.
>> 
>> http://paste.ubuntu.com/23284745/
> 
> Thanks for sharing the log.  It does help.
> 
> You don't have debug information installed, which makes things more
> difficult for GDB.  The current tail-call detection heuristic is too 
> aggressive
> if there are no symbols available.
> 
> I posted a patch some time ago to make it less aggressive in this case:
> https://sourceware.org/ml/gdb-patches/2016-07/msg00277.html
> 
> This fixes (or hides, if you prefer) the issue you're seeing.  I don't 
> want to
> rule out that there might be other cases where we get the call stack 
> wrong
> if we don't have symbols available.
> 
> Let me ping again for this patch series.

Ok.

I have libc's debug symbols installed in /usr/lib/debug, but by default 
(without any --prefix) gdb looks in /usr/local/lib/debug, so it doesn't 
find it.  If I add a "set debug-file-directory /usr/lib/debug" at the 
beginning of the test, it passes.  It also passes with your patch 
series.

I will send a v2 of this patch when I have some free time.

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-07 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 19:17 [PATCH] gdb.btrace/*.exp: Make test names unique Simon Marchi
2016-10-06  8:44 ` Yao Qi
2016-10-06 13:58 ` Metzger, Markus T
2016-10-06 14:32   ` Simon Marchi
2016-10-07  7:43     ` Metzger, Markus T
2016-10-07 13:04       ` Simon Marchi

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).