aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/lib
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2014-10-17 13:10:18 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2014-10-17 13:11:42 +0200
commit3f7308212cefe5cd958b29e0b9e92d92c4dbe941 (patch)
treedc100e5c5f17f5abcf8f260148e6b49dc8d9adf6 /ld/testsuite/lib
parentc1e29d6622533257267e6dd136a34f9785edfb28 (diff)
downloadgdb-3f7308212cefe5cd958b29e0b9e92d92c4dbe941.zip
gdb-3f7308212cefe5cd958b29e0b9e92d92c4dbe941.tar.gz
gdb-3f7308212cefe5cd958b29e0b9e92d92c4dbe941.tar.bz2
Fix ld tests with sysroot=/ and --enable-targets=all and test --print-sysroot
* ld-scripts/sysroot-prefix.exp: Log $ld_sysroot. Handle sysroot == "/" as a separate sysroot-configuration with separable test-types. (sysroot_prefix_tests): Include all existing sysroot tests in sysroot == "/" tests except exclude those where a --sysroot option is not specified. * lib/ld-lib.exp (check_sysroot_available): Rewrite to use --print-sysroot instead of relying on error code from using --sysroot=... Also, set $ld_sysroot. The reason we exclude not just the failing "full-path =-prefixed without" but also the passing "plain =-prefixed without but -Lpath" for sysroot == "/" is that for the latter to succeed, we have to make assumptions about the system not having a /sysroot directory or assumptions about its contents etc. When passing --enable-targets=all --enable-64-bit-bfd (the latter not required for a "64-bit-host" of course) the ld --help output got too much to handle for poor tcl (or maybe dejagnu is to blame) and remote_exec exited with an error, so the configuration being tested was mishandled as being a sysroot-less configuration. Using --version instead of --help would work too, but the new --print-sysroot option calls for nominal coverage, so why not use that instead.
Diffstat (limited to 'ld/testsuite/lib')
-rw-r--r--ld/testsuite/lib/ld-lib.exp14
1 files changed, 6 insertions, 8 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index ffdf805..7d2df22 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1669,16 +1669,14 @@ proc check_plugin_api_available { } {
return $plugin_api_available_saved
}
-# Returns true if the target ld supports sysroot.
+# Sets ld_sysroot to the current sysroot (empty if not supported) and
+# returns true if the target ld supports sysroot.
proc check_sysroot_available { } {
- global ld_sysroot_available_saved
- global ld
+ global ld_sysroot_available_saved ld ld_sysroot
if {![info exists ld_sysroot_available_saved]} {
- # Check if ld supports --sysroot *other* than empty
- # (non-sysroot linkers don't emit errors for --sysroot="").
- # The help-text by itself is no indication as it always lists --sysroot.
- set status [remote_exec host $ld "--sysroot=ldxyzzy --help >/dev/null"]
- if { [lindex $status 0] != 0 } {
+ # Check if ld supports --sysroot *other* than empty.
+ set ld_sysroot [string trimright [lindex [remote_exec host $ld "--print-sysroot"] 1]]
+ if { $ld_sysroot == "" } {
set ld_sysroot_available_saved 0
} else {
set ld_sysroot_available_saved 1