From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95651 invoked by alias); 13 Apr 2016 15:16:14 -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 95615 invoked by uid 89); 13 Apr 2016 15:16:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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; Wed, 13 Apr 2016 15:16:10 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B123C04B30D; Wed, 13 Apr 2016 15:16:08 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3DFG7GT030944; Wed, 13 Apr 2016 11:16:07 -0400 Subject: Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files To: Luis Machado , gdb-patches@sourceware.org References: <1460489060-17307-1-git-send-email-lgustavo@codesourcery.com> <1460489060-17307-3-git-send-email-lgustavo@codesourcery.com> From: Pedro Alves Message-ID: <570E62B7.1030409@redhat.com> Date: Wed, 13 Apr 2016 15:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1460489060-17307-3-git-send-email-lgustavo@codesourcery.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00287.txt.bz2 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. > +# 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 } } Thanks, Pedro Alves