33 lines
697 B
Plaintext
33 lines
697 B
Plaintext
|
#! /usr/bin/env expect
|
||
|
|
||
|
##
|
||
|
# Wait for a specific output of a already running spawned process
|
||
|
#
|
||
|
proc wait_for_output { wait_for_re timeout_value running_spawn_id } {
|
||
|
global output
|
||
|
|
||
|
if {$wait_for_re == "forever"} {
|
||
|
set timeout -1
|
||
|
interact {
|
||
|
\003 {
|
||
|
send_user "Expect: 'interact' received 'strg+c' and was cancelled\n";
|
||
|
exit
|
||
|
}
|
||
|
-i $running_spawn_id
|
||
|
}
|
||
|
} else {
|
||
|
set timeout $timeout_value
|
||
|
}
|
||
|
|
||
|
expect {
|
||
|
-i $running_spawn_id -re $wait_for_re { }
|
||
|
eof { puts stderr "Error: Spawned process died unexpectedly"; exit -1 }
|
||
|
timeout { puts stderr "Error: Test execution timed out"; exit -1 }
|
||
|
}
|
||
|
set output $expect_out(buffer)
|
||
|
}
|
||
|
|
||
|
eval $env(baseSetup)
|
||
|
|
||
|
eval $env(testScript)
|