This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: MI testsuite improvements


On Thu, Feb 10, 2005 at 03:52:08PM -0500, Andrew Cagney wrote:
> 
> >OO, I see, are you saying the mi-* tests will become the new ones, and
> >the mi2-* are frozen for the mi2-* development cycle?
> >
> >In order to do this for only the new tests, I'll have to add a new
> >parameter to mi_gdb_start to tell it to either open or not open a pty 
> >for the inferior. Hope this will be OK.
> 
> M'kay.

Here is the patch that give's the inferior it's own PTY and only changes 
the mi-* testcase's and not the the mi2-* testcases. Just to mention, it
will definatly be more complicated to have only the mi-* testcase's use
the PTY and have the mi2-* not. However, if this is what you want, it is
possible to do.

Few things to note is that 
   - mi_gdb_start now takes an optional parameter. This tells it to have
     the inferior use a tty or not. I could make this parameter not
     optional, and put 'false' everywhere for the mi2-* tests. Is this
     what you want? Sorry, don't know what normal conventions are for
     Tcl programming, since I'm a newbie.
   - mi_gdb_test now takes an IPATTERN parameter, which refer's to the
     pattern the inferior must match if the parameter is present. A
     PASS is given if the output is matched, otherwise a FAIL. So, when
     calling mi_gdb_test, when you give the IPATTERN, 2 PASS's are given
     instead of just 1.

Here is the result's of the entire MI testsuite, with my changes,
# of expected passes        1220
# of unexpected failures    6
# of expected failures      28
# of known failures     1
   
Here it is without my changes,
# of expected passes        1216
# of unexpected failures    6
# of expected failures      28
# of known failures     2

Here's why the results change,
   mi-console.exp -> used to produce 1 pass and 1 kfail for the
   '47-exec-next' command. Now it produces 2 passed.
   mi-syn-frame.exp -> I called mi_gdb_test 3 times there with inferior 
   output expected. This add's the extra 3 PASS's.

So with 4 more passes and 1 less kfail, the results line up.

Thanks,
Bob Rossi

2005-02-11  Bob Rossi  <bob@brasko.net>

        * gdb.mi/mi-basics.exp: tell mi_gdb_start to use PTY for inferior
        * gdb.mi/mi-break.exp: Ditto
        * gdb.mi/mi-cli.exp: Ditto
        * gdb.mi/mi-disassemble.exp: Ditto
        * gdb.mi/mi-eval.exp: Ditto
        * gdb.mi/mi-file.exp: Ditto
        * gdb.mi/mi-hack-cli.exp: Ditto
        * gdb.mi/mi-pthreads.exp: Ditto
        * gdb.mi/mi-read-memory.exp: Ditto
        * gdb.mi/mi-regs.exp: Ditto
        * gdb.mi/mi-return.exp: Ditto
        * gdb.mi/mi-simplerun.exp: Ditto
        * gdb.mi/mi-stack.exp: Ditto
        * gdb.mi/mi-stepi.exp: Ditto
        * gdb.mi/mi-until.exp: Ditto
        * gdb.mi/mi-var-block.exp: Ditto
        * gdb.mi/mi-var-child.exp: Ditto
        * gdb.mi/mi-var-cmd.exp: Ditto
        * gdb.mi/mi-var-display.exp: Ditto
        * gdb.mi/mi-watch.exp: Ditto
        * gdb.mi/mi-syn-frame.exp: tell mi_gdb_start to use PTY for inferior
        (403-exec-continue): Use mi_gdb_test to get GDB and Inferior output
        (406-data-evaluate-expression have_a_very_merry_interrupt()):
        Use mi_gdb_test to get GDB and Inferior output
        (408-exec-continue): Use mi_gdb_test to get GDB output
        (410-data-evaluate-expression bar()):
        Use mi_gdb_test to get GDB and Inferior output
        * gdb.mi/mi-conole.exp: tell mi_gdb_start to use PTY for inferior
        Change 47-exec-next command to use the mi_gdb_test to have the
        output from GDB and inferior matched in 1 command.
        * lib/mi-support.exp (mi_inferior_spawn_id): add inferior PTY
        descriptor
        (mi_gdb_start): Add INERIOR_PTY parameter, if TRUE, use PTY for
        inferior, otherwise share GDB's PTY.
        (mi_gdb_test): Add IPATTERN parameter, match inferior output from
        the inferior's very own PTY.

