1#
2# Test misc file operations
3#
4
5# Initialisation
6
7load_lib env-single.exp
8load_lib smbclient.exp
9
10set timeout 10
11
12# Spawn a connection
13
14if {![spawn_smbclient //$server/$share -U $user]} {
15    perror "error spawning smbclient"
16    return -1
17}
18
19# Do wildcard rename test
20
21foreach { op } {"!touch /tmp/test.out\r" "lcd /tmp\r" "rm test.out\r" \
22	"put test.out\r"} {
23
24    set action "doing $op"
25    set output [do_smbclient $op $action]
26
27    if {[regexp "ERR" $output]} {
28  	perror $action
29	puts $output
30  	return -1;
31    }
32}
33
34file delete "/tmp/test.out"
35
36# Perform rename
37
38set output [do_smbclient "rename *.out *.dat\r" "wildcard rename"]
39
40if {[regexp "ERR" $output]} {
41    perror "wildcard rename didn't work"
42    return -1
43}
44
45# Check it worked
46
47set testname "wildcard match"
48set output [do_smbclient "dir\r" "wildcard rename check"]
49
50if {[regexp "test.dat" $output]} {
51    pass $testname
52} else {
53    fail $testname
54}
55
56# Clean up
57
58set op "rm test.dat\r"
59do_smbclient $op "doing $op"
60