aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-04-17 17:43:11 +0000
committerPedro Alves <palves@redhat.com>2012-04-17 17:43:11 +0000
commitf3525b7005f35963fd600d819b85d34cffb5dbca (patch)
treec979db83966d349c653f7bf4ebd120f48605af2f /gdb/testsuite
parent4dc84fd1097fab1fb14a6c77a6b77003296d27eb (diff)
downloadgdb-f3525b7005f35963fd600d819b85d34cffb5dbca.zip
gdb-f3525b7005f35963fd600d819b85d34cffb5dbca.tar.gz
gdb-f3525b7005f35963fd600d819b85d34cffb5dbca.tar.bz2
2012-04-17 Pedro Alves <palves@redhat.com>
* Makefile.in (site.exp): Make site.exp source $srcdir/lib/append_gdb_boards_dir.exp. * lib/append_gdb_boards_dir.exp: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/Makefile.in1
-rw-r--r--gdb/testsuite/lib/append_gdb_boards_dir.exp48
3 files changed, 55 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index de35ced..4c349dd 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-04-17 Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (site.exp): Make site.exp source
+ $srcdir/lib/append_gdb_boards_dir.exp.
+ * lib/append_gdb_boards_dir.exp: New file.
+
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
New option "set auto-load safe-path".
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index b06c382..6711930 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -120,6 +120,7 @@ $(abs_builddir)/site.exp site.exp: ./config.status Makefile
@echo "set build_triplet ${build_canonical}" >> ./tmp0
@echo "set srcdir ${srcdir}" >> ./tmp0
@echo "set tool gdb" >> ./tmp0
+ @echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
@cat ./tmp0 > site.exp
@cat site.bak | sed \
diff --git a/gdb/testsuite/lib/append_gdb_boards_dir.exp b/gdb/testsuite/lib/append_gdb_boards_dir.exp
new file mode 100644
index 0000000..4b01f2b
--- /dev/null
+++ b/gdb/testsuite/lib/append_gdb_boards_dir.exp
@@ -0,0 +1,48 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make the boards under testsuite/boards automatically available to
+# DejaGnu. This is sourced by the `site.exp' file generated in the
+# root of the testsuite's build directory.
+
+# Append GDB's boards dir to DejaGnu's board dir list, making sure
+# that that is the last boards dir in the list, so that boards found
+# in directories appended to the list by either the global config
+# site.exp, or in `$(dirname $DEJAGNU)/boards' override GDB's boards.
+# Unfortunately, there's no standard way to get that behavior. To
+# make it happen, we trace all writes to the $boards_dirs global, and
+# make sure our dir is always the last in the list. This relies on
+# the fact that DejaGnu always writes to this variable, even if just
+# to set it to the empty list, which it does.
+#
+proc append_gdb_boards_dir { name1 name2 op } {
+ global srcdir
+ global boards_dir
+
+ # In case someone wants to point at GDB's boards dir in the global
+ # config before some other board dir, in which case we should not
+ # push it to the end of the list, use an unlikely path to GDB's
+ # boards, so it compares different to other simpler but equivalent
+ # paths.
+ set gdb_boards_dir "${srcdir}/boards/../boards"
+
+ # Keep our board dir last in the list.
+ set idx [lsearch -exact $boards_dir "$gdb_boards_dir"]
+ if { $idx >= 0 } {
+ set boards_dir [lreplace $boards_dir $idx $idx]
+ }
+ lappend boards_dir "${gdb_boards_dir}"
+}
+trace variable "boards_dir" w append_gdb_boards_dir