From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112544 invoked by alias); 13 Apr 2016 15:24:24 -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 112522 invoked by uid 89); 13 Apr 2016 15:24:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 13 Apr 2016 15:24:17 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1aqMeN-0000p0-Bc from Luis_Gustavo@mentor.com ; Wed, 13 Apr 2016 08:24:15 -0700 Received: from [172.30.5.211] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Wed, 13 Apr 2016 08:24:14 -0700 Reply-To: Luis Machado Subject: Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files References: <1460489060-17307-1-git-send-email-lgustavo@codesourcery.com> <1460489060-17307-3-git-send-email-lgustavo@codesourcery.com> <570E62B7.1030409@redhat.com> To: Pedro Alves , From: Luis Machado Message-ID: <570E649D.7060108@codesourcery.com> Date: Wed, 13 Apr 2016 15:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <570E62B7.1030409@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00288.txt.bz2 On 04/13/2016 10:16 AM, Pedro Alves wrote: > On 04/12/2016 08:24 PM, Luis Machado wrote: > >> - Addressed comments and moved the test to a proc that can be called multiple >> times. >> - The testcase now exercises these permutations: >> >> * Unreadable file + empty sysroot >> * Unreadable file + target: sysroot >> * Removed file + empty sysroot >> * Removed file + target: sysroot >> >> With an unpatched GDB we should see this: >> >> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = permission: connection to GDBserver succeeded (the program is no longer running) >> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = delete: connection to GDBserver succeeded (the program is no longer running) >> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = permission: connection to GDBserver succeeded (the program is no longer running) >> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = delete: connection to GDBserver succeeded (the program is no longer running) >> >> A patched GDB should have full passes. > > Excellent. LGTM. A couple minor comments below. > >> + >> +#include >> + >> +int >> +main (int argc, char **argv) >> +{ >> + printf ("Hello world!\n"); >> + return 0; >> +} > > No need for stdio.h / printf, right? As a general principle, > if the test doesn't need those, best just not to compile > them in either. > Nope. Fixed. >> +# Make sure we have the original symbol file in a safe place to copy from. >> +gdb_remote_download host $binfile $binfile.bak >> + >> +# Run the test with different permutations. >> +foreach sysroot $sysroots { >> + foreach action $file_actions { >> + with_test_prefix "test sysroot = \"$sysroot\" action = $action" { >> + connect_no_symbol_file $sysroot $action >> + } >> + } >> +} >> > > Note you can simplify using foreach_with_prefix. No need > for the separate variables then: > > foreach_with_prefix sysroot {"" "target:"} { > foreach_with_prefix action {"permission" "delete"} { > connect_no_symbol_file $sysroot $action > } > } > Ah, handy! Thanks for the suggestion. > Thanks, > Pedro Alves >