Test harness stuff for compiling things.
[ira/wip.git] / testsuite / lib / smbclient.exp
1 #
2 # Utilities for driving smbclient
3 #
4
5 # Variables
6
7 set smb_prompt "smb: \\\\>"
8
9 # Spawn smbclient and wait for a prompt
10
11 proc spawn_smbclient { args } {
12     set result 0
13     global smb_prompt
14     global spawn_id
15
16     # Spawn smbclient
17
18     spawn smbclient [lindex $args 0] [lindex $args 1] [lindex $args 2]
19
20     # Wait for prompt
21
22     expect {
23         $smb_prompt   { set result 1 }
24         timeout       { perror "timed out spawning smbclient" }
25         eof           { perror "end of file spawning smbclient" }
26     }
27
28     return $result
29 }
30
31 # Run a command and wait for a prompt
32
33 proc do_smbclient { args } {
34     set action [lindex $args 0]
35     set description [lindex $args 1]
36     global smb_prompt
37
38     # Send command
39
40     verbose $action
41
42     send $action
43
44     expect {
45         $smb_prompt     {}
46         timeout         { perror "timed out $description"; return -1}
47         eof             { perror "end of file description"; return -1 }
48     }
49
50     verbose $expect_out(buffer)
51     return $expect_out(buffer)
52 }