~vcs-imports/samba/main

« back to all changes in this revision

Viewing changes to testsuite/lib/smbclient.exp

  • Committer: jerry
  • Date: 2006-07-14 21:48:39 UTC
  • Revision ID: vcs-imports@canonical.com-20060714214839-586d8c489a8fcead
gutting trunk to move to svn:externals

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
            [lindex $args 3] [lindex $args 4] [lindex $args 5] \
20
 
            [lindex $args 6]
21
 
 
22
 
    # Wait for prompt
23
 
 
24
 
    expect {
25
 
        $smb_prompt   { set result 1 }
26
 
        timeout       { perror "timed out spawning smbclient" }
27
 
        eof           { perror "end of file spawning smbclient" }
28
 
    }
29
 
 
30
 
    return $result
31
 
}
32
 
 
33
 
# Run a command and wait for a prompt
34
 
 
35
 
proc do_smbclient { args } {
36
 
    set action [lindex $args 0]
37
 
    set description [lindex $args 1]
38
 
    global smb_prompt
39
 
 
40
 
    # Send command
41
 
 
42
 
    verbose $action
43
 
 
44
 
    send $action
45
 
 
46
 
    expect {
47
 
        $smb_prompt     {}
48
 
        timeout         { perror "timed out $description"; return -1}
49
 
        eof             { perror "end of file $description"; return -1 }
50
 
    }
51
 
 
52
 
    verbose $expect_out(buffer)
53
 
    return $expect_out(buffer)
54
 
}