From 820fe96b181d1f552475b5b7e15673299612f4ce Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Nov 2019 00:38:01 +0000 Subject: [PATCH] stest: Support not running secnet ourselves Now the user can set SECNET_STEST_DIVERT_inside=1 (say) and instead of actually running secnet, we print the rune we would run and ask the user when they have started it. A freshly started secnet (with this config, at least) just sits there waiting for its first packet to deal with. So if the user does this for the 2nd secnet, that's fine - the first one will happily wait until the test actually gets going. Signed-off-by: Ian Jackson --- stest/common.tcl | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/stest/common.tcl b/stest/common.tcl index e368f11..9dff1f0 100644 --- a/stest/common.tcl +++ b/stest/common.tcl @@ -117,18 +117,37 @@ proc spawn-secnet {location site} { puts $ch [mkconf $location $site] close $ch set argl [list $builddir/secnet -dvnc $cf] + set divertk SECNET_STEST_DIVERT_$site puts -nonewline "spawn" foreach k [array names env] { switch -glob $k { + SECNET_STEST_DIVERT_* - SECNET_TEST_BUILDDIR { } *SECNET* - *PRELOAD* { puts -nonewline " $k=$env($k)" } } } puts " $argl" - set pid [fork] - if {!$pid} { - execl [lindex $argl 0] [lrange $argl 1 end] + if {[info exists env($divertk)]} { + switch -glob $env($divertk) { + i { + puts -nonewline "run ^ command, hit return " + flush stdout + gets stdin + set argl {} + } + 0 - "" { + } + * { + set argl [split $env($divertk)] + } + } + } + if {[llength $argl]} { + set pid [fork] + if {!$pid} { + execl [lindex $argl 0] [lrange $argl 1 end] + } } puts -nonewline $netlinkfh($site.t) [hbytes h2raw c0] } -- 2.30.2