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]

[commit] testsuite: Races fix: gdb.trace/* gdb_test_multiple (PR 12649)


Hi,

gdb_test_multiple does not expect final `\r\n$gdb_prompt $' (like gdb_test
does) which leads to races like:

 ftrace gdb_recursion_test
-May not have a fast tracepoint at 0x0x80484ea; instruction is only 3 bytes long, need at least 4 bytes for the jumpPASS: gdb.trace/tstatus.exp: 4-byte fast tracepoint could not be set
-continue
-
-(gdb) FAIL: gdb.trace/tstatus.exp: advance to trace begin
-continue
+May not have a fast tracepoint at 0x0x80484ea; instruction is only 3 bytes long, need at least 4 bytes for the jump
+PASS: gdb.trace/tstatus.exp: 4-byte fast tracepoint could not be set
+(gdb) continue
 Continuing.

Someone more familiar with the gdb.trace/* tests could review it but I think
the changes are clear.

Checked in.  Tested on x86_64-fedora16-linux-gnu.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-12/msg00010.html

--- src/gdb/testsuite/ChangeLog	2011/12/02 01:28:55	1.2955
+++ src/gdb/testsuite/ChangeLog	2011/12/02 12:43:29	1.2956
@@ -1,5 +1,14 @@
 2011-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+	PR testsuite/12649
+	* gdb.trace/collection.exp (gdb_collect_return_test): Import gdb_prompt.
+	Protect gdb_test_multiple by final $gdb_prompt match.
+	* gdb.trace/tspeed.exp (gdb_fast_trace_speed_test): Likewise.
+	* gdb.trace/tstatus.exp (run_trace_experiment): Likewise.
+	(test_tracepoints): Likewise.
+
+2011-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	PR breakpoints/13346
 	* gdb.dwarf2/dw2-objfile-overlap-inner.S: New file.
 	* gdb.dwarf2/dw2-objfile-overlap-outer.S: New file.
--- src/gdb/testsuite/gdb.trace/collection.exp	2011/11/02 23:44:21	1.28
+++ src/gdb/testsuite/gdb.trace/collection.exp	2011/12/02 12:43:29	1.29
@@ -589,6 +589,7 @@
 }
 
 proc gdb_collect_return_test { } {
+    global gdb_prompt
 
     prepare_for_trace_test
 
@@ -606,10 +607,10 @@
     # Since we can't guarantee that $_ret will give us the caller,
     # pass either way, but giving different messages.
     gdb_test_multiple "backtrace" "" {
-	-re ".*#1 .* in main .*" {
+	-re ".*#1 .* in main .*\r\n$gdb_prompt $" {
 	    pass "collect \$_ret: backtrace lists main"
 	}
-	-re ".*#1 .* in ?? .*" {
+	-re ".*#1 .* in ?? .*\r\n$gdb_prompt $" {
 	    pass "collect \$_ret: backtrace not listing main"
 	}
     }
--- src/gdb/testsuite/gdb.trace/tspeed.exp	2011/09/19 16:55:26	1.1
+++ src/gdb/testsuite/gdb.trace/tspeed.exp	2011/12/02 12:43:29	1.2
@@ -89,6 +89,7 @@
 }
 
 proc gdb_fast_trace_speed_test { } {
+    global gdb_prompt
 
     gdb_delete_tracepoints
 
@@ -100,11 +101,11 @@
 
     gdb_test_multiple "ftrace $testline if (globfoo != 12 && globfoo2 == 45)" \
 	"set conditional fast tracepoint" {
-	    -re "Fast tracepoint \[0-9\]+ at .*" {
+	    -re "Fast tracepoint \[0-9\]+ at .*\r\n$gdb_prompt $" {
 		pass "set conditional fast tracepoint, done"
 		set run_ftrace 1
 	    }
-	    -re "May not have a fast tracepoint at .*" {
+	    -re "May not have a fast tracepoint at .*\r\n$gdb_prompt $" {
 		pass "set conditional fast tracepoint, not allowed at line"
 	    }
 	}
--- src/gdb/testsuite/gdb.trace/tstatus.exp	2011/11/20 23:59:49	1.1
+++ src/gdb/testsuite/gdb.trace/tstatus.exp	2011/12/02 12:43:29	1.2
@@ -56,6 +56,7 @@
 }
 
 proc run_trace_experiment {} {
+    global gdb_prompt
 
 #    gdb_test_no_output "set debug remote 1" ""
 
@@ -74,10 +75,10 @@
     # cases.
 
     gdb_test_multiple "tstatus" "check on trace status" {
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: my tracing note\.\[\r\n\]+Not looking at any trace frame\..*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: my tracing note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
 	    pass "tstatus reports trace note"
 	}
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
 	    pass "tstatus does not report any trace note"
 	}
     }
@@ -85,10 +86,10 @@
     gdb_test "set trace-notes different note" "" "change tracing note"
 
     gdb_test_multiple "tstatus" "check on trace status with diff note" {
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
 	    pass "tstatus reports different trace note"
 	}
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
 	    pass "tstatus does not report any different trace note"
 	}
     }
@@ -96,10 +97,10 @@
     gdb_test "set trace-user me me me" "" "change tracing user"
 
     gdb_test_multiple "tstatus" "check on trace status with diff note" {
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
 	    pass "tstatus reports trace user"
 	}
-	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*" {
+	-re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
 	    pass "tstatus does not report trace user"
 	}
     }
@@ -107,10 +108,10 @@
     gdb_test_no_output "tstop because I can" "trace stopped with note"
 
     gdb_test_multiple "tstatus" "check on trace status after stop" {
-	-re "Trace stopped by a tstop command (because I can)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*" {
+	-re "Trace stopped by a tstop command (because I can)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
 	    pass "tstatus reports trace stop reason"
 	}
-	-re "Trace stopped by a tstop command\..*" {
+	-re "Trace stopped by a tstop command\..*\r\n$gdb_prompt $" {
 	    pass "tstatus does not report trace stop reason"
 	}
     }
@@ -118,16 +119,17 @@
     # Tracepoint hit count is optional, so pass it either way.
 
     gdb_test_multiple "info trace" "show tracepoint state" {
-	-re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+tracepoint already hit 1 time\[\r\n\]+\[\t ]+collect parm" {
+	-re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+tracepoint already hit 1 time\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
 	    pass "info trace reports tracepoint hit count"
 	}
-	-re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+collect parm" {
+	-re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
 	    pass "info trace does not report tracepoint hit count"
 	}
     }
 }
 
 proc test_tracepoints {} {
+    global gdb_prompt
 
     gdb_test "break begin" ".*" ""
 
@@ -142,10 +144,10 @@
     set fastgood 0
 
     gdb_test_multiple "ftrace gdb_recursion_test" "set fast tracepoint" {
-	-re "May not have a fast tracepoint at .*" {
+	-re "May not have a fast tracepoint at .*\r\n$gdb_prompt $" {
 	    pass "4-byte fast tracepoint could not be set"
 	}
-	-re "Fast tracepoint .*" {
+	-re "Fast tracepoint .*\r\n$gdb_prompt $" {
 	    pass "4-byte fast tracepoint is set"
 	    set fastgood 1
 	}


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