From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MXfwH5KB+F/DMgAAWB0awg (envelope-from ) for ; Fri, 08 Jan 2021 11:00:18 -0500 Received: by simark.ca (Postfix, from userid 112) id 752B31E99A; Fri, 8 Jan 2021 11:00:18 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BE9CE1E4F4 for ; Fri, 8 Jan 2021 11:00:17 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72A7C3982414; Fri, 8 Jan 2021 16:00:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72A7C3982414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610121617; bh=+6cR+9/Idxp2SjK0d+xyJ+qWtTSlC6Y9MqERle4RZ8E=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vyRSUrH8Jr71fCwLRgKwWzJHfqmvwmd3PzQY1cFw/rRrGqO7+My/XjUMTMsFhl8dL OrIzzwWV5HTM8gFmCtp73BpYv+Avaz23Fz9KvaYojcSL+tgCxzJd6Okk3moueYHIh0 wfjwutlNLUDQLF3vmxWd95AT9lpOgkPi4Jd6cZ4Q= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 307DB38618CC for ; Fri, 8 Jan 2021 16:00:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 307DB38618CC Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 108Fx5n4026687 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 8 Jan 2021 10:59:10 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 108Fx5n4026687 Received: from [10.0.0.213] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B3BC71E4F4; Fri, 8 Jan 2021 10:59:05 -0500 (EST) Subject: Re: [PATCH] Improve gdb_tilde_expand logic To: Andrew Burgess , Lancelot SIX References: <20210108001337.29164-1-lsix@lancelotsix.com> <20210108093058.GR2945@embecosm.com> Message-ID: <58a88de1-6c5d-98ec-62d2-860f9ad7a8a8@polymtl.ca> Date: Fri, 8 Jan 2021 10:59:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210108093058.GR2945@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 8 Jan 2021 15:59:06 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-01-08 4:30 a.m., Andrew Burgess wrote: > There's only very limited unit testing within GDB. You should write a > test in gdb/testsuite/.... that triggers this behaviour and check the > functionality that way. It might be difficult to write a .exp test that specifically targets this function... I think a selftest for this could be useful (in addition to something in a .exp file, if this ends up used for the index-cache directory, as discussed). The selftest could just call gdb_tilde_expand with "~/a/non/existent/directory" and make some simple assertions with the result. That selftest could probably be written directly in gdbsupport/gdb_tilde_expand.cc. That would be the first time a selftest is put in a gdbsupport file, but I don't think that will cause a problem. That test will be available in both GDB and GDBserver. You can check the test for gdb_realpath in gdb/utils.c if you want an example. Simon