From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11594 invoked by alias); 17 Nov 2011 12:08:03 -0000 Received: (qmail 11555 invoked by uid 22791); 17 Nov 2011 12:08:02 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Nov 2011 12:07:49 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RR0ku-0004nG-Kt from pedro_alves@mentor.com for gdb-patches@sourceware.org; Thu, 17 Nov 2011 04:07:48 -0800 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 17 Nov 2011 12:07:44 +0000 From: Pedro Alves To: Yao Qi Subject: Re: [patch 4/5] Test cases Date: Thu, 17 Nov 2011 12:08:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-12-generic; KDE/4.7.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <4EC20E2E.6010402@codesourcery.com> <201111161904.19664.pedro@codesourcery.com> <4EC47EED.8070500@codesourcery.com> In-Reply-To: <4EC47EED.8070500@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201111171207.42605.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-11/txt/msg00469.txt.bz2 On Thursday 17 November 2011 03:26:37, Yao Qi wrote: > On 11/17/2011 03:04 AM, Pedro Alves wrote: > >> > + send_gdb "disconnect\n" > >> > + gdb_expect { > >> > + -re "warning: Pending tracepoint will not be resolved while GDB is disconnected.*Ending remote debugging.*$gdb_prompt $" { > >> > + pass "disconnect with pending tracepoint" > >> > + } > >> > + -re ".*$gdb_prompt $" { > >> > + fail "disconnect with pending tracepoint" > >> > + } > >> > + } > > Why send_gdb/gdb_expect? > > Because gdb_test_multiple doesn't match pattern in output when "Ending > remote debugging" appeared in the output. We have to resort to > send_gdb/gdb_expect here. Hmm, I'm confused. In this new revision the test is now: send_gdb "disconnect\n" gdb_expect { -re "warning: Pending tracepoints will not be resolved while GDB is disconnected.*Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" { pass "disconnect with pending tracepoint" send_gdb "y\n" } timeout {fail "(timeout) disconnect with pending tracepoint"} } No "Ending remote debugging" in sight. GDB outputs that string after the "detach anyway" query, so I think gdb_test_multiple should just work. Also, we should always make sure to eat the prompt after the "y", so that it doesn't remain in expect's buffer and confuse following tests. Something like: set test "disconnect with pending tracepoint" gdb_test_multiple "disconnect" $test { -re "warning: Pending tracepoints will not be resolved while GDB is disconnected.*Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" { pass $test set test "disconnected" gdb_test_multiple "y" $test { -re "$gdb_prompt $" { pass "$test" } } } } Note that "$gdb_prompt $" match takes precedence over gdb_test_multiple's internal "Ending remote debugging.*$gdb_prompt $" match. Want to try that? -- Pedro Alves