Index: gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.9
diff -w -u -r1.9 mi-basics.exp
--- gdb.mi/mi-basics.exp	9 Aug 2004 16:32:44 -0000	1.9
+++ gdb.mi/mi-basics.exp	11 Feb 2005 17:01:44 -0000
@@ -33,7 +33,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-break.exp,v
retrieving revision 1.7
diff -w -u -r1.7 mi-break.exp
--- gdb.mi/mi-break.exp	13 Aug 2004 16:21:29 -0000	1.7
+++ gdb.mi/mi-break.exp	11 Feb 2005 17:01:44 -0000
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-cli.exp,v
retrieving revision 1.3
diff -w -u -r1.3 mi-cli.exp
--- gdb.mi/mi-cli.exp	15 Aug 2004 10:15:58 -0000	1.3
+++ gdb.mi/mi-cli.exp	11 Feb 2005 17:01:44 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-console.exp,v
retrieving revision 1.12
diff -w -u -r1.12 mi-console.exp
--- gdb.mi/mi-console.exp	9 Aug 2004 16:32:44 -0000	1.12
+++ gdb.mi/mi-console.exp	11 Feb 2005 17:01:44 -0000
@@ -36,7 +36,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
@@ -54,35 +54,11 @@
 mi_run_to_main
 
 # Next over the hello() call which will produce lots of output
-send_gdb "47-exec-next\n"
-gdb_expect {
-    -re "47\\^running\r\n$mi_gdb_prompt" {
-	pass "Started step over hello"
-    }
-    timeout {
-	fail "Started step over hello (timeout)"
-    }
-}
 
