This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Use Windows style directory separators when running sysroot tests under MinGW and Cygwin.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 15 Feb 2017 09:15:02 -0000
- Subject: [binutils-gdb] Use Windows style directory separators when running sysroot tests under MinGW and Cygwin.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=defe6f56b7c6ff106829ad3271ab9f1d501f4708
commit defe6f56b7c6ff106829ad3271ab9f1d501f4708
Author: Igor Kudrin <ikudrin@accesssoftek.com>
Date: Wed Feb 15 09:13:56 2017 +0000
Use Windows style directory separators when running sysroot tests under MinGW and Cygwin.
* testsuite/ld-scripts/sysroot-prefix.exp
(get_base_dir_for_scripts): New function.
(run_sysroot_prefix_test): Use get_base_dir_for_scripts.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/testsuite/ld-scripts/sysroot-prefix.exp | 20 +++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4bb505d..618ae81 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-15 Igor Kudrin <ikudrin@accesssoftek.com>
+
+ * testsuite/ld-scripts/sysroot-prefix.exp
+ (get_base_dir_for_scripts): New function.
+ (run_sysroot_prefix_test): Use get_base_dir_for_scripts.
+
2017-02-13 Palmer Dabbelt <palmer@dabbelt.com>
* emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Change
diff --git a/ld/testsuite/ld-scripts/sysroot-prefix.exp b/ld/testsuite/ld-scripts/sysroot-prefix.exp
index 2bb67e4..0fc322e 100644
--- a/ld/testsuite/ld-scripts/sysroot-prefix.exp
+++ b/ld/testsuite/ld-scripts/sysroot-prefix.exp
@@ -39,6 +39,24 @@ if {$ld_sysroot == "/"} {
set with_sysroot 3
}
+# The linker on Windows expects Windows style paths.
+# MSYS2 runtime converts paths in the command line automatically.
+# However, for our test linker scripts, we have to prepare
+# the correct paths manually.
+proc get_base_dir_for_scripts {} {
+ global base_dir
+ global get_base_dir_for_scripts_saved
+
+ if { ![info exists get_base_dir_for_scripts_saved] } {
+ set get_base_dir_for_scripts_saved $base_dir
+ if { ([ishost *-*-cygwin] || [ishost *-*-mingw*] )
+ && ![catch "exec cygpath -m $base_dir" base_dir_converted] } {
+ set get_base_dir_for_scripts_saved $base_dir_converted
+ }
+ }
+ return $get_base_dir_for_scripts_saved
+}
+
# Entries in the array-tables:
# 0: Testtype; an inclusive bitmask indicating that the test should run on a
# build configured for: 1: non-sysroot, 2: sysroot != "/", 4: sysroot == "/".
@@ -160,7 +178,7 @@ proc run_sysroot_prefix_test { type name templ p ldopt errstr } {
set qlist { { "quoted" "\"" } { "unquoted" {} } }
regsub -all "@p@" $templ $p templ
- regsub -all "@cwd@" $templ "$base_dir/tmpdir" templ
+ regsub -all "@cwd@" $templ "[get_base_dir_for_scripts]/tmpdir" templ
regsub -all "@cwd@" $ldopt "$base_dir/tmpdir" ldopt
regsub -all "@cwd@" $name "<CWD>" name