Refactoring: net_sh_run uses ndr_syntax_id instead of pipe_idx
[kai/samba.git] / testsuite / server / xfer.exp
1 #
2 # Test file transfer
3 #
4
5 # Initialisation
6
7 load_lib util-defs.exp
8 load_lib smbclient.exp
9 load_lib env-single.exp
10
11 set timeout 60
12
13 # Spawn a connection
14
15 if {![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
22 foreach { 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
37 set output [util_start "diff" "/tmp/file /tmp/file2" ""]
38
39 if {[regexp "differ" $output]} {
40     fail "xfertest"
41     puts $output
42 } else {
43     pass "xfertest"
44 }
45
46 # Clean up temporary files
47
48 file delete /tmp/file /tmp/file2