Author: jerry Date: 2005-08-23 22:10:44 +0000 (Tue, 23 Aug 2005) New Revision: 9548
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9548 Log: more additions to make test; better checks for starting and stopping smbd 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-23 22:02:54 UTC (rev 9547) +++ branches/SAMBA_3_0/source/script/tests/functions 2005-08-23 22:10:44 UTC (rev 9548) @@ -2,3 +2,41 @@ ## library file for test functions ## +## +## start/stop smbd daemon +## +check_smbd_running() +{ + ## the smbcontrol ping will return a 0 on success + smbcontrol $CONFIGURATION smbd ping 2>&1 > /dev/null +} + +start_smbd() +{ + echo "Starting smbd...." + + smbd $CONFIGURATION || return $? + + sleep 1 + + smbcontrol $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $? +} + +stop_smbd() +{ + smbd_pid=`cat $PIDDIR/smbd.pid` + echo "Shutting down smbd (pid $smbd_pid)..." + + ## belt and braces; first kill and then send a shutdown message + + kill -TERM $smbd_pid + smbcontrol $CONFIGURATION smbd shutdown + + ## check to see if smbd is already running + check_smbd_running + if test $? == 0; then + echo "Unable to stop smbd!" + exit 2 + fi +} + Modified: branches/SAMBA_3_0/source/script/tests/runtests.sh =================================================================== --- branches/SAMBA_3_0/source/script/tests/runtests.sh 2005-08-23 22:02:54 UTC (rev 9547) +++ branches/SAMBA_3_0/source/script/tests/runtests.sh 2005-08-23 22:10:44 UTC (rev 9548) @@ -19,8 +19,6 @@ ## setup the various environment variables we need ## -DOMAIN=SAMBA-TEST - SRCDIR=`pwd` SCRIPTDIR=$SRCDIR/script/tests TMPDIR=$PREFIX_ABS/tmp @@ -32,16 +30,43 @@ LOGDIR=$PREFIX_ABS/logs SOCKET_WRAPPER_DIR=$PREFIX_ABS/sockwrap CONFIGURATION="-s $CONFFILE" - PATH=`pwd`/bin:$PATH -rm -rf $PREFIX/* -mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $TMPDIR $LOGDIR $SOCKET_WRAPPER_DIR - export PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR export SRCDIR SCRIPTDIR +## +## create the test directory layout +## + +/bin/rm -rf $PREFIX/* +mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $TMPDIR $LOGDIR $SOCKET_WRAPPER_DIR + +## +## Create the common config include file with the basic settings +## + +cat >$LIBDIR/common.conf<<EOF + netbios name = LOCALHOST + workgroup = SAMBA-TEST + + private dir = $PRIVATEDIR + pid directory = $PIDDIR + lock directory = $LOCKDIR + log file = $LOGDIR/log.%m + log level = 0 + + interfaces = lo + bind interfaces only = yes + + panic action = $PREFIX_ABS/script/tests/gdb_backtrace /proc/%d/exe %d +EOF + +## +## ready to go...now loop through the tests +## + for testfile in `ls $SCRIPTDIR/t_*sh | sort`; do echo ">>>>>> Starting test driver `basename $testfile` <<<<<" sh $testfile Modified: branches/SAMBA_3_0/source/script/tests/t_001.sh =================================================================== --- branches/SAMBA_3_0/source/script/tests/t_001.sh 2005-08-23 22:02:54 UTC (rev 9547) +++ branches/SAMBA_3_0/source/script/tests/t_001.sh 2005-08-23 22:10:44 UTC (rev 9548) @@ -4,27 +4,19 @@ cat >$CONFFILE<<EOF [global] - netbios name = LOCALHOST - workgroup = $DOMAIN + include = $LIBDIR/common.conf - private dir = $PRIVATEDIR - pid directory = $PIDDIR - lock directory = $LOCKDIR - log file = $LOGDIR/log.%m - - interfaces = lo - bind interfaces only = yes - - panic action = $PREFIX_ABS/script/tests/gdb_backtrace /proc/%d/exe %d - [test] path = $TMPDIR read only = no EOF +## +## Test code +## -smbd $CONFIGURATION || exit $? -sleep 1 +start_smbd || exit $? + smbclient $CONFIGURATION -L localhost -N -p 139 -killall smbd +stop_smbd
