summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-01-26 06:35:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:30 -0500
commit415427b12ca5658ee8a2be5b530a5304bf8f1efd (patch)
treeba9bb9afd6bb24195ee8ae0662c86f69453760e5
parent573c07243d880e76805a9993978d7432a80a6df2 (diff)
downloadsamba-415427b12ca5658ee8a2be5b530a5304bf8f1efd.tar.gz
samba-415427b12ca5658ee8a2be5b530a5304bf8f1efd.tar.bz2
samba-415427b12ca5658ee8a2be5b530a5304bf8f1efd.zip
r13156: Add some tests for smbclient
(This used to be commit 861d45beda0e10b52ab8a82a1d92844d18685bba)
-rwxr-xr-xsource4/script/tests/test_smbclient.sh70
-rwxr-xr-x[-rw-r--r--]source4/script/tests/tests_all.sh1
-rwxr-xr-x[-rw-r--r--]source4/script/tests/tests_quick.sh0
3 files changed, 71 insertions, 0 deletions
diff --git a/source4/script/tests/test_smbclient.sh b/source4/script/tests/test_smbclient.sh
new file mode 100755
index 0000000000..de3ac13fe7
--- /dev/null
+++ b/source4/script/tests/test_smbclient.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_smbclient.sh SERVER USERNAME PASSWORD DOMAIN PREFIX
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+DOMAIN=$4
+PREFIX=$5
+shift 5
+failed=0
+
+runcmd() {
+ desc=$1
+ cmd=$2
+ shift 2
+ echo $cmd
+ bin/smbclient -c "$cmd" //$SERVER/tmp -U $DOMAIN\\$USERNAME%$PASSWORD
+ return $?
+}
+
+incdir=`dirname $0`
+. $incdir/test_functions.sh
+
+# Generate random file
+cat >tmpfile<<EOF
+foo
+bar
+bloe
+blah
+EOF
+
+# put that file
+runcmd "Putting file" "mput tmpfile" || failed=`expr $failed + 1`
+# check file info
+runcmd "Getting alternative name" "altname tmpfile" || failed=`expr $failed + 1`
+# run allinfo on that file
+runcmd "Checking info on file" "allinfo tmpfile" || failed=`expr $failed + 1`
+# get that file
+mv tmpfile tmpfile-old
+runcmd "Getting file" "mget tmpfile" || failed=`expr $failed + 1`
+# remove that file
+runcmd "Removing file" "rm tmpfile" || failed=`expr $failed + 1`
+# compare locally
+diff tmpfile-old tmpfile
+# create directory
+runcmd "Creating directory" "mkdir bla" || failed=`expr $failed + 1`
+# cd to directory
+runcmd "Changing directory" "cd bla" || failed=`expr $failed + 1`
+# cd to top level directory
+runcmd "Going back" "cd .." || failed=`expr $failed + 1`
+# remove directory
+runcmd "Removing directory" "rmdir bla" || failed=`expr $failed + 1`
+# enable recurse, create nested directory
+runcmd "Creating nested directory" "recurse; mkdir bla/bloe" || failed=`expr $failed + 1`
+# remove parent directory
+runcmd "Removing directory" "rmdir bla/bloe" || failed=`expr $failed + 1`
+# remove child directory
+runcmd "Removing directory" "rmdir bla" || failed=`expr $failed + 1`
+# run fsinfo
+runcmd "Getting file system info" "fsinfo objectid" || failed=`expr $failed + 1`
+
+rm tmpfile tmpfile-old
+
+testok $0 $failed
diff --git a/source4/script/tests/tests_all.sh b/source4/script/tests/tests_all.sh
index 70e72e7240..e940ec16c1 100644..100755
--- a/source4/script/tests/tests_all.sh
+++ b/source4/script/tests/tests_all.sh
@@ -9,3 +9,4 @@
$SRCDIR/script/tests/test_posix.sh //$SERVER/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?`
$SRCDIR/script/tests/test_local.sh || failed=`expr $failed + $?`
$SRCDIR/script/tests/test_pidl.sh || failed=`expr $failed + $?`
+ $SRCDIR/script/tests/test_smbclient.sh $SERVER $USERNAME $PASSWORD $DOMAIN $PREFIX || failed=`expr $failed + $?`
diff --git a/source4/script/tests/tests_quick.sh b/source4/script/tests/tests_quick.sh
index dd9230fb16..dd9230fb16 100644..100755
--- a/source4/script/tests/tests_quick.sh
+++ b/source4/script/tests/tests_quick.sh