From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4570 invoked by alias); 23 Feb 2015 13:54:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4527 invoked by uid 89); 23 Feb 2015 13:54:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 23 Feb 2015 13:54:29 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1NDsR2B018134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 23 Feb 2015 08:54:28 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1NDsKZk000641 for ; Mon, 23 Feb 2015 08:54:27 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 6/6] gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id Date: Mon, 23 Feb 2015 13:54:00 -0000 Message-Id: <1424699660-11727-7-git-send-email-palves@redhat.com> In-Reply-To: <1424699660-11727-1-git-send-email-palves@redhat.com> References: <1424699660-11727-1-git-send-email-palves@redhat.com> X-SW-Source: 2015-02/txt/msg00657.txt.bz2 The gdb.base/interrupt.exp test is important for testing system call restarting, but because it depends on inferior I/O, it ends up skipped against gdbserver. This patch adjusts the test to use send_inferior and $inferior_spawn_id so it works against GDBserver. gdb/testsuite/ChangeLog: 2015-02-23 Pedro Alves * gdb.base/interrupt.exp: Don't skip if $inferior_spawn_id != $gdb_spawn_id. Use send_inferior and $inferior_spawn_id to interact with inferior program. --- gdb/testsuite/gdb.base/interrupt.exp | 56 ++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 55c8fca..d093ff5 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -18,12 +18,6 @@ if [target_info exists gdb,nointerrupts] { continue } -if [target_info exists gdb,noinferiorio] { - verbose "Skipping interrupt.exp because of noinferiorio." - return -} - - standard_testfile set options { debug } @@ -49,9 +43,16 @@ if ![file exists $binfile] then { gdb_test "shell stty intr '^C'" ".*" \ "set interrupt character in interrupt.exp" if [runto_main] then { + global inferior_spawn_id gdb_spawn_id + + if {[target_info exists gdb,noinferiorio] && $inferior_spawn_id == $gdb_spawn_id} { + verbose "Skipping interrupt.exp because of noinferiorio." + return + } + set msg "process is alive" gdb_test_multiple "continue" $msg { - -re "\r\ntalk to me baby\r\n" { + -i "$inferior_spawn_id" -re "talk to me baby\r\n" { pass $msg } } @@ -60,9 +61,9 @@ if ![file exists $binfile] then { # program's output. set msg "child process ate our char" - send_gdb "a\n" + send_inferior "a\n" gdb_test_multiple "" $msg { - -re "^a\r\na\r\n$" { + -i "$inferior_spawn_id" -re "^a\r\na\r\n$" { pass $msg } } @@ -120,8 +121,8 @@ if ![file exists $binfile] then { setup_xfail "*-*-hpux*" setup_xfail "*-*-*lynx*" fail "$msg (stays asleep)" - # Send_Gdb a newline to wake it up - send_gdb "\n" + # Send the inferior a newline to wake it up. + send_inferior "\n" gdb_test "" " = 4" "call function after waking it" } } @@ -148,7 +149,7 @@ if ![file exists $binfile] then { } } - send_gdb "data\n" + send_inferior "data\n" # The optional leading \r\n is in case we sent a newline above # to wake the program, in which case the program now sends it # back. @@ -158,10 +159,10 @@ if ![file exists $binfile] then { set msg "echo data" gdb_test_multiple "" $msg { - -re "^(\r\n|)data\r\ndata\r\n$" { + -i "$inferior_spawn_id" -re "^(\r\n|)data\r\ndata\r\n$" { pass $msg } - -re "Undefined command.*$gdb_prompt " { + -i "$gdb_spawn_id" -re "Undefined command.*$gdb_prompt " { fail $msg } } @@ -189,23 +190,40 @@ if ![file exists $binfile] then { } # We should be back in the loop. - send_gdb "more data\n" + send_inferior "more data\n" set msg "echo more data" gdb_test_multiple "" $msg { - -re "^(\r\n|)more data\r\nmore data\r\n$" { + -i "$inferior_spawn_id" -re "^(\r\n|)more data\r\nmore data\r\n$" { pass $msg } } } + set saw_eof 0 + set saw_inferior_exit 0 + set msg "send end of file" - send_gdb "\004" + send_inferior "\004" gdb_test_multiple "" $msg { - -re "end of file.*$inferior_exited_re normally.*$gdb_prompt $" { - pass $msg + -i "$inferior_spawn_id" -re "end of file" { + verbose -log "saw eof: $saw_eof" + set saw_eof 1 + verbose -log "saw eof" + if {!$saw_inferior_exit} { + exp_continue + } + } + -i "$gdb_spawn_id" -re "$inferior_exited_re normally.*$gdb_prompt " { + set saw_inferior_exit 1 + verbose -log "saw inferior exit" + if {!$saw_eof} { + exp_continue + } } } + + gdb_assert { $saw_eof && $saw_inferior_exit } $msg } } return 0 -- 1.9.3