PATCH: add search path for tool init file (part of fix for Automake misintegration)

Jacob Bachmeyer <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
This patch fixes the problem of the first "make check" after running 
configure complaining about being unable to find tool init files that I 
have previously described.

ChangeLog entry
--
	* runtest.exp (load_lib): Clean up whitespace.
	(load_tool_init): Search for tool init file instead of assuming
	exactly one location.  Backwards compatibility is maintained.
--
Patch attached due to whitespace issues.


-- Jacob

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
add_tool_search.patch (text/plain, 1.7 KB)
diff --git a/runtest.exp b/runtest.exp
index 84e3e6b..5ced8ab 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -596,7 +596,7 @@ proc load_lib { file } {
     set loaded_libs($file) ""
     set search_dirs [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]
     if {[info exists libdirs]} {
-        lappend search_dirs $libdirs
+	lappend search_dirs $libdirs
     }
     if { [search_and_load_file "library file" $file $search_dirs ] == 0 } {
 	send_error "ERROR: Couldn't find library file $file.\n"
@@ -929,25 +929,21 @@ proc load_tool_init { file } {
     global srcdir
     global loaded_libs
 
-    if {[info exists loaded_libs($file)]} {
+    if {[info exists loaded_libs(tool/$file)]} {
 	return
     }
 
-    set loaded_libs($file) ""
-
-    verbose "Looking for tool init file $srcdir/lib/$file"
+    set loaded_libs(tool/$file) ""
 
-    if {[file exists [file join ${srcdir} lib $file]]} {
-	verbose "Loading library file ${srcdir}/lib/$file"
-	if { [catch "uplevel #0 source ${srcdir}/lib/$file"] == 1 } {
-	    send_error "ERROR: tcl error sourcing library file ${srcdir}/lib/$file.\n"
-	    global errorInfo
-	    if {[info exists errorInfo]} {
-		send_error "$errorInfo\n"
-	    }
-	    exit 1
-	}
+    if { [lindex [file split $srcdir] end] != "testsuite" } {
+	lappend searchpath [file join $srcdir testsuite lib tool]
+	lappend searchpath [file join $srcdir testsuite lib]
     } else {
+	lappend searchpath [file join $srcdir lib tool]
+    }
+    lappend searchpath [file join $srcdir lib]
+
+    if { ![search_and_load_file "tool init file" [list $file] $searchpath] } {
 	warning "Couldn't find tool init file"
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.