X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=stest%2Fcommon.tcl;h=8897bd90da340a99b4529b65e736691673c7cbb9;hb=49b56eafcd147185c28848a7c04e31a32c49a82e;hp=6ab275ecadbfef231f77980ef0c3f9d5fb34392d;hpb=e77612523bf4ad49049da75f5b24180e835ab105;p=secnet.git diff --git a/stest/common.tcl b/stest/common.tcl index 6ab275e..8897bd9 100644 --- a/stest/common.tcl +++ b/stest/common.tcl @@ -99,6 +99,12 @@ exec cat key-cache priv-cache({ privkeys \"$builddir/${privkey}priv.\"; }); +" + } + {load-private *} { + set sitesconf sites-nonego.conf + append cfg " + local-key load-private(\"[lindex $privkey 1]\",\"$builddir/[lindex $privkey 2]\"); " } * { @@ -171,7 +177,7 @@ proc spawn-secnet {location site} { } set argl [list $secnet -dvnc $cf] set divertk SECNET_STEST_DIVERT_$site - puts -nonewline "spawn" + puts "spawn:" foreach k [array names env] { switch -glob $k { SECNET_STEST_DIVERT_* - @@ -180,19 +186,26 @@ proc spawn-secnet {location site} { *PRELOAD* { puts -nonewline " $k=$env($k)" } } } - puts " $argl" if {[info exists env($divertk)]} { switch -glob $env($divertk) { - i { + i - {i *} { + regsub {^i} $env($divertk) {} divert_prefix + puts "$divert_prefix $argl" puts -nonewline "run ^ command, hit return " flush stdout gets stdin set argl {} } 0 - "" { + puts " $argl" } - * { + /* - ./* { + puts " $argl" set argl [split $env($divertk)] + puts "... $argl" + } + * { + error "$divertk not understood" } } } @@ -343,14 +356,20 @@ proc udp-relay {data src sock args} { } } +proc adj-after {timeout args} { + upvar #0 env(SECNET_STEST_TIMEOUT_MUL) mul + if {[info exists mul]} { set timeout [expr {$timeout * $mul}] } + eval after $timeout $args +} + proc test-kex {} { udp-proxy spawn-secnet in inside spawn-secnet out outside - after 500 sendpkt - after 1000 sendpkt - after 5000 timed-out + adj-after 500 sendpkt + adj-after 1000 sendpkt + adj-after 5000 timed-out vwait ok }