-gdb_expect {
-    -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
-	pass "Hello message"
-    }
-    -re "Hello" {
-
-	# Probably a native system where GDB doesn't have direct
-	# control over the inferior console.
-	# For this to work, GDB would need to run the inferior process
-	# under a PTY and then use the even-loops ability to wait on
-	# multiple event sources to channel the output back through the
-	# MI.
-
-	kfail "gdb/623" "Hello message"
-    }
-    timeout {
-	fail "Hello message (timeout)"
-    }
-}
+mi_gdb_test "47-exec-next" \
+	    "47\\^running" \
+	    "Hello \\\\\"!\[\r\n\]+" \
+	    "Testing console output"
     
 gdb_expect {
     -re "47\\*stopped.*$mi_gdb_prompt$" {
Index: gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -w -u -r1.13 mi-disassemble.exp
--- gdb.mi/mi-disassemble.exp	15 Aug 2004 10:15:58 -0000	1.13
+++ gdb.mi/mi-disassemble.exp	11 Feb 2005 17:01:44 -0000
@@ -25,7 +25,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-eval.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-eval.exp,v
retrieving revision 1.9
diff -w -u -r1.9 mi-eval.exp
--- gdb.mi/mi-eval.exp	15 Aug 2004 10:15:58 -0000	1.9
+++ gdb.mi/mi-eval.exp	11 Feb 2005 17:01:44 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-file.exp,v
retrieving revision 1.4
diff -w -u -r1.4 mi-file.exp
--- gdb.mi/mi-file.exp	15 Aug 2004 10:15:58 -0000	1.4
+++ gdb.mi/mi-file.exp	11 Feb 2005 17:01:44 -0000
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-hack-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-hack-cli.exp,v
retrieving revision 1.6
diff -w -u -r1.6 mi-hack-cli.exp
--- gdb.mi/mi-hack-cli.exp	9 Aug 2004 16:32:44 -0000	1.6
+++ gdb.mi/mi-hack-cli.exp	11 Feb 2005 17:01:44 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-pthreads.exp,v
retrieving revision 1.7
diff -w -u -r1.7 mi-pthreads.exp
--- gdb.mi/mi-pthreads.exp	13 Jan 2004 17:08:03 -0000	1.7
+++ gdb.mi/mi-pthreads.exp	11 Feb 2005 17:01:45 -0000
@@ -32,7 +32,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if {[mi_gdb_start]} {
+if {[mi_gdb_start true]} {
     continue
 }
 
Index: gdb.mi/mi-read-memory.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-read-memory.exp,v
retrieving revision 1.9
diff -w -u -r1.9 mi-read-memory.exp
--- gdb.mi/mi-read-memory.exp	9 Aug 2004 16:32:44 -0000	1.9
+++ gdb.mi/mi-read-memory.exp	11 Feb 2005 17:01:45 -0000
@@ -33,7 +33,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-regs.exp,v
retrieving revision 1.12
diff -w -u -r1.12 mi-regs.exp
--- gdb.mi/mi-regs.exp	9 Aug 2004 16:32:44 -0000	1.12
+++ gdb.mi/mi-regs.exp	11 Feb 2005 17:01:45 -0000
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-return.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-return.exp,v
retrieving revision 1.11
diff -w -u -r1.11 mi-return.exp
--- gdb.mi/mi-return.exp	15 Aug 2004 10:15:58 -0000	1.11
+++ gdb.mi/mi-return.exp	11 Feb 2005 17:01:45 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-simplerun.exp,v
retrieving revision 1.12
diff -w -u -r1.12 mi-simplerun.exp
--- gdb.mi/mi-simplerun.exp	15 Aug 2004 10:15:58 -0000	1.12
+++ gdb.mi/mi-simplerun.exp	11 Feb 2005 17:01:45 -0000
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.14
diff -w -u -r1.14 mi-stack.exp
--- gdb.mi/mi-stack.exp	15 Aug 2004 10:15:58 -0000	1.14
+++ gdb.mi/mi-stack.exp	11 Feb 2005 17:01:45 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-stepi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stepi.exp,v
retrieving revision 1.10
diff -w -u -r1.10 mi-stepi.exp
--- gdb.mi/mi-stepi.exp	15 Aug 2004 10:15:58 -0000	1.10
+++ gdb.mi/mi-stepi.exp	11 Feb 2005 17:01:45 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-syn-frame.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-syn-frame.exp,v
retrieving revision 1.2
diff -w -u -r1.2 mi-syn-frame.exp
--- gdb.mi/mi-syn-frame.exp	24 Feb 2003 20:15:47 -0000	1.2
+++ gdb.mi/mi-syn-frame.exp	11 Feb 2005 17:01:45 -0000
@@ -38,7 +38,7 @@
 set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*"
 
 mi_gdb_exit
-mi_gdb_start
+mi_gdb_start true
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
@@ -58,16 +58,10 @@
 #
 # Continue back to main()
 #
-
-send_gdb "403-exec-continue\n"
-gdb_expect {
-  -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}hi in foo\[\r\n\]+403\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "403-exec-continue"
-  }
-  timeout {
-    fail "403-exec-continue"
-  }
-}
+mi_gdb_test "403-exec-continue" \
+			"403\\^running\[\r\n\]+${my_mi_gdb_prompt}403\\\*stopped" \
+			"hi in foo\[\r\n\]\+" \
+			"testing exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]"
 
@@ -78,7 +72,11 @@
 
 mi_gdb_test "405-break-insert subroutine" "405\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}"
 
-mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" "Waiting to get a signal\[\r\n\]+\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\""
+mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
+            "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+			"Waiting to get a signal\[\r\n\]+" \
+			"data evaluate expression"
+
 
 # We should have both a signal handler and a call dummy frame
 # in this next output.
@@ -86,15 +84,8 @@
 mi_gdb_test "407-stack-list-frames" "407\\^done,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"subroutine\",args=\\\[\{name=\"in\",value=\"$decimal\"\}\\\],file=\".*mi-syn-frame.c\",line=\"$decimal\"\},stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]"
 
 
-send_gdb "408-exec-continue\n"
-gdb_expect {
-  -re "408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "408-exec-continue"
-  }
-  timeout {
-    fail "408-exec-continue"
-  }
-}
+mi_gdb_test "408-exec-continue" \
+			"408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped"
 
 mi_gdb_test "409-stack-list-frames 0 0" "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]"
 
