diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-06-09 07:14:39 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:51 -0500 |
commit | 7931aed30de1f3222fe1d60042cf4951469a770f (patch) | |
tree | 0665ffa7c5d712fa7b3c1f1b9c950ea4605f206c | |
parent | 32e935c8c67902dff2d089658f2877f60fd89b4e (diff) | |
download | samba-7931aed30de1f3222fe1d60042cf4951469a770f.tar.gz samba-7931aed30de1f3222fe1d60042cf4951469a770f.tar.bz2 samba-7931aed30de1f3222fe1d60042cf4951469a770f.zip |
r7421: - move test* functions to a seperate file
- print build farm style output when RUN_FROM_BUILD_FARM=yes
metze
(This used to be commit 7e567a6b69d05fa180bb4384b503969f79f18068)
-rwxr-xr-x | source4/script/tests/selftest.sh | 14 | ||||
-rwxr-xr-x | source4/script/tests/test_binding_string.sh | 27 | ||||
-rwxr-xr-x | source4/script/tests/test_echo.sh | 33 | ||||
-rw-r--r-- | source4/script/tests/test_functions.sh | 57 | ||||
-rwxr-xr-x | source4/script/tests/test_posix.sh | 30 | ||||
-rwxr-xr-x | source4/script/tests/test_rpc.sh | 29 | ||||
-rwxr-xr-x | source4/script/tests/test_w2k3.sh | 41 |
7 files changed, 87 insertions, 144 deletions
diff --git a/source4/script/tests/selftest.sh b/source4/script/tests/selftest.sh index f9f4b766db..436ca719dc 100755 --- a/source4/script/tests/selftest.sh +++ b/source4/script/tests/selftest.sh @@ -20,16 +20,8 @@ PRIVATEDIR=$PREFIX/private NCALRPCDIR=$PREFIX/ncalrpc LOCKDIR=$PREFIX/lockdir -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh rm -rf $PREFIX/* mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR @@ -74,4 +66,4 @@ END=`date` echo "START: $START ($0)"; echo "END: $END ($0)"; -testok $0 $failed +teststatus $0 $failed diff --git a/source4/script/tests/test_binding_string.sh b/source4/script/tests/test_binding_string.sh index 27310a1c99..a7934789dc 100755 --- a/source4/script/tests/test_binding_string.sh +++ b/source4/script/tests/test_binding_string.sh @@ -13,28 +13,8 @@ password="$3" domain="$4" shift 4 -testit() { - cmdline="$*" - if ! $cmdline > test.$$ 2>&1; then - cat test.$$; - rm -f test.$$; - echo "TEST FAILED - $cmdline"; - return 1; - fi - rm -f test.$$; - return 0; -} - -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh failed=0; for I in "ncacn_np:$server" \ @@ -48,8 +28,7 @@ for I in "ncacn_np:$server" \ "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:$server" \ "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:$server" do - echo Testing $I - testit bin/smbtorture "$I" -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` + testit "$I" bin/smbtorture "$I" -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` done testok $0 $failed diff --git a/source4/script/tests/test_echo.sh b/source4/script/tests/test_echo.sh index 2e0ed3ed02..882050a588 100755 --- a/source4/script/tests/test_echo.sh +++ b/source4/script/tests/test_echo.sh @@ -13,29 +13,8 @@ password="$3" domain="$4" shift 4 -testit() { - trap "rm -f test.$$" EXIT - cmdline="$*" - if ! $cmdline > test.$$ 2>&1; then - cat test.$$; - rm -f test.$$; - echo "TEST FAILED - $cmdline"; - return 1; - fi - rm -f test.$$; - return 0; -} - -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh transports="ncacn_np ncacn_ip_tcp" if [ $server = "localhost" ]; then @@ -54,14 +33,14 @@ for transport in $transports; do "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no" \ "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:echo_TestSleep=no" \ ; do - echo Testing $transport with $bindoptions and $ntlmoptions - testit bin/smbtorture $transport:"$server[$bindoptions]" $ntlmoptions -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` + name="$transport with $bindoptions and $ntlmoptions" + testit "$name" bin/smbtorture $transport:"$server[$bindoptions]" $ntlmoptions -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` done done done # separately test the print option - its v slow -echo Testing print option -testit bin/smbtorture ncacn_np:"$server[print]" -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` +name="[print] option" +testit bin/smbtorture "$name" ncacn_np:"$server[print]" -U"$username"%"$password" -W $domain RPC-ECHO "$*" || failed=`expr $failed + 1` testok $0 $failed diff --git a/source4/script/tests/test_functions.sh b/source4/script/tests/test_functions.sh new file mode 100644 index 0000000000..8167360e31 --- /dev/null +++ b/source4/script/tests/test_functions.sh @@ -0,0 +1,57 @@ +testit() { + name=$1 + shift 1 + trap "rm -f test.$$" EXIT + cmdline="$*" + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "--==--==--==--==--==--==--==--==--==--==--" + echo "Running test $name (level 0 stdout)" + echo "--==--==--==--==--==--==--==--==--==--==--" + date + else + echo "Testing $name" + fi + ( $cmdline > test.$$ 2>&1 ) + status=$? + if [ x"$status" != x"0" ]; then + cat test.$$; + rm -f test.$$; + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "==========================================" + echo "TEST FAILED: $name (status $ret)" + echo "==========================================" + else + echo "TEST FAILED: $name (status $ret)" + fi + return 1; + fi + rm -f test.$$; + if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then + echo "==========================================" + echo "TEST PASSED: $name" + echo "==========================================" + fi + return 0; +} + +testok() { + name=`basename $1` + failed=$2 + if [ x"$failed" = x"0" ];then + : + else + echo "$failed TESTS FAILED ($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 +} diff --git a/source4/script/tests/test_posix.sh b/source4/script/tests/test_posix.sh index b245dc9ff0..3e160e3a76 100755 --- a/source4/script/tests/test_posix.sh +++ b/source4/script/tests/test_posix.sh @@ -21,30 +21,8 @@ start="$4" shift 4 ADDARGS="$*" -testit() { - trap "rm -f test.$$" EXIT - - cmdline="$*" - if ! $cmdline > test.$$; then - cat test.$$; - rm -f test.$$; - echo "TEST FAILED - $cmdline"; - return 1; - fi - rm -f test.$$; - return 0; -} - -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh tests="BASE-FDPASS BASE-LOCK1 BASE-LOCK2 BASE-LOCK3 BASE-LOCK4" tests="$tests BASE-LOCK5 BASE-LOCK6 BASE-LOCK7 BASE-UNLINK BASE-ATTR" @@ -67,8 +45,8 @@ for t in $tests; do continue; fi start="" - echo Testing $t - testit $VALGRIND bin/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` + name="$t" + testit "$name" $VALGRIND bin/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` done testok $0 $failed diff --git a/source4/script/tests/test_rpc.sh b/source4/script/tests/test_rpc.sh index 9d87e63865..19fd76e483 100755 --- a/source4/script/tests/test_rpc.sh +++ b/source4/script/tests/test_rpc.sh @@ -23,29 +23,8 @@ password="$3" domain="$4" shift 4 -testit() { - trap "rm -f test.$$" EXIT - cmdline="$*" - if ! $cmdline > test.$$ 2>&1; then - cat test.$$; - rm -f test.$$; - echo "TEST FAILED - $cmdline"; - return 1; - fi - rm -f test.$$; - return 0; -} - -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh failed=0 for bindoptions in connect sign seal sign,seal spnego spnego,sign spnego,seal validate padcheck bigendian bigendian,seal; do @@ -56,8 +35,8 @@ for bindoptions in connect sign seal sign,seal spnego spnego,sign spnego,seal va ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; esac for t in $tests; do - echo Testing $t on $transport with $bindoptions - testit $VALGRIND bin/smbtorture $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" || failed=`expr $failed + 1` + name="$t on $transport with $bindoptions" + testit "$name" $VALGRIND bin/smbtorture $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" || failed=`expr $failed + 1` done done done diff --git a/source4/script/tests/test_w2k3.sh b/source4/script/tests/test_w2k3.sh index 6b5f12c721..c8f5957442 100755 --- a/source4/script/tests/test_w2k3.sh +++ b/source4/script/tests/test_w2k3.sh @@ -25,36 +25,15 @@ domain="$4" realm="$5" shift 5 -testit() { - trap "rm -f test.$$" EXIT - cmdline="$*" - if ! $VALGRIND $cmdline > test.$$ 2>&1; then - cat test.$$; - rm -f test.$$; - echo "TEST FAILED - $cmdline"; - exit 1; - fi - rm -f test.$$; - return 0; -} - -testok() { - name=`basename $1` - failed=$2 - if [ x"$failed" = x"0" ];then - echo "ALL OK ($name)"; - else - echo "$failed TESTS FAILED ($name)"; - fi - exit $failed -} +incdir=`dirname $0` +. $incdir/test_functions.sh OPTIONS="-U$username%$password -W $domain --option realm=$realm" failed=0 -echo Testing RPC-SPOOLSS on ncacn_np -testit bin/smbtorture ncacn_np:"$server" $OPTIONS RPC-SPOOLSS "$*" || failed=`expr $failed + 1` +name="RPC-SPOOLSS on ncacn_np" +testit "$name" bin/smbtorture ncacn_np:"$server" $OPTIONS RPC-SPOOLSS "$*" || failed=`expr $failed + 1` for bindoptions in padcheck connect sign seal spnego,sign spnego,seal validate bigendian; do for transport in ncacn_ip_tcp ncacn_np; do @@ -63,15 +42,15 @@ for bindoptions in padcheck connect sign seal spnego,sign spnego,seal validate b ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; esac for t in $tests; do - echo Testing $t on $transport with $bindoptions - testit bin/smbtorture $transport:"$server[$bindoptions]" $OPTIONS $t "$*" || failed=`expr $failed + 1` + name="$t on $transport with $bindoptions" + testit "$name" bin/smbtorture $transport:"$server[$bindoptions]" $OPTIONS $t "$*" || failed=`expr $failed + 1` done done done -echo Testing RPC-DRSUAPI on ncacn_ip_tcp with seal -testit bin/smbtorture ncacn_ip_tcp:"$server[seal]" $OPTIONS RPC-DRSUAPI "$*" || failed=`expr $failed + 1` -echo Testing RPC-DRSUAPI on ncacn_ip_tcp with seal,bigendian -testit bin/smbtorture ncacn_ip_tcp:"$server[seal,bigendian]" $OPTIONS RPC-DRSUAPI "$*" || failed=`expr $failed + 1` +name="RPC-DRSUAPI on ncacn_ip_tcp with seal" +testit "$name" bin/smbtorture ncacn_ip_tcp:"$server[seal]" $OPTIONS RPC-DRSUAPI "$*" || failed=`expr $failed + 1` +name="RPC-DRSUAPI on ncacn_ip_tcp with seal,bigendian" +testit "$name" bin/smbtorture ncacn_ip_tcp:"$server[seal,bigendian]" $OPTIONS RPC-DRSUAPI "$*" || failed=`expr $failed + 1` testok $0 $failed |