summaryrefslogtreecommitdiff
path: root/testsuite/server/xfer.exp
blob: 6d00b29885c29e722c124928fd412a230199c1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Test file transfer
#

# Initialisation

load_lib util-defs.exp
load_lib smbclient.exp
load_lib env-single.exp

set timeout 60

# Spawn a connection

if {![spawn_smbclient //$server/$share -U $user]} {
    perror "error spawning smbclient"
    return -1
}

# Create a big file, store it and fetch it again

foreach { op } { "!dd if=/dev/urandom of=/tmp/file bs=1048576 count=1\r" \
	"lcd /tmp\r" "put file\r" "get file /tmp/file2\r" } {

    set action "doing $op"
    set output [do_smbclient $op $action]

    if {[regexp "ERR" $output]} {
	error $action
	puts $output
	return -1
    }
}

# Compare the two files

set output [util_start "diff" "/tmp/file /tmp/file2" ""]

if {[regexp "differ" $output]} {
    fail "xfertest"
    puts $output
} else {
    pass "xfertest"
}

# Clean up temporary files

file delete /tmp/file /tmp/file2