diff mbox

[testsuite] fix problems in gdb.base/paginate-bg-execution.exp

Message ID 55FC6B86.8090700@codesourcery.com
State New
Headers show

Commit Message

Sandra Loosemore Sept. 18, 2015, 7:52 p.m. UTC
This patch addresses a couple of problems in 
gdb.base/paginate-bg-execution.exp:

(1) A different "Quit" message can appear in some cases, e.g. if GDB 
thinks the terminal doesn't support job control -- see the definition of 
quit in utils.c.  The specific situation where I tripped over this was 
running GDB in a CMD.EXE shell on a remote Windows host via ssh -T.

(2) The test was sending a ^C interrupt without testing whether the 
target had the nointerrupts property set.

OK to commit?  (I'm not sure this one qualifies as obvious.)

-Sandra

Comments

Pedro Alves Sept. 29, 2015, 2:41 p.m. UTC | #1
On 09/18/2015 08:52 PM, Sandra Loosemore wrote:
> This patch addresses a couple of problems in 
> gdb.base/paginate-bg-execution.exp:
> 
> (1) A different "Quit" message can appear in some cases, e.g. if GDB 
> thinks the terminal doesn't support job control -- see the definition of 
> quit in utils.c.  The specific situation where I tripped over this was 
> running GDB in a CMD.EXE shell on a remote Windows host via ssh -T.

Seems to me that suggesting to "expect signal SIGINT when the program
is resumed" is bogus in this case.  That can happen when you ctrl-c
the terminal, because a SIGINT ends up queued in both the inferior
and gdb, but I'm not seeing why that would happen in response to
the user typing "q" on a pagination prompt.  I think prompt_for_continue
should call throw_quit("Quit") directly instead of quit().

> 
> (2) The test was sending a ^C interrupt without testing whether the 
> target had the nointerrupts property set.

Odd that almost no other ctrl-c test checks this:

$ git grep "\\\003" testsuite/

testsuite/gdb.base/completion.exp:    send_gdb "\003"
testsuite/gdb.base/completion.exp:      send_gdb "\003"
testsuite/gdb.base/double-prompt-target-event-error.exp:        send_gdb "\003p 1\n"
testsuite/gdb.base/interrupt.exp:       send_gdb "\003"
testsuite/gdb.base/interrupt.exp:           send_gdb "\003"
testsuite/gdb.base/paginate-after-ctrl-c-running.exp:   send_gdb "\003"
testsuite/gdb.base/paginate-bg-execution.exp:       send_gdb "\003"
testsuite/gdb.base/paginate-execution-startup.exp:          send_gdb "\003"
testsuite/gdb.base/printcmds.exp:       gdb_test "p ctable1\[3\]"   " = 3 '\\\\003'"
testsuite/gdb.base/printcmds.exp:           " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
testsuite/gdb.base/random-signal.exp:after 500 {send_gdb "\003"}
testsuite/gdb.base/range-stepping.exp:    send_gdb "\003"
testsuite/gdb.cp/annota2.exp:send_gdb "\003"
testsuite/gdb.cp/annota3.exp:send_gdb "\003"
testsuite/gdb.gdb/selftest.exp:    send_gdb "\003"
testsuite/gdb.threads/continue-pending-status.exp:      send_gdb "\003"
testsuite/gdb.threads/leader-exit.exp:send_gdb "\003"
testsuite/gdb.threads/manythreads.exp:    send_gdb "\003"
testsuite/gdb.threads/pthreads.exp:    send_gdb "\003"
testsuite/gdb.threads/schedlock.exp:  after 1000 {send_gdb "\003"}
testsuite/gdb.threads/sigthread.exp:after 500 {send_gdb "\003"}

$ git grep nointerrupts

testsuite/gdb.base/interrupt.exp:if [target_info exists gdb,nointerrupts] {
testsuite/gdb.base/interrupt.exp:    verbose "Skipping interrupt.exp because of nointerrupts."

What's going on?

> 
> OK to commit?  (I'm not sure this one qualifies as obvious.)

I don't think it is obvious.

Thanks,
Pedro Alves
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.base/paginate-bg-execution.exp b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
index f7437ac..7b96df7 100644
--- a/gdb/testsuite/gdb.base/paginate-bg-execution.exp
+++ b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
@@ -104,6 +104,11 @@  proc test_bg_execution_pagination_cancel { how } {
 	    -re "Quit\r\n$gdb_prompt $" {
 		pass $test
 	    }
+	    # This variant can show up e.g. in remote testing via ssh -T,
+	    # so that GDB has no terminal.
+	    -re "Quit (expect signal SIGINT when the program is resumed)\r\n$gdb_prompt $" {
+		pass $test
+	    }
 	}
 
 	gdb_test "p 1" " = 1" "GDB accepts further input"
@@ -114,5 +119,7 @@  proc test_bg_execution_pagination_cancel { how } {
 }
 
 test_bg_execution_pagination_return
-test_bg_execution_pagination_cancel "ctrl-c"
+if ![target_info exists gdb,nointerrupts] {
+    test_bg_execution_pagination_cancel "ctrl-c"
+}
 test_bg_execution_pagination_cancel "quit"