@@ -102,7 +93,10 @@
 # Call bar() by hand, which should get an exception while running.
 # 
 
-mi_gdb_test "410-data-evaluate-expression bar()" "hi in bar\[\r\n\]+\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
+mi_gdb_test "410-data-evaluate-expression bar()" \
+            "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
+			"hi in bar\[\r\n\]+" \
+			"call inferior function which raises exception" 
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,reason=\"signal-received\",signal-name=\".*\",signal-meaning=\".*\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"bar\",args=\\\[\\\],file=\".*mi-syn-frame.c\",line=\"$decimal\"\},stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
 
Index: gdb.mi/mi-until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-until.exp,v
retrieving revision 1.8
diff -w -u -r1.8 mi-until.exp
--- gdb.mi/mi-until.exp	9 Aug 2004 16:32:44 -0000	1.8
+++ gdb.mi/mi-until.exp	11 Feb 2005 17:01:45 -0000
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-var-block.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-block.exp,v
retrieving revision 1.11
diff -w -u -r1.11 mi-var-block.exp
--- gdb.mi/mi-var-block.exp	17 Aug 2004 09:38:29 -0000	1.11
+++ gdb.mi/mi-var-block.exp	11 Feb 2005 17:01:45 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.17
diff -w -u -r1.17 mi-var-child.exp
--- gdb.mi/mi-var-child.exp	17 Aug 2004 09:38:29 -0000	1.17
+++ gdb.mi/mi-var-child.exp	11 Feb 2005 17:01:46 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.18
diff -w -u -r1.18 mi-var-cmd.exp
--- gdb.mi/mi-var-cmd.exp	14 Jan 2005 18:17:19 -0000	1.18
+++ gdb.mi/mi-var-cmd.exp	11 Feb 2005 17:01:47 -0000
@@ -25,7 +25,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-display.exp,v
retrieving revision 1.12
diff -w -u -r1.12 mi-var-display.exp
--- gdb.mi/mi-var-display.exp	17 Aug 2004 09:38:29 -0000	1.12
+++ gdb.mi/mi-var-display.exp	11 Feb 2005 17:01:47 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: gdb.mi/mi-watch.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-watch.exp,v
retrieving revision 1.11
diff -w -u -r1.11 mi-watch.exp
--- gdb.mi/mi-watch.exp	15 Aug 2004 10:15:58 -0000	1.11
+++ gdb.mi/mi-watch.exp	11 Feb 2005 17:01:47 -0000
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start true] {
     continue
 }
 
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.24
diff -w -u -r1.24 mi-support.exp
--- lib/mi-support.exp	18 Jan 2004 15:23:30 -0000	1.24
+++ lib/mi-support.exp	11 Feb 2005 17:01:49 -0000
@@ -28,6 +28,8 @@
     set mi_gdb_prompt "\[(\]gdb\[)\] \r\n"
 }
 
+global mi_inferior_spawn_id
+
 set MIFLAGS "-i=mi"
 
 #
@@ -81,13 +83,16 @@
 }
 
 #
