From c731d11471ea9edd762b4cdb67bac06e77cb6f45 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 3 Aug 2005 05:46:43 +0000 Subject: r8990: First trivial example of 'make test' (This used to be commit 11c886394970713a226d1fe46a4931ef97bb39a8) --- source3/script/tests/gdb_backtrace | 41 ++++++++++++++++++++++++++++++++++++++ source3/script/tests/runtests.sh | 41 ++++++++++++++++++++++++++++++++++++++ source3/script/tests/t_listing.sh | 28 ++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 source3/script/tests/gdb_backtrace create mode 100644 source3/script/tests/runtests.sh create mode 100644 source3/script/tests/t_listing.sh (limited to 'source3/script/tests') diff --git a/source3/script/tests/gdb_backtrace b/source3/script/tests/gdb_backtrace new file mode 100644 index 0000000000..2ea6a4d00a --- /dev/null +++ b/source3/script/tests/gdb_backtrace @@ -0,0 +1,41 @@ +#! /bin/sh +# +# Author: Andrew Tridgell + +# we want everything on stderr, so the program is not disturbed +exec 1>&2 + +BASENAME=$( basename $0) + +test -z ${GDB_BIN} && GDB_BIN=$( type -p gdb) +if [ -z ${GDB_BIN} ]; then + echo "ERROR: ${BASENAME} needs an installed gdb. " + exit 1 +fi + +if [ -z $1 ]; then + echo "ERROR: ${BASENAME} needs a PID. " + exit 1 +fi +PID=$1 + +# use /dev/shm as default temp directory +test -d /dev/shm && \ + TMP_BASE_DIR=/dev/shm || \ + TMP_BASE_DIR=/var/tmp +TMPFILE=$( mktemp -p ${TMP_BASE_DIR} backtrace.XXXXXX) +if [ $? -ne 0 ]; then + echo "ERROR: ${basename} can't create temp file in ${TMP_BASE_DIR}. " + exit 1 +fi + +cat << EOF > "${TMPFILE}" +set height 0 +up 8 +bt full +quit +EOF + +${GDB_BIN} -x "${TMPFILE}" "/proc/${PID}/exe" "${PID}" + +/bin/rm -f "${TMPFILE}" diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh new file mode 100644 index 0000000000..2483de97ca --- /dev/null +++ b/source3/script/tests/runtests.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +DOMAIN=SAMBA-TEST +export DOMAIN + +if [ "x$1" == "x" ]; then + echo "$0 " + exit 1 +fi + +PREFIX=`echo $1 | sed s+//+/+` + +mkdir -p $PREFIX || exit $? +OLD_PWD=`pwd` +cd $PREFIX || exit $? +export PREFIX_ABS=`pwd` +cd $OLD_PWD + +TMPDIR=$PREFIX_ABS/tmp +LIBDIR=$PREFIX_ABS/lib +PIDDIR=$PREFIX_ABS/pid +CONFFILE=$LIBDIR/smb.conf +PRIVATEDIR=$PREFIX_ABS/private +LOCKDIR=$PREFIX_ABS/lockdir +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 +export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR + +cd script/tests +for testfile in t_*sh; do + sh $testfile +done + diff --git a/source3/script/tests/t_listing.sh b/source3/script/tests/t_listing.sh new file mode 100644 index 0000000000..0689807671 --- /dev/null +++ b/source3/script/tests/t_listing.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +cat >$CONFFILE< Date: Wed, 3 Aug 2005 06:24:28 +0000 Subject: r8992: More make test work. Adding a way to order tests (might change my mind on this later). (This used to be commit 136fe3f15e74686882f7c1e5a46fcc0bcf7d51a6) --- source3/script/tests/functions | 4 ++++ source3/script/tests/runtests.sh | 27 ++++++++++++++++++++------- source3/script/tests/t_001.sh | 30 ++++++++++++++++++++++++++++++ source3/script/tests/t_listing.sh | 28 ---------------------------- 4 files changed, 54 insertions(+), 35 deletions(-) create mode 100644 source3/script/tests/functions create mode 100644 source3/script/tests/t_001.sh delete mode 100644 source3/script/tests/t_listing.sh (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions new file mode 100644 index 0000000000..0969c98724 --- /dev/null +++ b/source3/script/tests/functions @@ -0,0 +1,4 @@ +## +## library file for test functions +## + diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index 2483de97ca..6ee6d3a32b 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -1,21 +1,28 @@ #!/bin/sh -DOMAIN=SAMBA-TEST -export DOMAIN - if [ "x$1" == "x" ]; then echo "$0 " exit 1 fi +## +## create the test directory +## PREFIX=`echo $1 | sed s+//+/+` - mkdir -p $PREFIX || exit $? OLD_PWD=`pwd` cd $PREFIX || exit $? export PREFIX_ABS=`pwd` cd $OLD_PWD +## +## setup the various environment variables we need +## + +DOMAIN=SAMBA-TEST + +SRCDIR=`pwd` +SCRIPTDIR=$SRCDIR/script/tests TMPDIR=$PREFIX_ABS/tmp LIBDIR=$PREFIX_ABS/lib PIDDIR=$PREFIX_ABS/pid @@ -31,11 +38,17 @@ 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 +export PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR +export SRCDIR SCRIPTDIR -cd script/tests -for testfile in t_*sh; do +for testfile in `ls $SCRIPTDIR/t_*sh | sort`; do + echo ">>>>>> Starting test driver `basename $testfile` <<<<<" sh $testfile + if [ $? = 0 ]; then + echo ">>>>> test ok <<<<<" + else + echo ">>>>> test failed <<<<<" + fi done diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh new file mode 100644 index 0000000000..86837050c7 --- /dev/null +++ b/source3/script/tests/t_001.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. $SCRIPTDIR/functions + +cat >$CONFFILE<$CONFFILE< Date: Tue, 23 Aug 2005 22:10:44 +0000 Subject: r9548: more additions to make test; better checks for starting and stopping smbd (This used to be commit dbaaf81cec59aae01e71bbb639e1937ebee2454d) --- source3/script/tests/functions | 38 ++++++++++++++++++++++++++++++++++++++ source3/script/tests/runtests.sh | 37 +++++++++++++++++++++++++++++++------ source3/script/tests/t_001.sh | 22 +++++++--------------- 3 files changed, 76 insertions(+), 21 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 0969c98724..4cc8d4a2c0 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -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 +} + diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index 6ee6d3a32b..e8594f5199 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -19,8 +19,6 @@ cd $OLD_PWD ## setup the various environment variables we need ## -DOMAIN=SAMBA-TEST - SRCDIR=`pwd` SCRIPTDIR=$SRCDIR/script/tests TMPDIR=$PREFIX_ABS/tmp @@ -32,16 +30,43 @@ LOCKDIR=$PREFIX_ABS/lockdir 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<>>>>> Starting test driver `basename $testfile` <<<<<" sh $testfile diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index 86837050c7..f9f530c974 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -4,27 +4,19 @@ cat >$CONFFILE< Date: Wed, 24 Aug 2005 03:09:49 +0000 Subject: r9562: successfully get the samba 3 smbtorture working (as a test case for infrastructre) (This used to be commit c64f5666b8d1f9fb617b1cf89d6157a0c3fa9da9) --- source3/script/tests/functions | 40 ++++++++++++++++++++++++++++++++++++++++ source3/script/tests/runtests.sh | 40 +++++++++++++++++++++++++++++++++++++++- source3/script/tests/t_001.sh | 3 +++ source3/script/tests/t_002.sh | 25 +++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 source3/script/tests/t_002.sh (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 4cc8d4a2c0..40e185e153 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -40,3 +40,43 @@ stop_smbd() 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 +} + diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index e8594f5199..b814ad91e7 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -5,6 +5,10 @@ if [ "x$1" == "x" ]; then exit 1 fi +if [ $# == 2 ]; then + testnum=$2 +fi + ## ## create the test directory ## @@ -19,6 +23,9 @@ cd $OLD_PWD ## 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 @@ PATH=`pwd`/bin:$PATH 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 @@ export SRCDIR SCRIPTDIR /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 @@ cat >$LIBDIR/common.conf<$LIBDIR/smb.conf<>>>>> 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 diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index f9f530c974..77b023c4c4 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -18,5 +18,8 @@ EOF start_smbd || exit $? smbclient $CONFIGURATION -L localhost -N -p 139 +ret=$? stop_smbd + +exit $ret diff --git a/source3/script/tests/t_002.sh b/source3/script/tests/t_002.sh new file mode 100644 index 0000000000..48987262a7 --- /dev/null +++ b/source3/script/tests/t_002.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +. $SCRIPTDIR/functions + +cat >$CONFFILE< Date: Wed, 24 Aug 2005 13:09:13 +0000 Subject: r9583: ensure that Samba was with with --enable-socket-wrapper for running 'make test' (This used to be commit 019155e748d9e04150bae39676362b794c1b6043) --- source3/script/tests/runtests.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/script/tests') diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index b814ad91e7..bb599ea3ec 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -44,6 +44,19 @@ export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR export SRCDIR SCRIPTDIR export USERNAME PASSWORD + +## +## verify that we were built with --enable-socket-wrapper +## + +if test "x`smbd -b | grep SOCKET_WRAPPER`" == "x"; then + echo "***" + echo "*** You must include --enable-socket-wrapper when compiling Samba" + echo "*** in order to execute 'make test'. Exiting...." + echo "***" + exit 1 +fi + ## ## create the test directory layout ## -- cgit From 38d08ad68c44304fe151b518f41a232bcc762261 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 24 Aug 2005 13:27:24 +0000 Subject: r9585: update test #1 (This used to be commit 7a150ffde5cb8eb5198ac351161c3d651fb279a9) --- source3/script/tests/t_001.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/script/tests') diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index 77b023c4c4..995cfb11eb 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -5,6 +5,7 @@ cat >$CONFFILE< Date: Thu, 25 Aug 2005 12:44:37 +0000 Subject: r9613: remove TMPDIR from 'make test' scripts (after comments by Don Watson) (This used to be commit 0626bb68411225d5402221ec9b305390393c38e5) --- source3/script/tests/runtests.sh | 7 +++---- source3/script/tests/t_001.sh | 6 +++++- source3/script/tests/t_002.sh | 7 ++++++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index bb599ea3ec..a5dc3ecfb4 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -28,7 +28,7 @@ PASSWORD=test SRCDIR=`pwd` SCRIPTDIR=$SRCDIR/script/tests -TMPDIR=$PREFIX_ABS/tmp +SHRDIR=$PREFIX_ABS/tmp LIBDIR=$PREFIX_ABS/lib PIDDIR=$PREFIX_ABS/pid CONFFILE=$LIBDIR/smb.conf @@ -40,7 +40,7 @@ CONFIGURATION="-s $CONFFILE" PATH=`pwd`/bin:$PATH export PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN -export PRIVATEDIR LIBDIR PIDDIR LOCKDIR TMPDIR LOGDIR +export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR export SRCDIR SCRIPTDIR export USERNAME PASSWORD @@ -62,8 +62,7 @@ fi ## /bin/rm -rf $PREFIX/* -mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $TMPDIR $LOGDIR $SOCKET_WRAPPER_DIR -chmod 1777 $TMPDIR +mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR ## ## Create the common config include file with the basic settings diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index 995cfb11eb..6d54d0e489 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -8,7 +8,7 @@ cat >$CONFFILE<$CONFFILE< Date: Thu, 25 Aug 2005 13:53:09 +0000 Subject: r9615: trying a 3 second timeout on smbcontrol (This used to be commit 4e62a51bf68e8ef19beed63a7520e0db20321b11) --- source3/script/tests/functions | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 40e185e153..13139f6d8f 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -2,13 +2,16 @@ ## library file for test functions ## + +SMBCONTROL="smbcontrol -t 3" + ## ## start/stop smbd daemon ## check_smbd_running() { ## the smbcontrol ping will return a 0 on success - smbcontrol $CONFIGURATION smbd ping 2>&1 > /dev/null + $SMBCONTROL $CONFIGURATION smbd ping 2>&1 > /dev/null } start_smbd() @@ -19,7 +22,7 @@ start_smbd() sleep 1 - smbcontrol $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $? + $SMBCONTROL $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $? } stop_smbd() @@ -30,7 +33,7 @@ stop_smbd() ## belt and braces; first kill and then send a shutdown message kill -TERM $smbd_pid - smbcontrol $CONFIGURATION smbd shutdown + $SMBCONTROL $CONFIGURATION smbd shutdown ## check to see if smbd is already running check_smbd_running @@ -47,7 +50,7 @@ stop_smbd() check_nmbd_running() { ## the smbcontrol ping will return a 0 on success - smbcontrol $CONFIGURATION nmbd ping 2>&1 > /dev/null + $SMBCONTROL $CONFIGURATION nmbd ping 2>&1 > /dev/null } start_nmbd() -- cgit From 013ac99a9dce268dcc46bccb8754aacced931157 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 25 Aug 2005 17:15:23 +0000 Subject: r9618: adding get/put tests from Don Watson (This used to be commit a94de276aec174bc05406ff52568e9fcd05c114e) --- source3/script/tests/functions | 11 ++++++++++- source3/script/tests/t_001.sh | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 13139f6d8f..0981d9e29e 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -43,9 +43,18 @@ stop_smbd() fi } +check_ret_value() +{ + ret=$@ + + if test $ret != 0; then + stop_smbd + exit $ret + fi +} ## -## start/stop smbd daemon +## start/stop nmbd daemon ## check_nmbd_running() { diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index 6d54d0e489..7db2abe226 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -22,9 +22,27 @@ chmod 1777 $PREFIX_ABS/tmp start_smbd || exit $? +## share enumeration + smbclient $CONFIGURATION -L localhost -N -p 139 -ret=$? +check_ret_value $? + +testfile=`echo $CONFIGURATION | awk '{print $2}'` +filename=`basename $testfile` +dirname=`dirname $testfile` + + +# file get/put + +smbclient //localhost/test $PASSWORD $CONFIGURATION -c "lcd $dirname; put $filename" +check_ret_value $? + +smbclient //localhost/test $PASSWORD $CONFIGURATION -c "get $filename; rm $filename" +check_ret_value $? + +diff $filename $testfile 2> /dev/null > /dev/null +check_ret_value $? stop_smbd +exit 0 -exit $ret -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/script/tests/functions | 22 +++++----------------- source3/script/tests/t_001.sh | 22 ++-------------------- 2 files changed, 7 insertions(+), 37 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 0981d9e29e..40e185e153 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -2,16 +2,13 @@ ## library file for test functions ## - -SMBCONTROL="smbcontrol -t 3" - ## ## start/stop smbd daemon ## check_smbd_running() { ## the smbcontrol ping will return a 0 on success - $SMBCONTROL $CONFIGURATION smbd ping 2>&1 > /dev/null + smbcontrol $CONFIGURATION smbd ping 2>&1 > /dev/null } start_smbd() @@ -22,7 +19,7 @@ start_smbd() sleep 1 - $SMBCONTROL $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $? + smbcontrol $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $? } stop_smbd() @@ -33,7 +30,7 @@ stop_smbd() ## belt and braces; first kill and then send a shutdown message kill -TERM $smbd_pid - $SMBCONTROL $CONFIGURATION smbd shutdown + smbcontrol $CONFIGURATION smbd shutdown ## check to see if smbd is already running check_smbd_running @@ -43,23 +40,14 @@ stop_smbd() fi } -check_ret_value() -{ - ret=$@ - - if test $ret != 0; then - stop_smbd - exit $ret - fi -} ## -## start/stop nmbd daemon +## start/stop smbd daemon ## check_nmbd_running() { ## the smbcontrol ping will return a 0 on success - $SMBCONTROL $CONFIGURATION nmbd ping 2>&1 > /dev/null + smbcontrol $CONFIGURATION nmbd ping 2>&1 > /dev/null } start_nmbd() diff --git a/source3/script/tests/t_001.sh b/source3/script/tests/t_001.sh index 7db2abe226..6d54d0e489 100644 --- a/source3/script/tests/t_001.sh +++ b/source3/script/tests/t_001.sh @@ -22,27 +22,9 @@ chmod 1777 $PREFIX_ABS/tmp start_smbd || exit $? -## share enumeration - smbclient $CONFIGURATION -L localhost -N -p 139 -check_ret_value $? - -testfile=`echo $CONFIGURATION | awk '{print $2}'` -filename=`basename $testfile` -dirname=`dirname $testfile` - - -# file get/put - -smbclient //localhost/test $PASSWORD $CONFIGURATION -c "lcd $dirname; put $filename" -check_ret_value $? - -smbclient //localhost/test $PASSWORD $CONFIGURATION -c "get $filename; rm $filename" -check_ret_value $? - -diff $filename $testfile 2> /dev/null > /dev/null -check_ret_value $? +ret=$? stop_smbd -exit 0 +exit $ret -- cgit From e2de656314c8d50bfd5f14b24826a2df962fe704 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 18 Jan 2006 04:44:59 +0000 Subject: r12990: BUG 3329: patch from David May for Solaris shell script portability issues in 'make test' (This used to be commit 19339a9510467b4b2cf3889bc6a08563cdc940f4) --- source3/script/tests/functions | 4 ++-- source3/script/tests/runtests.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 40e185e153..8cb8f0b155 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -34,7 +34,7 @@ stop_smbd() ## check to see if smbd is already running check_smbd_running - if test $? == 0; then + if test $? = 0; then echo "Unable to stop smbd!" exit 2 fi @@ -74,7 +74,7 @@ stop_nmbd() ## check to see if smbd is already running kill -0 $nmbd_pid 2> /dev/null - if test $? == 0; then + if test $? = 0; then echo "Unable to stop nmbd!" exit 2 fi diff --git a/source3/script/tests/runtests.sh b/source3/script/tests/runtests.sh index a5dc3ecfb4..ddaf94e8ac 100644 --- a/source3/script/tests/runtests.sh +++ b/source3/script/tests/runtests.sh @@ -1,11 +1,11 @@ #!/bin/sh -if [ "x$1" == "x" ]; then +if [ "x$1" = "x" ]; then echo "$0 " exit 1 fi -if [ $# == 2 ]; then +if [ $# = 2 ]; then testnum=$2 fi @@ -49,7 +49,7 @@ export USERNAME PASSWORD ## verify that we were built with --enable-socket-wrapper ## -if test "x`smbd -b | grep SOCKET_WRAPPER`" == "x"; then +if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then echo "***" echo "*** You must include --enable-socket-wrapper when compiling Samba" echo "*** in order to execute 'make test'. Exiting...." -- cgit From 9b277916445e6c1bdc60e06c382067c209287aaf Mon Sep 17 00:00:00 2001 From: Lars Müller Date: Mon, 13 Mar 2006 16:10:26 +0000 Subject: r14325: Add pam_modules rule which builds the configure(d) pam modules. This is called as part of the all rule (again only if pam modules are requested by configure). Add pam_winbind rule. Ensure proto_exists before we build the pam modules. Add test_pam_modules rule to test if the built pam modules have any unresolved symbols. For test_pam_modules we use script/tests/dlopen.sh which was written by Nalin Dahyabhai . Thanks Nalin! RedHat and SuSE use this script to test nss and pam modules since several years. (This used to be commit 71b2eb55adcd28f3796254ea1ce0bcee6098e712) --- source3/script/tests/dlopen.sh | 91 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 source3/script/tests/dlopen.sh (limited to 'source3/script/tests') diff --git a/source3/script/tests/dlopen.sh b/source3/script/tests/dlopen.sh new file mode 100755 index 0000000000..6127953692 --- /dev/null +++ b/source3/script/tests/dlopen.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (C) Nalin Dahyabhai 2003 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +tempdir=`mktemp -d /tmp/dlopenXXXXXX` +test -n "$tempdir" || exit 1 +cat >> $tempdir/dlopen.c << _EOF +#include +#include +#include +#include +/* Simple program to see if dlopen() would succeed. */ +int main(int argc, char **argv) +{ + int i; + struct stat st; + char buf[PATH_MAX]; + for (i = 1; i < argc; i++) { + if (dlopen(argv[i], RTLD_NOW)) { + fprintf(stdout, "dlopen() of \"%s\" succeeded.\n", + argv[i]); + } else { + snprintf(buf, sizeof(buf), "./%s", argv[i]); + if ((stat(buf, &st) == 0) && dlopen(buf, RTLD_NOW)) { + fprintf(stdout, "dlopen() of \"./%s\" " + "succeeded.\n", argv[i]); + } else { + fprintf(stdout, "dlopen() of \"%s\" failed: " + "%s\n", argv[i], dlerror()); + return 1; + } + } + } + return 0; +} +_EOF + +for arg in $@ ; do + case "$arg" in + "") + ;; + -I*|-D*|-f*|-m*|-g*|-O*|-W*) + cflags="$cflags $arg" + ;; + -l*|-L*) + ldflags="$ldflags $arg" + ;; + /*) + modules="$modules $arg" + ;; + *) + modules="$modules $arg" + ;; + esac +done + +${CC:-gcc} $RPM_OPT_FLAGS $CFLAGS -o $tempdir/dlopen $cflags $tempdir/dlopen.c $ldflags -ldl + +retval=0 +for module in $modules ; do + case "$module" in + "") + ;; + /*) + $tempdir/dlopen "$module" + retval=$? + ;; + *) + $tempdir/dlopen ./"$module" + retval=$? + ;; + esac +done + +rm -f $tempdir/dlopen $tempdir/dlopen.c +rmdir $tempdir +exit $retval -- cgit From b40e2588707d2b7c44ee91da91872e4f9dc5209b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Mar 2006 15:33:14 +0000 Subject: r14624: - add timelimit.c - add configure tests --with-selftest-prefix=/tmp/samba-test this is needed because the path name of unix socket can only be 108 chars long - add configure test --with-smbtorture4-path=/home/foo/prefix/samba4/bin/smbtorture this will be used to run samba4's smbtorture inside samba3's make test later metze (This used to be commit d9df1853b947c70f747ea30a353162f2985ef250) --- source3/script/tests/timelimit.c | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 source3/script/tests/timelimit.c (limited to 'source3/script/tests') diff --git a/source3/script/tests/timelimit.c b/source3/script/tests/timelimit.c new file mode 100644 index 0000000000..93d7f6497e --- /dev/null +++ b/source3/script/tests/timelimit.c @@ -0,0 +1,78 @@ +/* run a command with a limited timeout + tridge@samba.org, June 2005 + + attempt to be as portable as possible (fighting posix all the way) +*/ +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(void) +{ + printf("usage: timelimit