aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-03-11 15:21:19 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-03-11 15:21:19 -0400
commit038b97fcd75a338a515fe7def5db142e6952ca7c (patch)
tree1f07105a7d06a85c768e35beb623570155f87336 /gdb/testsuite
parenta0761e34f054767de6d6389929d27e9015fb299b (diff)
downloadgdb-038b97fcd75a338a515fe7def5db142e6952ca7c.zip
gdb-038b97fcd75a338a515fe7def5db142e6952ca7c.tar.gz
gdb-038b97fcd75a338a515fe7def5db142e6952ca7c.tar.bz2
testsuite: use `pwd -W` to convert from Unix to Windows paths
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 is to execute `pwd -W` while in the directory we want the path for, this is what this patch does. I have also considered using the using the cygpath utility to do the conversion. It can be used to convert any MinGW path into its Windows equivalent. Despite originally coming from Cygwin, the cygpath utility is distributed by MinGW-w64 and can be used in that environment. However, it's not distributed with the non-MinGW-w64 MinGW. The `pwd -W` trick only works with directories that exist, which is the case here, so it's sufficient. 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 `pwd -W` to convert from Unix to Windows path.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/lib/gdb.exp2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f98edaf..19114c2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-11 Simon Marchi <simon.marchi@efficios.com>
+
+ * lib/gdb.exp (standard_output_file): Use `pwd -W` to convert
+ from Unix to Windows path.
+
2020-03-11 Tom de Vries <tdevries@suse.de>
* gdb.ada/minsyms.exp: Set language to ada.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 9614e8d..9e903ba 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4899,7 +4899,7 @@ 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 sh -c "cd ${dir} && pwd -W"]
}
return [file join $dir $basename]
}