1#
2# Test file transfer
3#
4
5# Initialisation
6
7load_lib util-defs.exp
8load_lib smbclient.exp
9load_lib env-single.exp
10
11set timeout 60
12
13# Spawn a connection
14
15if {![spawn_smbclient //$server/$share -U $user]} {
16    perror "error spawning smbclient"
17    return -1
18}
19
20# Create a big file, store it and fetch it again
21
22foreach { op } { "!dd if=/dev/urandom of=/tmp/file bs=1048576 count=1\r" \
23	"lcd /tmp\r" "put file\r" "get file /tmp/file2\r" } {
24
25    set action "doing $op"
26    set output [do_smbclient $op $action]
27
28    if {[regexp "ERR" $output]} {
29	error $action
30	puts $output
31	return -1
32    }
33}
34
35# Compare the two files
36
37set output [util_start "diff" "/tmp/file /tmp/file2" ""]
38
39if {[regexp "differ" $output]} {
40    fail "xfertest"
41    puts $output
42} else {
43    pass "xfertest"
44}
45
46# Clean up temporary files
47
48file delete /tmp/file /tmp/file2
49