[testsuite] fix problems in gdb.base/paginate-bg-execution.exp
Commit Message
On 09/29/2015 08:41 AM, Pedro Alves wrote:
> 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().
Hmmmm. If an actual code change is required here (instead of just a
testsuite fix), I'll split this off and try to deal with it separately.
>> (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?
I had an older patch that dealt with most of these that I hadn't pushed
upstream yet. :") I also found that a few of the things on your list
were already being skipped for other reasons on the target I was testing
on, and I'd missed a couple that were failing via ERROR instead of FAIL.
Here's a revised patch that should take care of everything -- OK to
commit this one?
-Sandra
Comments
On 12/13/2015 11:53 PM, Sandra Loosemore wrote:
> Hmmmm. If an actual code change is required here (instead of just a
> testsuite fix), I'll split this off and try to deal with it separately.
Thanks. I do think a code change is required here. It should
be a simple one, I believe.
> I had an older patch that dealt with most of these that I hadn't pushed
> upstream yet. :") I also found that a few of the things on your list
> were already being skipped for other reasons on the target I was testing
> on, and I'd missed a couple that were failing via ERROR instead of FAIL.
> Here's a revised patch that should take care of everything -- OK to
> commit this one?
OK.
Thanks,
Pedro Alves
@@ -944,7 +944,7 @@ gdb_test_multiple "" "$test" {
gdb_test_no_output "set max-completions unlimited"
-if {![skip_tui_tests]} {
+if {![skip_tui_tests] && ![target_info exists gdb,nointerrupts]} {
set test "test completion of layout names"
send_gdb "layout\t\t\t"
gdb_test_multiple "" "$test" {
@@ -960,7 +960,7 @@ if {![skip_tui_tests]} {
}
}
}
-if {![skip_tui_tests]} {
+if {![skip_tui_tests] && ![target_info exists gdb,nointerrupts]} {
with_test_prefix "focus command" {
set test "test completion"
send_gdb "focus \t\t"
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping double-prompt-target-event-error.exp because of nointerrupts."
+ return
+}
+
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} {
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping paginate-after-ctrl-c-running.exp because of nointerrupts."
+ return
+}
+
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
@@ -114,5 +114,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"
@@ -174,7 +174,9 @@ proc test_fg_execution_pagination_cancel { how } {
if {[probe_can_run_cmdline] > 0} {
test_fg_execution_pagination_return
- test_fg_execution_pagination_cancel "ctrl-c"
+ if ![target_info exists gdb,nointerrupts] {
+ test_fg_execution_pagination_cancel "ctrl-c"
+ }
test_fg_execution_pagination_cancel "quit"
}
@@ -18,6 +18,12 @@ if [target_info exists gdb,nosignals] {
continue
}
+# This test requires sending ^C to interrupt the running target.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping random-signal.exp because of nointerrupts."
+ return
+}
+
standard_testfile
if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
@@ -172,42 +172,44 @@ with_test_prefix "loop 2" {
# Check that range stepping works well even when it is interrupted by
# ctrl-c.
-with_test_prefix "interrupt" {
- gdb_test_no_output "set debug remote 1"
-
- send_gdb "next\n"
- sleep 1
- send_gdb "\003"
-
- # GDB should send one vCont;r and receive one stop reply for
- # SIGINT:
- # --> vCont;rSTART,END (range step)
- # <-- T02 (SIGINT)
-
- set vcont_r_counter 0
-
- set test "send ctrl-c to GDB"
- gdb_test_multiple "" $test {
- -re "vCont;r\[^\r\n\]*\.\.\." {
- incr vcont_r_counter
- exp_continue
+if ![target_info exists gdb,nointerrupts] {
+ with_test_prefix "interrupt" {
+ gdb_test_no_output "set debug remote 1"
+
+ send_gdb "next\n"
+ sleep 1
+ send_gdb "\003"
+
+ # GDB should send one vCont;r and receive one stop reply for
+ # SIGINT:
+ # --> vCont;rSTART,END (range step)
+ # <-- T02 (SIGINT)
+
+ set vcont_r_counter 0
+
+ set test "send ctrl-c to GDB"
+ gdb_test_multiple "" $test {
+ -re "vCont;r\[^\r\n\]*\.\.\." {
+ incr vcont_r_counter
+ exp_continue
+ }
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass $test
+ }
}
- -re "Program received signal SIGINT.*$gdb_prompt $" {
- pass $test
+ gdb_test_no_output "set debug remote 0"
+
+ # Check the number of 'vCont;r' packets.
+ if { $vcont_r_counter == 1 } {
+ pass "${test}: 1 vCont;r"
+ } else {
+ fail "${test}: 1 vCont;r"
}
- }
- gdb_test_no_output "set debug remote 0"
- # Check the number of 'vCont;r' packets.
- if { $vcont_r_counter == 1 } {
- pass "${test}: 1 vCont;r"
- } else {
- fail "${test}: 1 vCont;r"
+ # Break the loop earlier and continue range stepping.
+ gdb_test "set variable c = 0"
+ exec_cmd_expect_vCont_count "next" 1
}
-
- # Break the loop earlier and continue range stepping.
- gdb_test "set variable c = 0"
- exec_cmd_expect_vCont_count "next" 1
}
# Check that range stepping doesn't break software watchpoints. With
@@ -262,12 +262,14 @@ gdb_test_multiple "next" "watch triggered on a.x" {
# test:
# annotate-quit
#
-send_gdb "\003"
-gdb_expect {
- -re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \
+if ![target_info exists gdb,nointerrupts] {
+ send_gdb "\003"
+ gdb_expect {
+ -re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \
{ pass "annotate-quit" }
- -re ".*$gdb_prompt$" { fail "annotate-quit" }
- timeout { fail "annotate-quit (timeout)" }
+ -re ".*$gdb_prompt$" { fail "annotate-quit" }
+ timeout { fail "annotate-quit (timeout)" }
+ }
}
#
@@ -177,11 +177,13 @@ gdb_test_multiple "next" "watch triggered on a.x" {
# test:
# annotate-quit
#
-send_gdb "\003"
-gdb_expect_list "annotate-quit" "$gdb_prompt$" {
- "\r\n\032\032error-begin\r\n"
- "Quit\r\n"
- "\r\n\032\032quit\r\n"
+if ![target_info exists gdb,nointerrupts] {
+ send_gdb "\003"
+ gdb_expect_list "annotate-quit" "$gdb_prompt$" {
+ "\r\n\032\032error-begin\r\n"
+ "Quit\r\n"
+ "\r\n\032\032quit\r\n"
+ }
}
#
@@ -433,17 +433,19 @@ proc test_with_self { executable } {
}
# kill the xgdb process
- set description "send ^C to child process"
- send_gdb "\003"
- gdb_expect {
- -re "Program received signal SIGINT.*$gdb_prompt $" {
- pass "$description"
- }
- -re ".*$gdb_prompt $" {
- fail "$description"
- }
- timeout {
- fail "$description (timeout)"
+ if ![target_info exists gdb,nointerrupts] {
+ set description "send ^C to child process"
+ send_gdb "\003"
+ gdb_expect {
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass "$description"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "$description"
+ }
+ timeout {
+ fail "$description (timeout)"
+ }
}
}
@@ -17,6 +17,11 @@
# thread, then switching to a thread that has a status pending and
# continuing.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping continue-pending-status.exp because of nointerrupts."
+ return
+}
+
standard_testfile
if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping leader-exit.exp because of nointerrupts."
+ return
+}
+
# Exit of the thread group leader should not break GDB.
standard_testfile
@@ -16,6 +16,11 @@
# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
+# This test requires sending ^C to interrupt the running target.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping manythreads.exp because of nointerrupts."
+ return
+}
standard_testfile
@@ -15,6 +15,11 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
+# This test requires sending ^C to interrupt the running target.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping pthreads.exp because of nointerrupts."
+ return
+}
standard_testfile
@@ -18,6 +18,12 @@
#
# This test covers the various forms of "set scheduler-locking".
+# This test requires sending ^C to interrupt the running target.
+
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping schedlock.exp because of nointerrupts."
+ return
+}
standard_testfile
@@ -37,6 +37,12 @@ gdb_test_multiple "continue" "continue" {
}
}
+# This test requires sending ^C to interrupt the running target.
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping sigthread.exp because of nointerrupts."
+ return
+}
+
# For this to work we must be sure to consume the "Continuing."
# message first, or GDB's signal handler may not be in place.
after 500 {send_gdb "\003"}