From patchwork Fri Apr 10 13:11:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 6134 Received: (qmail 37623 invoked by alias); 10 Apr 2015 13:11:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 37610 invoked by uid 89); 10 Apr 2015 13:11:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Apr 2015 13:11:28 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YgYiS-0000LX-R0 from Luis_Gustavo@mentor.com ; Fri, 10 Apr 2015 06:11:24 -0700 Received: from [172.30.1.34] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Fri, 10 Apr 2015 06:11:24 -0700 Message-ID: <5527CBEC.6030002@codesourcery.com> Date: Fri, 10 Apr 2015 10:11:08 -0300 From: Luis Machado Reply-To: Luis Machado User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Yao Qi CC: "'gdb-patches@sourceware.org'" Subject: Re: [PATCH] Harden gdb.base/coredump-filter.exp References: <5526D4A1.9090203@mentor.com> <86pp7cv23w.fsf@gmail.com> In-Reply-To: <86pp7cv23w.fsf@gmail.com> X-IsSubscribed: yes On 04/10/2015 05:06 AM, Yao Qi wrote: > Luis Gustavo writes: > >> diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp >> index f3203be..4c6c6ed 100644 >> --- a/gdb/testsuite/gdb.base/coredump-filter.exp >> +++ b/gdb/testsuite/gdb.base/coredump-filter.exp >> @@ -15,6 +15,12 @@ >> >> standard_testfile >> >> +# This test is Linux-only. >> +if ![istarget *-*-linux*] then { >> + unsupported "coredump-filter.exp" >> + return -1 >> +} >> + >> if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { >> untested "could not compile test program" >> return -1 >> @@ -146,6 +152,11 @@ gdb_test_multiple "info inferiors" "getting inferior pid" { >> -re "process \($decimal\).*\r\n$gdb_prompt $" { >> set infpid $expect_out(1,string) >> } >> + -re "Remote target.*$gdb_prompt $" { >> + # If the target does not provide PID information (like QEMU), just bail > > FAOD, QEMU here is QEMU user mode, isn't? > Yes, this is user mode. I suppose a system mode QEMU running gdbserver would work just fine. I made that information explicit in this updated version. >> + # out as the rest of the test may rely on it, giving spurious failures. >> + return -1 >> + } >> } > > We can just bail out if infpid is still "" after this gdb_test_multiple. > That still gives me one FAIL due to not matching what was expected. Did you mean a check inside this gdb_test_multiple? 2015-04-10 Luis Machado gdb/testsuite/ * gdb.base/coredump-filter.exp: Restrict test to Linux systems only. Handle the case of targets that do not provide PID information. --- gdb/testsuite/gdb.base/coredump-filter.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp index f3203be..8350981 100644 --- a/gdb/testsuite/gdb.base/coredump-filter.exp +++ b/gdb/testsuite/gdb.base/coredump-filter.exp @@ -15,6 +15,12 @@ standard_testfile +# This test is Linux-only. +if ![istarget *-*-linux*] then { + untested "coredump-filter.exp" + return -1 +} + if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { untested "could not compile test program" return -1 @@ -146,6 +152,12 @@ gdb_test_multiple "info inferiors" "getting inferior pid" { -re "process \($decimal\).*\r\n$gdb_prompt $" { set infpid $expect_out(1,string) } + -re "Remote target.*$gdb_prompt $" { + # If the target does not provide PID information (like usermode QEMU), + # just bail out as the rest of the test may rely on it, giving spurious + # failures. + return -1 + } } # Get the main function's address. -- 1.9.1