diff options
Diffstat (limited to 'source3/script')
-rwxr-xr-x[-rw-r--r--] | source3/script/build_idl.sh | 0 | ||||
-rw-r--r-- | source3/script/mkbuildoptions.awk | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | source3/script/tests/gdb_backtrace | 0 | ||||
-rwxr-xr-x | source3/script/tests/selftest.sh | 3 | ||||
-rw-r--r-- | source3/script/tests/test_functions.sh | 279 | ||||
-rwxr-xr-x | source3/script/tests/test_local_s3.sh | 22 | ||||
-rwxr-xr-x | source3/script/tests/test_posix_s3.sh | 80 | ||||
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 22 | ||||
-rwxr-xr-x | source3/script/tests/test_smbtorture_s3.sh | 35 | ||||
-rwxr-xr-x | source3/script/tests/tests_all.sh | 18 | ||||
-rw-r--r-- | source3/script/tests/tests_smbclient_s3.sh | 1 |
11 files changed, 419 insertions, 43 deletions
diff --git a/source3/script/build_idl.sh b/source3/script/build_idl.sh index 7aaddc70c7..7aaddc70c7 100644..100755 --- a/source3/script/build_idl.sh +++ b/source3/script/build_idl.sh diff --git a/source3/script/mkbuildoptions.awk b/source3/script/mkbuildoptions.awk index 56b64a42c2..383891d2e0 100644 --- a/source3/script/mkbuildoptions.awk +++ b/source3/script/mkbuildoptions.awk @@ -16,7 +16,7 @@ BEGIN { print " GNU General Public License for more details."; print " "; print " You should have received a copy of the GNU General Public License"; - print " along with this program; if not, see <http://www.gnu.org/licenses/>"; + print " along with this program; if not, see <http://www.gnu.org/licenses/>." print "*/"; print ""; print "#include \"includes.h\""; diff --git a/source3/script/tests/gdb_backtrace b/source3/script/tests/gdb_backtrace index 826381e900..826381e900 100755..100644 --- a/source3/script/tests/gdb_backtrace +++ b/source3/script/tests/gdb_backtrace diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 56b2a970e3..8de6420b10 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -139,9 +139,6 @@ cat >$SERVERCONFFILE<<EOF printing = bsd printcap name = /dev/null -# host msdfs = yes -# panic action = "/bin/sleep 90000" - [tmp] path = $PREFIX_ABS/tmp read only = no diff --git a/source3/script/tests/test_functions.sh b/source3/script/tests/test_functions.sh index 9ad1155024..1cc9ea1264 100644 --- a/source3/script/tests/test_functions.sh +++ b/source3/script/tests/test_functions.sh @@ -1,11 +1,276 @@ -plantest() { + +samba3_stop_sig_term() { + RET=0 + kill -USR1 `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1 || \ + kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` || RET=$? + + kill -USR1 `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1 || \ + kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` || RET=$? + + return $RET; +} + +samba3_stop_sig_kill() { + kill -ALRM `cat $PIDDIR/timelimit.nmbd.pid` >/dev/null 2>&1 + kill -ALRM `cat $PIDDIR/timelimit.smbd.pid` >/dev/null 2>&1 + return 0; +} + +samba3_check_or_start() { + if [ -n "$SERVER_TEST_FIFO" ];then + + trap samba3_stop_sig_kill INT QUIT + trap samba3_stop_sig_kill TERM + + if [ -p "$SERVER_TEST_FIFO" ];then + return 0; + fi + + if [ -n "$SOCKET_WRAPPER_DIR" ];then + if [ -d "$SOCKET_WRAPPER_DIR" ]; then + rm -f $SOCKET_WRAPPER_DIR/* + else + mkdir -p $SOCKET_WRAPPER_DIR + fi + fi + + rm -f $SERVER_TEST_FIFO + mkfifo $SERVER_TEST_FIFO + + rm -f $NMBD_TEST_LOG + echo -n "STARTING NMBD..." + (( + if test x"$NMBD_MAXTIME" = x; then + NMBD_MAXTIME=2700 + fi + MAKE_TEST_BINARY=$BINDIR/nmbd + export MAKE_TEST_BINARY + timelimit $NMBD_MAXTIME $NMBD_VALGRIND $BINDIR/nmbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $NMBD_TEST_LOG 2>&1 & + TIMELIMIT_NMBD_PID=$! + MAKE_TEST_BINARY= + echo $TIMELIMIT_NMBD_PID > $PIDDIR/timelimit.nmbd.pid + wait $TIMELIMIT_NMBD_PID + ret=$?; + rm -f $SERVER_TEST_FIFO + if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then + rm -f $SOCKET_WRAPPER_DIR/* + fi + if [ x"$ret" = x"0" ];then + echo "nmbd exits with status $ret"; + echo "nmbd exits with status $ret" >>$NMBD_TEST_LOG; + elif [ x"$ret" = x"137" ];then + echo "nmbd got SIGXCPU and exits with status $ret!" + echo "nmbd got SIGXCPU and exits with status $ret!">>$NMBD_TEST_LOG; + else + echo "nmbd failed with status $ret!" + echo "nmbd failed with status $ret!">>$NMBD_TEST_LOG; + fi + exit $ret; + ) || exit $? &) 2>/dev/null || exit $? + echo "DONE" + + rm -f $SMBD_TEST_LOG + echo -n "STARTING SMBD..." + (( + if test x"$SMBD_MAXTIME" = x; then + SMBD_MAXTIME=2700 + fi + MAKE_TEST_BINARY=$BINDIR/smbd + export MAKE_TEST_BINARY + timelimit $SMBD_MAXTIME $SMBD_VALGRIND $BINDIR/smbd -F -S --no-process-group -d0 -s $SERVERCONFFILE > $SMBD_TEST_LOG 2>&1 & + TIMELIMIT_SMBD_PID=$! + MAKE_TEST_BINARY= + echo $TIMELIMIT_SMBD_PID > $PIDDIR/timelimit.smbd.pid + wait $TIMELIMIT_SMBD_PID + ret=$?; + rm -f $SERVER_TEST_FIFO + if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then + rm -f $SOCKET_WRAPPER_DIR/* + fi + if [ x"$ret" = x"0" ];then + echo "smbd exits with status $ret"; + echo "smbd exits with status $ret" >>$SMBD_TEST_LOG; + elif [ x"$ret" = x"137" ];then + echo "smbd got SIGXCPU and exits with status $ret!" + echo "smbd got SIGXCPU and exits with status $ret!">>$SMBD_TEST_LOG; + else + echo "smbd failed with status $ret!" + echo "smbd failed with status $ret!">>$SMBD_TEST_LOG; + fi + exit $ret; + ) || exit $? &) 2>/dev/null || exit $? + echo "DONE" + fi + return 0; +} + +samba3_nmbd_test_log() { + if [ -n "$NMBD_TEST_LOG" ];then + if [ -r "$NMBD_TEST_LOG" ];then + return 0; + fi + fi + return 1; +} + +samba3_smbd_test_log() { + if [ -n "$SMBD_TEST_LOG" ];then + if [ -r "$SMBD_TEST_LOG" ];then + return 0; + fi + fi + return 1; +} + +samba3_check_only() { + if [ -n "$SERVER_TEST_FIFO" ];then + if [ -p "$SERVER_TEST_FIFO" ];then + return 0; + fi + return 1; + fi + return 0; +} + +testit() { + if [ -z "$PREFIX" ]; then + PREFIX=test_prefix + mkdir -p $PREFIX + fi name=$1 - env=$2 - shift 2 + shift 1 + binary=$1 cmdline="$*" - echo "-- TEST --" - echo $name - echo $env - echo $cmdline + + SERVERS_ARE_UP="no" + + shname=`echo $name | \ + sed -e 's%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g'` + + UNIQUE_PID=`/bin/sh -c 'echo $$'` + TEST_LOG="$PREFIX/test_log.${UNIQUE_PID}" + TEST_PCAP="$PREFIX/test_${shname}_${UNIQUE_PID}.pcap" + trap "rm -f $TEST_LOG $TEST_PCAP" EXIT + + if [ -z "$nmbd_log_size" ]; then + nmbd_log_size=`wc -l < $NMBD_TEST_LOG`; + fi + if [ -z "$smbd_log_size" ]; then + smbd_log_size=`wc -l < $SMBD_TEST_LOG`; + fi + + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "--==--==--==--==--==--==--==--==--==--==--" + echo "Running test $name (level 0 stdout)" + echo "--==--==--==--==--==--==--==--==--==--==--" + date + echo "Testing $name" + else + echo "Testing $name ($failed)" + fi + + samba3_check_only && SERVERS_ARE_UP="yes" + if [ x"$SERVERS_ARE_UP" != x"yes" ];then + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "SERVERS are down! Skipping: $cmdline" + echo "==========================================" + echo "TEST SKIPPED: $name (reason SERVERS are down)" + echo "==========================================" + else + echo "TEST SKIPPED: $name (reason SERVERS are down)" + fi + return 1 + fi + + if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then + SOCKET_WRAPPER_PCAP_FILE=$TEST_PCAP + export SOCKET_WRAPPER_PCAP_FILE + fi + + MAKE_TEST_BINARY=$binary + export MAKE_TEST_BINARY + ( $cmdline > $TEST_LOG 2>&1 ) + status=$? + MAKE_TEST_BINARY= + # show any additional output from smbd that has happened in this test + samba3_nmbd_test_log && { + new_log_size=`wc -l < $NMBD_TEST_LOG`; + test "$new_log_size" = "$nmbd_log_size" || { + echo "NMBD OUTPUT:"; + incr_log_size=`expr $new_log_size - $nmbd_log_size`; + tail -$incr_log_size $NMBD_TEST_LOG; + nmbd_log_size=$new_log_size; + } + } + samba3_smbd_test_log && { + new_log_size=`wc -l < $SMBD_TEST_LOG`; + test "$new_log_size" = "$smbd_log_size" || { + echo "SMBD OUTPUT:"; + incr_log_size=`expr $new_log_size - $smbd_log_size`; + tail -$incr_log_size $SMBD_TEST_LOG; + smbd_log_size=$new_log_size; + } + } + + if [ x"$status" != x"0" ]; then + echo "TEST OUTPUT:" + cat $TEST_LOG; + rm -f $TEST_LOG; + if [ x"$MAKE_TEST_ENABLE_PCAP" = x"yes" ];then + echo "TEST PCAP: $TEST_PCAP" + fi + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "==========================================" + echo "TEST FAILED: $name (status $status)" + echo "==========================================" + else + echo "TEST FAILED: $cmdline (status $status)" + fi + trap "" EXIT + return 1; + fi + rm -f $TEST_LOG; + if [ x"$MAKE_TEST_KEEP_PCAP" = x"yes" ];then + echo "TEST PCAP: $TEST_PCAP" + else + rm -f $TEST_PCAP; + fi + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "ALL OK: $cmdline" + echo "==========================================" + echo "TEST PASSED: $name" + echo "==========================================" + fi + trap "" EXIT + return 0; +} + +testok() { + name=`basename $1` + failed=$2 + + if [ x"$failed" = x"0" ];then + : + else + echo "$failed TESTS FAILED or SKIPPED ($name)"; + fi + exit $failed } +teststatus() { + name=`basename $1` + failed=$2 + + if [ x"$failed" = x"0" ];then + echo "TEST STATUS: $failed"; + else + echo "TEST STATUS: $failed"; + fi + exit $failed +} + +if [ -z "$VALGRIND" ]; then + MALLOC_CHECK_=2 + export MALLOC_CHECK_ +fi + diff --git a/source3/script/tests/test_local_s3.sh b/source3/script/tests/test_local_s3.sh index f016e5d28f..6117106c8a 100755 --- a/source3/script/tests/test_local_s3.sh +++ b/source3/script/tests/test_local_s3.sh @@ -2,11 +2,25 @@ # this runs the file serving tests that are expected to pass with samba3 +if [ $# != 0 ]; then +cat <<EOF +Usage: test_local_s3.sh +EOF +exit 1; +fi + incdir=`dirname $0` . $incdir/test_functions.sh -BINDIR=$incdir/../../bin +failed=0 + +testit "talloctort" $VALGRIND $BINDIR/talloctort || \ + failed=`expr $failed + 1` + +testit "replacetort" $VALGRIND $BINDIR/replacetort || \ + failed=`expr $failed + 1` + +testit "tdbtorture" $VALGRIND $BINDIR/tdbtorture || \ + failed=`expr $failed +1` -plantest "talloctort" none $VALGRIND $BINDIR/talloctort -plantest "replacetort" none $VALGRIND $BINDIR/replacetort -plantest "tdbtorture" none $VALGRIND $BINDIR/tdbtorture +testok $0 $failed diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh new file mode 100755 index 0000000000..11c4ed7796 --- /dev/null +++ b/source3/script/tests/test_posix_s3.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# this runs the file serving tests that are expected to pass with samba3 + +if [ $# -lt 3 ]; then +cat <<EOF +Usage: test_posix_s3.sh UNC USERNAME PASSWORD <first> <smbtorture args> +EOF +exit 1; +fi + +unc="$1" +username="$2" +password="$3" +start="$4" +shift 4 +ADDARGS="$*" + +incdir=`dirname $0` +. $incdir/test_functions.sh + +base="BASE-ATTR BASE-CHARSET BASE-CHKPATH BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE" +base="$base BASE-DENY1 BASE-DENY2 BASE-DENY3 BASE-DENYDOS BASE-DIR1 BASE-DIR2" +base="$base BASE-DISCONNECT BASE-FDPASS BASE-LOCK" +base="$base BASE-MANGLE BASE-NEGNOWAIT BASE-NTDENY1" +base="$base BASE-NTDENY2 BASE-OPEN BASE-OPENATTR BASE-PROPERTIES BASE-RENAME BASE-RW1" +base="$base BASE-SECLEAK BASE-TCON BASE-TCONDEV BASE-TRANS2 BASE-UNLINK BASE-VUID" +base="$base BASE-XCOPY BASE-SAMBA3ERROR" + +raw="RAW-ACLS RAW-CHKPATH RAW-CLOSE RAW-COMPOSITE RAW-CONTEXT RAW-EAS" +raw="$raw RAW-IOCTL RAW-LOCK RAW-MKDIR RAW-MUX RAW-NOTIFY RAW-OPEN RAW-OPLOCK" +raw="$raw RAW-QFILEINFO RAW-QFSINFO RAW-READ RAW-RENAME RAW-SEARCH RAW-SEEK" +raw="$raw RAW-SFILEINFO RAW-SFILEINFO-BUG RAW-STREAMS RAW-UNLINK RAW-WRITE" +raw="$raw RAW-SAMBA3HIDE RAW-SAMBA3BADPATH RAW-SFILEINFO-RENAME" +raw="$raw RAW-SAMBA3CASEINSENSITIVE RAW-SAMBA3POSIXTIMEDLOCK" +raw="$raw RAW-SAMBA3ROOTDIRFID" + +rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC" +rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC" + +# NOTE: to enable the UNIX-WHOAMI test, we need to change the default share +# config to allow guest access. I'm not sure whether this would break other +# tests, so leaving it alone for now -- jpeach +unix="UNIX-INFO2" + +if test x$RUN_FROM_BUILD_FARM = xyes; then + rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME" +fi + +tests="$base $raw $rpc $unix" + +skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-OPENATTR BASE-TCONDEV" +skipped="$skipped RAW-ACLS RAW-COMPOSITE RAW-CONTEXT RAW-EAS" +skipped="$skipped RAW-IOCTL RAW-MUX" +skipped="$skipped RAW-QFILEINFO RAW-QFSINFO RAW-SEARCH" +skipped="$skipped RAW-SFILEINFO RAW-STREAMS RAW-WRITE" + +echo "WARNING: Skipping tests $skipped" + +failed=0 +for t in $tests; do + if [ ! -z "$start" -a "$start" != $t ]; then + continue; + fi + skip=0 + for s in $skipped; do + if [ x"$s" = x"$t" ]; then + skip=1; + break; + fi + done + if [ $skip = 1 ]; then + continue; + fi + start="" + name="$t" + testit "$name" $VALGRIND $SMBTORTURE4 $TORTURE4_OPTIONS $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` +done + +testok $0 $failed diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 762b0c37a5..3a8f3bd5b6 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -9,28 +9,14 @@ EOF exit 1; fi -BINDIR=`dirname $0`/../../bin - SERVER="$1" SERVER_IP="$2" SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION" -failed=0 +incdir=`dirname $0` +. $incdir/test_functions.sh -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +failed=0 # Test that a noninteractive smbclient does not prompt test_noninteractive_no_prompt() @@ -96,4 +82,4 @@ testit "interactive smbclient -l prompts on stdout" \ test_interactive_prompt_stdout -l /tmp || \ failed=`expr $failed + 1` -exit $failed +testok $0 $failed diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh index 21c0fca445..f662eacd3e 100755 --- a/source3/script/tests/test_smbtorture_s3.sh +++ b/source3/script/tests/test_smbtorture_s3.sh @@ -2,20 +2,47 @@ # this runs the file serving tests that are expected to pass with samba3 +if [ $# -lt 3 ]; then +cat <<EOF +Usage: test_smbtorture_s3.sh UNC USERNAME PASSWORD <first> <smbtorture args> +EOF +exit 1; +fi + +unc="$1" +username="$2" +password="$3" +start="$4" +shift 4 ADDARGS="$*" incdir=`dirname $0` . $incdir/test_functions.sh -BINDIR=$incdir/../../bin - tests="FDPASS LOCK1 LOCK2 LOCK3 LOCK4 LOCK5 LOCK6 LOCK7" -tests="$tests UNLINK BROWSE ATTR TRANS2 MAXFID TORTURE " +#tests="$tests UNLINK BROWSE ATTR TRANS2 MAXFID TORTURE " +tests="$tests UNLINK BROWSE ATTR TRANS2 TORTURE " tests="$tests OPLOCK1 OPLOCK2 OPLOCK3" tests="$tests DIR DIR1 TCON TCONDEV RW1 RW2 RW3" tests="$tests OPEN XCOPY RENAME DELETE PROPERTIES W2K" tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE" +skipped1="RANDOMIPC NEGNOWAIT NBENCH ERRMAPEXTRACT TRANS2SCAN NTTRANSSCAN" +skipped2="DENY1 DENY2 OPENATTR CASETABLE EATEST" +skipped3="MANGLE UTABLE PIPE_NUMBER" +echo "Skipping the following tests:" +echo "$skipped1" +echo "$skipped2" +echo "$skipped3" + +failed=0 for t in $tests; do - plantest "SAMBA3-$t" dc $VALGRIND $BINDIR/smbtorture $ADDARGS //\$SERVER_IP/tmp -U"\$USERNAME"%"\$PASSWORD" $t + if [ ! -z "$start" -a "$start" != $t ]; then + continue; + fi + start="" + name="$t" + testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` done + +testok $0 $failed diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index d001569c08..dd593899e4 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -1,7 +1,13 @@ -#!/bin/sh -SCRIPTDIR=`dirname $0` -. $SCRIPTDIR/test_functions.sh -$SCRIPTDIR/test_local_s3.sh -$SCRIPTDIR/test_smbtorture_s3.sh -plantest "smbclient" dc $SCRIPTDIR/test_smbclient_s3.sh \$SERVER \$SERVER_IP +$SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?` +$SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` +$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` + +SMBTORTURE4VERSION=`$SMBTORTURE4 --version` +if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then + echo "Running Tests with Samba4's smbtorture" + echo $SMBTORTURE4VERSION + $SCRIPTDIR/test_posix_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` +else + echo "Skip Tests with Samba4's smbtorture" +fi diff --git a/source3/script/tests/tests_smbclient_s3.sh b/source3/script/tests/tests_smbclient_s3.sh new file mode 100644 index 0000000000..d48a692d4b --- /dev/null +++ b/source3/script/tests/tests_smbclient_s3.sh @@ -0,0 +1 @@ +. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP |