summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>2013-06-17 19:22:10 +1000
committerBen Elliston <bje@gnu.org>2013-06-17 19:22:10 +1000
commit5481f29161477520c691d525653323b82fa47ad7 (patch)
treea2b8516f22fc55175e4f2d512835a5f186189801 /testsuite
parentb97cf09cd7b79d87b4ecfa064657140e25a8958e (diff)
downloaddejagnu-5481f29161477520c691d525653323b82fa47ad7.tar.gz
dejagnu-5481f29161477520c691d525653323b82fa47ad7.tar.bz2
dejagnu-5481f29161477520c691d525653323b82fa47ad7.zip
* runtest.exp (libdirs): New global variable.
(load_lib): Append libdirs to search_and_load_files directories. * doc/ref.xml (load_lib): Document global variable libdirs. * doc/dejagnu.texi: Regenerate. * testsuite/runtest.all/load_lib.exp: New testcase. * Makefile.am (TESTSUITE_FILES): Add new testcase. * Makefile.in: Regenerate. Signed-off-by: Ben Elliston <bje@gnu.org>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtest.all/load_lib.exp44
1 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/runtest.all/load_lib.exp b/testsuite/runtest.all/load_lib.exp
new file mode 100644
index 0000000..55a3a07
--- /dev/null
+++ b/testsuite/runtest.all/load_lib.exp
@@ -0,0 +1,44 @@
+# test load_lib
+
+# Verify that load_lib searches for a lib not only in it's default
+# search_dirs but also in the libdirs list of directories.
+
+# load_lib f exits with a failure if it does not find f.
+# Arrange for the testcase to handle this:
+rename exit saved_exit
+proc exit { args } { return [lindex $args 0] }
+
+# The test right below is supposed to fail.
+# Prettify default output by only printing the message in verbose mode.
+rename send_error saved_send_error
+proc send_error { args } {
+ verbose [lindex $args 0] 2
+}
+
+if { [ load_lib "subfile1" ] != 1} {
+ fail "load_lib subfile1 found per default"
+} else {
+ pass "load_lib subfile1 not found per default"
+}
+
+rename send_error ""
+rename saved_send_error send_error
+
+set extradir [file join $srcdir $subdir "topdir" "subdir1" ]
+global libdirs
+lappend libdirs $extradir
+verbose "now added libdirs: $libdirs" 2
+
+# In this testcase, we did not exit 1 from load_lib as per above rename.
+# subfile1 thus is in the loaded_libs LUT and we won't walk the
+# search_dirs again. Use another file for testing the lappend worked.
+
+if { [load_lib "subfile2"] == ""} {
+ pass "load_lib subfile2 loaded"
+} else {
+ fail "load_lib subfile2 not found"
+}
+
+# cleanup after us
+rename exit ""
+rename saved_exit exit