-# start gdb -- start gdb running, default procedure
+# start gdb INFERIOR_PTY -- start gdb running, default procedure
+#
+# INFERIOR_PTY should be set to TRUE to have the inferior work with it's
+# own PTY. If set to FALSE, the inferior shares GDB's PTY.
 #
 # When running over NFS, particularly if running many simultaneous
 # tests on different hosts all using the same server, things can
 # get really slow.  Give gdb at least 3 minutes to start up.
 #
-proc mi_gdb_start { } {
+proc mi_gdb_start { args } {
     global verbose
     global GDB
     global GDBFLAGS
@@ -99,6 +104,10 @@
 
     gdb_stop_suppressing_tests;
 
+    if { [llength $args] == 1} {
+	set inferior_pty [lindex $args 0]
+    }
+
     # Start SID.
     if { [info procs sid_start] != "" } {
 	verbose "Spawning SID"
@@ -117,6 +126,15 @@
 	    exit 1
 	}
     }
+
+    # spawn off the new pty for the inferior process
+    if { [ info exists inferior_pty ] } {
+	spawn -pty
+	global mi_inferior_spawn_id
+	set mi_inferior_spawn_id $spawn_id
+	set mi_inferior_tty_name $spawn_out(slave,name)
+    }
+
     set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
     if { $res < 0 || $res == "" } {
 	perror "Spawning $GDB failed."
@@ -189,6 +207,19 @@
 	    warning "Couldn't set the width to 0."
 	}
     }
+    # If allowing the inferior to have it's own PTY then assign the inferior
+    # it's own terminal device here
+    if { [ info exists inferior_pty ] } {
+	send_gdb "102-interpreter-exec console \"tty $mi_inferior_tty_name\"\n"
+	gdb_expect 10 {
+	    -re ".*$mi_gdb_prompt$" {
+		verbose "redirect inferior output to new terminal device."
+	    }
+	    timeout {
+	    	warning "Couldn't redirect inferior output." 2
+	    }
+    	}
+    }
 
     return 0;
 }
@@ -516,12 +547,14 @@
     return 0
 }
 
-# mi_gdb_test COMMAND PATTERN MESSAGE -- send a command to gdb; test the result.
+# mi_gdb_test COMMAND PATTERN IPATTERN MESSAGE -- send a command to gdb; test the result.
 #
 # COMMAND is the command to execute, send to GDB with send_gdb.  If
 #   this is the null string no command is sent.
 # PATTERN is the pattern to match for a PASS, and must NOT include
 #   the \r\n sequence immediately before the gdb prompt.
+# IPATTERN is the pattern to match for the inferior's output. This will not 
+#   produce a PASS if successfull, but will produce a FAIL if unsuccessful.
 # MESSAGE is an optional message to be printed.  If this is
 #   omitted, then the pass/fail messages use the command string as the
 #   message.  (If this is the empty string, then sometimes we don't
@@ -538,14 +571,20 @@
     global GDB expect_out
     upvar timeout timeout
 
-    if [llength $args]>2 then {
+    if { [llength $args] == 3} {
 	set message [lindex $args 2]
+    } elseif {[llength $args] == 4 } {
+	set message [lindex $args 3]
     } else {
 	set message [lindex $args 0]
     }
     set command [lindex $args 0]
     set pattern [lindex $args 1]
 
+    if [llength $args]==4 {
+	set ipattern [lindex $args 2]
+    }
+
     if [llength $args]==5 {
 	set question_string [lindex $args 3];
 	set response_string [lindex $args 4];
@@ -696,6 +735,23 @@
 	    set result 1
 	}
     }
+
+    # if the GDB output matched, compare the inferior output
+    if { $result == 0 } {
+	if [ info exists ipattern ] {
+	    global mi_inferior_spawn_id
+	    expect {
+		-i $mi_inferior_spawn_id -re "$ipattern" {
+		    pass "inferior_output:$message"
+		}
+		timeout {
+		    fail "inferior output timeout"
+		    set result 1
+		}
+	    }
+        }
+    }
+
     return $result
 }
 


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