[commit] Fix intermittent failure in interp.exp

Daniel Jacobowitz drow@false.org
Wed Aug 20 19:27:00 GMT 2008


I've checked in this self-explanatory patch.  You've got to be extra
careful when testing something whose output might contain "(gdb)";
trailing anchors are tricky to use in expect, because they may match
or not depending on how much output the OS provides at once.  I only
started seeing this failure recently but it's been there for a while.

-- 
Daniel Jacobowitz
CodeSourcery

2008-08-20  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.base/interp.exp: Always consume both prompts.

---
 gdb/testsuite/gdb.base/interp.exp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: src/gdb/testsuite/gdb.base/interp.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/interp.exp	2008-08-10 15:42:21.000000000 -0400
+++ src/gdb/testsuite/gdb.base/interp.exp	2008-08-10 15:52:55.000000000 -0400
@@ -21,7 +21,16 @@ if $tracelevel then {
 
 gdb_start
 
-gdb_test "interpreter-exec mi \"-var-update *\"" "\\^done,changelist=[].*"
+# Do not use gdb_test for this test, since it has two prompts.
+set cmd "interpreter-exec mi \"-var-update *\""
+gdb_test_multiple $cmd $cmd {
+    -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
+	pass "$cmd"
+	gdb_expect 1 {
+	    -re "\r\n$gdb_prompt $" { }
+	}
+    }
+}
 gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
 
 gdb_exit



More information about the Gdb-patches mailing list