From patchwork Thu Apr 9 19:36:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Gustavo X-Patchwork-Id: 6119 Received: (qmail 19678 invoked by alias); 9 Apr 2015 19:36:23 -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 18658 invoked by uid 89); 9 Apr 2015 19:36:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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; Thu, 09 Apr 2015 19:36:20 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1YgIFN-0001Sb-Jt from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Thu, 09 Apr 2015 12:36:17 -0700 Received: from [172.30.13.94] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Thu, 9 Apr 2015 12:36:17 -0700 Message-ID: <5526D4A1.9090203@mentor.com> Date: Thu, 9 Apr 2015 16:36:01 -0300 From: Luis Gustavo Reply-To: "Gustavo, Luis" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "'gdb-patches@sourceware.org'" Subject: [PATCH] Harden gdb.base/coredump-filter.exp X-IsSubscribed: yes This testcase seems to assume the target is running Linux, so bare metal, simulators and other debugging stubs running different OS' will have a hard time executing some of the commands the testcase issues. Even restricting the testcase to Linux systems (which the patch below does), there are still problems with, say, QEMU not providing PID information when "info inferior" is issued. As a consequence, the subsequent tests will either fail or will not make much sense. The attached patch checks if PID information is available. If not, it just bails out and avoids running into a number of failures. No regressions on x86-64. For QEMU, i see only a couple PASSes before it is done with the testcase. OK? 2015-04-09 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. 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 + # out as the rest of the test may rely on it, giving spurious failures. + return -1 + } } # Get the main function's address.