svn commit: samba r23964 - in branches/SAMBA_4_0: source/selftest testprogs/blackbox

abartlet at samba.org abartlet at samba.org
Thu Jul 19 06:40:44 GMT 2007


Author: abartlet
Date: 2007-07-19 06:40:42 +0000 (Thu, 19 Jul 2007)
New Revision: 23964

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23964

Log:
Update blackbox selftest scripts to cover more code, and to more
consistantly report errors.  (Some were being lost due to the "echo
foo | cmd" calling convention).

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/selftest/test_blackbox.sh
   branches/SAMBA_4_0/testprogs/blackbox/test_kinit.sh
   branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh


Changeset:
Modified: branches/SAMBA_4_0/source/selftest/test_blackbox.sh
===================================================================
--- branches/SAMBA_4_0/source/selftest/test_blackbox.sh	2007-07-19 06:12:47 UTC (rev 23963)
+++ branches/SAMBA_4_0/source/selftest/test_blackbox.sh	2007-07-19 06:40:42 UTC (rev 23964)
@@ -16,7 +16,7 @@
 incdir=`dirname $0`
 . $incdir/test_functions.sh
 
-plantest "blackbox.smbclient" dc $incdir/../../testprogs/blackbox/test_smbclient.sh "\$NETBIOSNAME" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS"
-plantest "blackbox.kinit" dc $incdir/../../testprogs/blackbox/test_kinit.sh "\$NETBIOSNAME" "\$USERNAME" "\$PASSWORD" "\$REALM" "$PREFIX" "$ADDARGS"
+plantest "blackbox.smbclient" dc $incdir/../../testprogs/blackbox/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS"
+plantest "blackbox.kinit" dc $incdir/../../testprogs/blackbox/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" "$ADDARGS"
 
-plantest "blackbox.cifsdd" dc $incdir/../../testprogs/blackbox/test_cifsdd.sh "\$NETBIOSNAME" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$ADDARGS"
+plantest "blackbox.cifsdd" dc $incdir/../../testprogs/blackbox/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$ADDARGS"

Modified: branches/SAMBA_4_0/testprogs/blackbox/test_kinit.sh
===================================================================
--- branches/SAMBA_4_0/testprogs/blackbox/test_kinit.sh	2007-07-19 06:12:47 UTC (rev 23963)
+++ branches/SAMBA_4_0/testprogs/blackbox/test_kinit.sh	2007-07-19 06:40:42 UTC (rev 23964)
@@ -1,8 +1,11 @@
 #!/bin/sh
+# Blackbox tests for kinit and kerberos integration with smbclient etc
+# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer at samba.org>
+# Copyright (C) 2006-2007 Andrew Bartlett <abartlet at samba.org>
 
 if [ $# -lt 5 ]; then
 cat <<EOF
-Usage: test_kinit.sh SERVER USERNAME PASSWORD REALM PREFIX
+Usage: test_kinit.sh SERVER USERNAME PASSWORD REALM DOMAIN PREFIX
 EOF
 exit 1;
 fi
@@ -11,8 +14,9 @@
 USERNAME=$2
 PASSWORD=$3
 REALM=$4
-PREFIX=$5
-shift 5
+DOMAIN=$5
+PREFIX=$6
+shift 6
 failed=0
 
 testit() {
@@ -30,16 +34,48 @@
 	return $status
 }
 
+
+test_smbclient() {
+	name="$1"
+	cmd="$2"
+	shift
+	shift
+	echo "test: $name"
+	$VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
+	status=$?
+	if [ x$status = x0 ]; then
+		echo "success: $name"
+	else
+		echo "failure: $name"
+	fi
+	return $status
+}
+
 KRB5CCNAME=`pwd`/tmpccache
 export KRB5CCNAME
 
 echo $PASSWORD > ./tmppassfile
-testit "kinit with password" samba4kinit --password-file=./tmppassfile --request-pac $USERNAME@$REALM   || failed=`expr $failed + 1`
-testit "kinit with pkinit" samba4kinit --request-pac --pk-user=FILE:$PREFIX/dc/private/tls/admincert.pem,$PREFIX/dc/private/tls/adminkey.pem $USERNAME@$REALM || failed=`expr $failed + 1`
+testit "kinit with password" bin/samba4kinit --password-file=./tmppassfile --request-pac $USERNAME@$REALM   || failed=`expr $failed + 1`
+testit "kinit with pkinit" bin/samba4kinit --request-pac --pk-user=FILE:$PREFIX/dc/private/tls/admincert.pem,$PREFIX/dc/private/tls/adminkey.pem $USERNAME@$REALM || failed=`expr $failed + 1`
 
-echo ls | testit "Test login with kerberos ccache" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
 
-testit "domain join with kerberos ccache" $VALGRIND bin/net join $DOMAIN $CONFIGURATION  -W "$DOMAIN" -k yes $@
+testit "domain join with kerberos ccache" $VALGRIND bin/net join $DOMAIN $CONFIGURATION  -W "$DOMAIN" -k yes $@ || failed=`expr $failed + 1`
 
-rm -f tmpccfile tmppassfile
+testit "add user with kerberos ccache" $VALGRIND bin/net user add nettestuser $CONFIGURATION  -k yes $@ || failed=`expr $failed + 1`
+USERPASS=testPass at 12%
+
+testit "set user password with kerberos ccache" $VALGRIND bin/net password set $DOMAIN\\nettestuser $USERPASS $CONFIGURATION  -k yes $@ || failed=`expr $failed + 1`
+
+#KRB5CCNAME=`pwd`/tmpuserccache
+#export KRB5CCNAME
+#
+#testit "kinit with user password" bin/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM   || failed=`expr $failed + 1`
+#
+#KRB5CCNAME=`pwd`/tmpccache
+#export KRB5CCNAME
+
+testit "del user with kerberos ccache" $VALGRIND bin/net user delete nettestuser $CONFIGURATION  -k yes $@ || failed=`expr $failed + 1`
+
+rm -f tmpccfile tmppassfile tmpuserccache
 exit $failed

Modified: branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh
===================================================================
--- branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh	2007-07-19 06:12:47 UTC (rev 23963)
+++ branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh	2007-07-19 06:40:42 UTC (rev 23964)
@@ -35,9 +35,18 @@
 
 runcmd() {
 	name="$1"
+	cmd="$2"
 	shift
-	testit "$name" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
-	return $?
+	shift
+	echo "test: $name"
+	$VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
+	status=$?
+	if [ x$status = x0 ]; then
+		echo "success: $name"
+	else
+		echo "failure: $name"
+	fi
+	return $status
 }
 
 testit "share and server list" $VALGRIND bin/smbclient -L $SERVER $CONFIGURATION  -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
@@ -53,59 +62,59 @@
 EOF
 
 # put that file
-echo mput tmpfile | runcmd "MPutting file" || failed=`expr $failed + 1`
+runcmd "MPutting file" 'mput tmpfile' || failed=`expr $failed + 1`
 # check file info
-echo altname tmpfile | runcmd "Getting alternative name" || failed=`expr $failed + 1`
+runcmd "Getting alternative name" 'altname tmpfile'|| failed=`expr $failed + 1`
 # run allinfo on that file
-echo allinfo tmpfile | runcmd "Checking info on file" || failed=`expr $failed + 1`
+runcmd "Checking info on file" 'allinfo tmpfile'|| failed=`expr $failed + 1`
 # get that file
 mv tmpfile tmpfile-old
-echo mget tmpfile | runcmd "MGetting file" || failed=`expr $failed + 1`
+runcmd "MGetting file" 'mget tmpfile' || failed=`expr $failed + 1`
 # remove that file
-echo rm tmpfile | runcmd "Removing file" || failed=`expr $failed + 1`
+runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
 # compare locally
 testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
 # create directory
 # cd to directory
 # cd to top level directory
 # remove directory
-echo "mkdir bla; cd bla; cd ..; rmdir bla" | runcmd "Creating directory, Changing directory, Going back, " || failed=`expr $failed + 1`
+runcmd "Creating directory, Changing directory, Going back, " 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=`expr $failed + 1`
 # enable recurse, create nested directory
-echo "recurse; echo mkdir bla/bloe; exit" | runcmd "Creating nested directory" || failed=`expr $failed + 1`
+runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=`expr $failed + 1`
 # remove parent directory
-echo rmdir bla/bloe | runcmd "Removing directory" || failed=`expr $failed + 1`
+runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1`
 # remove child directory
-echo rmdir bla | runcmd "Removing directory" || failed=`expr $failed + 1`
+runcmd "Removing directory" 'rmdir bla'|| failed=`expr $failed + 1`
 # run fsinfo
-echo fsinfo objectid | runcmd "Getting file system info" || failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1`
 
 # put that file
-echo put tmpfile | runcmd "Putting file" || failed=`expr $failed + 1`
+runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1`
 # get that file
 mv tmpfile tmpfile-old
-echo get tmpfile | runcmd "Getting file" || failed=`expr $failed + 1`
+runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1`
 # remove that file
-echo rm tmpfile | runcmd "Removing file" || failed=`expr $failed + 1`
+runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
 # compare locally
 testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
 # put that file
-echo put tmpfile tmpfilex | runcmd "Putting file with different name" || failed=`expr $failed + 1`
+runcmd "Putting file with different name" 'put tmpfile tmpfilex' || failed=`expr $failed + 1`
 # get that file
-echo get tmpfilex | runcmd "Getting file again" || failed=`expr $failed + 1`
+runcmd "Getting file again" 'get tmpfilex' || failed=`expr $failed + 1`
 # compare locally
 testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1`
 # remove that file
-echo rm tmpfilex | runcmd "Removing file" || failed=`expr $failed + 1`
+runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1`
 
 # do some simple operations using old protocol versions
-echo ls | runcmd "List directory with LANMAN1" -m LANMAN1 || failed=`expr $failed + 1`
-echo ls | runcmd "List directory with LANMAN2" -m LANMAN2 || failed=`expr $failed + 1`
+runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1`
+runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1`
 
-echo pwd | runcmd "Print current working directory" || failed=`expr $failed + 1`
+runcmd "Print current working directory" 'pwd'|| failed=`expr $failed + 1`
 
-echo ls | testit "Test login with --machine-pass without kerberos" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass -k no || failed=`expr $failed + 1`
+testit "Test login with --machine-pass without kerberos" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k no || failed=`expr $failed + 1`
 
-echo ls | testit "Test login with --machine-pass and kerberos" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass -k yes || failed=`expr $failed + 1`
+testit "Test login with --machine-pass and kerberos" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k yes || failed=`expr $failed + 1`
 
 (
     echo "password=$PASSWORD"
@@ -113,24 +122,24 @@
     echo "domain=$DOMAIN"
 ) > tmpauthfile
 
-echo ls | testit "Test login with --authentication-file" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile  || failed=`expr $failed + 1`
+testit "Test login with --authentication-file" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile  || failed=`expr $failed + 1`
 
 PASSWD_FILE="tmppassfile" 
 echo "$PASSWORD" > $PASSWD_FILE
 export PASSWD_FILE
-echo ls | testit "Test login with PASSWD_FILE" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+testit "Test login with PASSWD_FILE" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
 PASSWD_FILE=""
 export PASSWD_FILE
 unset PASSWD_FILE
 
 PASSWD="$PASSWORD" 
 export PASSWD
-echo ls | testit "Test login with PASSWD" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+testit "Test login with PASSWD" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
 
 oldUSER=$USER
 USER="$USERNAME" 
 export USER
-echo ls | testit "Test login with USER and PASSWD" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" | failed=`expr $failed + 1`
+testit "Test login with USER and PASSWD" $VALGRIND bin/smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" | failed=`expr $failed + 1`
 PASSWD=
 export PASSWD
 unset PASSWD



More information about the samba-cvs mailing list