David,

Can you please try out this patch?

2011-03-02  Ben Elliston  <b...@gnu.org>

        * lib/framework.exp (unknown): Rename the native Tcl ::unknown
        proc to ::tcl_unknown.  If ::tcl_unknown returns a failure result,
        then fall back to the conventional DejaGnu handling.

diff --git a/lib/framework.exp b/lib/framework.exp
index ca672a0..b7b5c48 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -259,21 +259,26 @@ proc isnative { } {
 
 # unknown -- called by expect if a proc is called that doesn't exist
 #
-proc unknown { args } {
-    global errorCode
-    global errorInfo
-    global exit_status
+# Rename unknown to tcl_unknown so that we can wrap tcl_unknown.
+# This allows Tcl package autoloading to work in the modern age.
 
-    clone_output "ERROR: (DejaGnu) proc \"$args\" does not exist."
-    if {[info exists errorCode]} {
-        send_error "The error code is $errorCode\n"
-    }
-    if {[info exists errorInfo]} {
-        send_error "The info on the error is:\n$errorInfo\n"
-    }
+rename ::unknown ::tcl_unknown
+proc unknown args {
+    if {[catch {uplevel 1 ::tcl_unknown $args} msg]} {
+       global errorCode
+       global errorInfo
+       global exit_status
 
-    set exit_status 1
-    log_and_exit
+       clone_output "ERROR: (DejaGnu) proc \"$args\" does not exist."
+       if {[info exists errorCode]} {
+           send_error "The error code is $errorCode\n"
+       }
+       if {[info exists errorInfo]} {
+           send_error "The info on the error is:\n$errorInfo\n"
+       }
+       set exit_status 1
+       log_and_exit
+    }
 }
 
 # Print output to stdout (or stderr) and to log file


_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
http://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to