svn commit: samba r9562 - in branches/SAMBA_3_0/source/script/tests: .

jerry at samba.org jerry at samba.org
Wed Aug 24 03:09:49 GMT 2005


Author: jerry
Date: 2005-08-24 03:09:49 +0000 (Wed, 24 Aug 2005)
New Revision: 9562

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

Log:
successfully get the samba 3 smbtorture working (as a test case for infrastructre)
Added:
   branches/SAMBA_3_0/source/script/tests/t_002.sh
Modified:
   branches/SAMBA_3_0/source/script/tests/functions
   branches/SAMBA_3_0/source/script/tests/runtests.sh
   branches/SAMBA_3_0/source/script/tests/t_001.sh


Changeset:
Modified: branches/SAMBA_3_0/source/script/tests/functions
===================================================================
--- branches/SAMBA_3_0/source/script/tests/functions	2005-08-24 03:09:26 UTC (rev 9561)
+++ branches/SAMBA_3_0/source/script/tests/functions	2005-08-24 03:09:49 UTC (rev 9562)
@@ -40,3 +40,43 @@
 	fi
 }
 
+
+##
+## start/stop smbd daemon
+##
+check_nmbd_running()
+{
+	## the smbcontrol ping will return a 0 on success
+	smbcontrol $CONFIGURATION nmbd ping 2>&1 > /dev/null
+}
+
+start_nmbd()
+{
+	echo "Starting nmbd...."
+
+	nmbd $CONFIGURATION || return $?
+
+	sleep 1
+
+	# smbcontrol $CONFIGURATION `cat $PIDDIR/nmbd.pid` ping 2>&1 > /dev/null || return $?
+	kill -0 `cat $PIDDIR/nmbd.pid`
+}
+
+stop_nmbd()
+{
+	nmbd_pid=`cat $PIDDIR/nmbd.pid`
+	echo "Shutting down nmbd (pid $nmbd_pid)..."
+
+	## belt and braces; first kill and then send a shutdown message
+
+	kill -TERM $nmbd_pid 2> /dev/null
+	sleep 1
+
+	## check to see if smbd is already running
+	kill -0 $nmbd_pid 2> /dev/null
+	if test $? == 0; then
+		echo "Unable to stop nmbd!"
+		exit 2
+	fi
+}
+

Modified: branches/SAMBA_3_0/source/script/tests/runtests.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/runtests.sh	2005-08-24 03:09:26 UTC (rev 9561)
+++ branches/SAMBA_3_0/source/script/tests/runtests.sh	2005-08-24 03:09:49 UTC (rev 9562)
@@ -5,6 +5,10 @@
 	exit 1
 fi
 
+if [ $# == 2 ]; then
+	testnum=$2
+fi
+
 ##
 ## create the test directory
 ##
@@ -19,6 +23,9 @@
 ## setup the various environment variables we need
 ##
 
+USERNAME=`whoami`
+PASSWORD=test
+
 SRCDIR=`pwd`
 SCRIPTDIR=$SRCDIR/script/tests
 TMPDIR=$PREFIX_ABS/tmp
@@ -35,6 +42,7 @@
 export PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN
 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR
 export SRCDIR SCRIPTDIR
+export USERNAME PASSWORD
 
 ## 
 ## create the test directory layout
@@ -42,6 +50,7 @@
 
 /bin/rm -rf $PREFIX/*
 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $TMPDIR $LOGDIR $SOCKET_WRAPPER_DIR
+chmod 1777 $TMPDIR
 
 ##
 ## Create the common config include file with the basic settings
@@ -57,17 +66,46 @@
 	log file = $LOGDIR/log.%m
 	log level = 0
 
+	passdb backend = tdbsam
+
 	interfaces = lo
 	bind interfaces only = yes
 
-	panic action = $PREFIX_ABS/script/tests/gdb_backtrace /proc/%d/exe %d
+	panic action = $SCRIPTDIR/gdb_backtrace %d
 EOF
 
+cat >$LIBDIR/smb.conf<<EOF
+[global]
+	include = $LIBDIR/common.conf
+EOF
+
+
 ##
+## create a test account
+##
+
+(echo $PASSWORD; echo $PASSWORD) | smbpasswd -c $LIBDIR/smb.conf -L -s -a $USERNAME
+
+
+##
 ## ready to go...now loop through the tests
 ##
 
+if [ -f $SCRIPTDIR/t_$testnum.sh ]; then
+	testfile=$SCRIPTDIR/t_$testnum.sh
+	echo ">>>>>> Starting test driver `basename $testfile` <<<<<"
+	sh $testfile
+	if [ $? = 0 ]; then
+		echo ">>>>> test ok <<<<<"
+	else
+		echo ">>>>> test failed <<<<<"
+	fi
+
+	exit 0
+fi
+
 for testfile in `ls $SCRIPTDIR/t_*sh | sort`; do
+	echo " "
 	echo ">>>>>> Starting test driver `basename $testfile` <<<<<"
 	sh $testfile
 	if [ $? = 0 ]; then

Modified: branches/SAMBA_3_0/source/script/tests/t_001.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/t_001.sh	2005-08-24 03:09:26 UTC (rev 9561)
+++ branches/SAMBA_3_0/source/script/tests/t_001.sh	2005-08-24 03:09:49 UTC (rev 9562)
@@ -18,5 +18,8 @@
 start_smbd || exit $?
 
 smbclient $CONFIGURATION -L localhost -N -p 139
+ret=$?
 
 stop_smbd
+
+exit $ret

Added: branches/SAMBA_3_0/source/script/tests/t_002.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/t_002.sh	2005-08-24 03:09:26 UTC (rev 9561)
+++ branches/SAMBA_3_0/source/script/tests/t_002.sh	2005-08-24 03:09:49 UTC (rev 9562)
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. $SCRIPTDIR/functions
+
+cat >$CONFFILE<<EOF
+[global]
+	include = $LIBDIR/common.conf
+
+[test]
+	path = $TMPDIR
+	read only = no
+EOF
+
+##
+## Test code 
+##
+
+start_smbd || exit $?
+
+smbtorture //localhost/test -U${USERNAME}%${PASSWORD} FDPASS
+ret=$?
+
+stop_smbd
+
+exit $ret



More information about the samba-cvs mailing list