summaryrefslogtreecommitdiffstats
path: root/testsuite/server
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/server')
-rw-r--r--testsuite/server/ipc.exp44
-rw-r--r--testsuite/server/masktest.exp57
-rw-r--r--testsuite/server/rename.exp59
-rw-r--r--testsuite/server/xfer.exp48
4 files changed, 208 insertions, 0 deletions
diff --git a/testsuite/server/ipc.exp b/testsuite/server/ipc.exp
new file mode 100644
index 00000000000..ae0688872a8
--- /dev/null
+++ b/testsuite/server/ipc.exp
@@ -0,0 +1,44 @@
+#
+# Test operations on IPC$ share
+#
+
+# Initialisation
+
+load_lib env-single.exp
+load_lib smbclient.exp
+
+set timeout 10
+
+# Spawn a smbclient
+
+if {![spawn_smbclient //$server/ipc\$ -U $user]} {
+ perror "error spawning smbclient"
+ return -1
+}
+
+#
+# Start performing tests
+#
+
+global smb_prompt
+
+do_smbclient "lcd /tmp\r" "lcd /tmp"
+do_smbclient "!touch test.out\r" "touch test.out"
+
+foreach { op } { "dir\r" "put test.out\r" "get test.out\r" \
+ "get /etc/passwd\r" "mkdir foo\r" "print test.out\r" } {
+
+ set action "doing $op"
+ set output [do_smbclient $op $action]
+
+ if {![regexp "ERR" $output]} {
+ fail $action
+ puts $output
+ } else {
+ pass $action
+ }
+}
+
+# Clean up
+
+file delete test.out
diff --git a/testsuite/server/masktest.exp b/testsuite/server/masktest.exp
new file mode 100644
index 00000000000..532291bffb8
--- /dev/null
+++ b/testsuite/server/masktest.exp
@@ -0,0 +1,57 @@
+#
+# Test various things using the masktest program
+#
+
+# Initialisation
+
+load_lib env-single.exp
+
+set timeout 10
+
+# Test each wildcard individually, then all together at once
+
+set testlist {{"abc" "<"} {"abc" ">"} {"abc" "\""} {"abc" "?"} {"abc" "*"} \
+ {"abc" "."} {"abc" "<>\"?*."}}
+
+foreach { test } $testlist {
+
+ set got_output 0
+ set fail 0
+
+ # Spawn masktest
+
+ spawn bin/masktest //$server/$share -U $user -n 1000 -a \
+ -f [lindex $test 0] -m [concat [lindex $test 0] [lindex $test 1]]
+
+ # Check output
+
+ while 1 {
+ expect {
+ -re "(...) (...) \[0-9\]+ mask=" {
+ if { $expect_out(1,string) != $expect_out(2,string) } {
+ fail "masktest [lindex $test 1]"
+ puts $expect_out(0,string);
+ set fail 1
+ break;
+ } else {
+ set got_output 1
+ }
+ }
+ eof { break }
+ }
+ }
+
+ # Produce result
+
+ set testname "[lindex $test 0] [lindex $test 1]"
+
+ if {$got_output} {
+ if {$fail} {
+ fail "masktest $testname"
+ } else {
+ pass "masktest $testname"
+ }
+ } else {
+ perror "no output seen for test $testname"
+ }
+}
diff --git a/testsuite/server/rename.exp b/testsuite/server/rename.exp
new file mode 100644
index 00000000000..77e7297776b
--- /dev/null
+++ b/testsuite/server/rename.exp
@@ -0,0 +1,59 @@
+#
+# Test misc file operations
+#
+
+# Initialisation
+
+load_lib env-single.exp
+load_lib smbclient.exp
+
+set timeout 10
+
+# Spawn a connection
+
+if {![spawn_smbclient //$server/$share -U $user]} {
+ perror "error spawning smbclient"
+ return -1
+}
+
+# Do wildcard rename test
+
+foreach { op } {"!touch /tmp/test.out\r" "lcd /tmp\r" "rm test.out\r" \
+ "put test.out\r"} {
+
+ set action "doing $op"
+ set output [do_smbclient $op $action]
+
+ if {[regexp "ERR" $output]} {
+ perror $action
+ puts $output
+ return -1;
+ }
+}
+
+file delete "/tmp/test.out"
+
+# Perform rename
+
+set output [do_smbclient "rename *.out *.dat\r" "wildcard rename"]
+
+if {[regexp "ERR" $output]} {
+ perror "wildcard rename didn't work"
+ return -1
+}
+
+# Check it worked
+
+set testname "wildcard match"
+set output [do_smbclient "dir\r" "wildcard rename check"]
+
+if {[regexp "test.dat" $output]} {
+ pass $testname
+} else {
+ fail $testname
+}
+
+# Clean up
+
+set op "rm test.dat\r"
+do_smbclient $op "doing $op"
diff --git a/testsuite/server/xfer.exp b/testsuite/server/xfer.exp
new file mode 100644
index 00000000000..6d00b29885c
--- /dev/null
+++ b/testsuite/server/xfer.exp
@@ -0,0 +1,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