From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 172EE38A1033 for ; Wed, 11 Mar 2020 18:32:15 +0000 (GMT) X-ASG-Debug-ID: 1583951533-0c856e098a11eb550001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id Nw6R8DNOKsyeTK2B (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Mar 2020 14:32:13 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by smtp.ebox.ca (Postfix) with ESMTP id 10024441D8B; Wed, 11 Mar 2020 14:32:13 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-181-218.qc.cable.ebox.net[192.222.181.218] X-Barracuda-Apparent-Source-IP: 192.222.181.218 X-Barracuda-RBL-IP: 192.222.181.218 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] testsuite: use cygpath to convert from Unix to Windows paths Date: Wed, 11 Mar 2020 14:32:12 -0400 X-ASG-Orig-Subj: [PATCH] testsuite: use cygpath to convert from Unix to Windows paths Message-Id: <20200311183212.28601-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1583951533 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2302 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.80606 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 11 Mar 2020 18:32:15 -0000 When on a MinGW host, standard_output_file uses a regular expression to convert Unix-style paths of the form "/c/foo" to "c:/foo". This is needed because the paths we pass to GDB (for example, with the "file" command) need to be in the Windows form. However, the regexp only works if your binutils-gdb repo is under a `/[a-z]/...` path (the Unix paths mapping to Windows drives). Presumably, that works if you clone the repo in Windows, then access it through `/c/...`. In my case, I've cloned the repository directly inside my MinGW shell, so in /home/smarchi. The regexp therefore doesn't work for me. The path doesn't get transformed, and the file command fails when running any test: (gdb) file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent: No such file or directory. A safer way to do this conversion would be to use the cygpath utility. It can be used to convert any MinGW path into its Windows equivalent. Note that despite originally coming from Cygwin, the cygpath utility is distributed by mingw-w64 and can be used in that environment. With this, the file command in the test succeeds: (gdb) file C:/msys64/home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent Reading symbols from C:/msys64/home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent... gdb/testsuite/ChangeLog: * lib/gdb.exp (standard_output_file): Use cygpath to convert from Unix to Windows path. --- gdb/testsuite/lib/gdb.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 9614e8dc87cd..ac16e0e85c99 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4899,8 +4899,10 @@ proc standard_output_file {basename} { file mkdir $dir # If running on MinGW, replace /c/foo with c:/foo if { [ishost *-*-mingw*] } { - set dir [regsub {^/([a-z])/} $dir {\1:/}] + set dir [exec cygpath --mixed "${dir}"] + } + return [file join $dir $basename] } -- 2.25.1