OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / testing / utils / host-test.tcl
1 #!/usr/bin/expect --
2
3 #set send_slow {1 .1}
4 #proc send {ignore arg} {
5 #    sleep .1
6 #    exp_send -s -- $arg
7 #}
8
9 set timeout -1
10 puts "Program invoked with $argv\n"
11 set argl [split $argv]
12 set program [lindex $argl 0]
13 set script  [lindex $argl 1]
14 puts "Starting UML $program"
15 spawn $program single
16
17 expect -exact "normal startup):"
18 puts stderr "Logging in\n"
19 send -- "root\r"
20
21 set initscript [open $script r]
22 while {[gets $initscript line] >= 0} {
23     # skip empty lines.
24     if {[string length [string trimright $line]] == 0} {
25         continue;
26     }   
27     if {[string match [string index [string trimleft $line] 0] \#] == 0} {
28         expect -exact "# "
29         send -- "$line\r"
30     }
31 }
32
33 puts stderr "Initialization done\n"
34 if {[fork] != 0} exit
35
36 expect -exact "# "
37
38 #disconnect
39
40 expect eof
41
42
43
44