diff options
Diffstat (limited to 'testprogs')
-rwxr-xr-x | testprogs/blackbox/subunit.sh | 67 | ||||
-rwxr-xr-x | testprogs/blackbox/test_cifsdd.sh | 24 | ||||
-rwxr-xr-x | testprogs/blackbox/test_gentest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_kinit.sh | 16 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ldb.sh | 2 | ||||
-rwxr-xr-x | testprogs/blackbox/test_locktest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_masktest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ndrdump.sh | 17 | ||||
-rwxr-xr-x | testprogs/blackbox/test_smbclient.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_wbinfo.sh | 15 |
10 files changed, 81 insertions, 120 deletions
diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh new file mode 100755 index 00000000000..7a6b21e540e --- /dev/null +++ b/testprogs/blackbox/subunit.sh @@ -0,0 +1,67 @@ +# +# subunit.sh: shell functions to report test status via the subunit protocol. +# Copyright (C) 2006 Robert Collins <robertc@robertcollins.net> +# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org> +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +subunit_start_test () { + # emit the current protocol start-marker for test $1 + echo "test: $1" +} + + +subunit_pass_test () { + # emit the current protocol test passed marker for test $1 + echo "success: $1" +} + + +subunit_fail_test () { + # emit the current protocol fail-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "failure: $1 [" + cat - + echo "]" +} + + +subunit_error_test () { + # emit the current protocol error-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "error: $1 [" + cat - + echo "]" +} + +testit () { + name="$1" + shift + cmdline="$*" + subunit_start_test "$name" + $cmdline + status=$? + if [ x$status = x0 ]; then + subunit_pass_test "$name" + else + subunit_fail_test "$name" + fi + return $status +} diff --git a/testprogs/blackbox/test_cifsdd.sh b/testprogs/blackbox/test_cifsdd.sh index 23df04c84c9..43564a0c77f 100755 --- a/testprogs/blackbox/test_cifsdd.sh +++ b/testprogs/blackbox/test_cifsdd.sh @@ -14,40 +14,24 @@ USERNAME=$2 PASSWORD=$3 DOMAIN=$4 +. `dirname $0`/subunit.sh + samba4bindir=`dirname $0`/../../source/bin DD=$samba4bindir/cifsdd SHARE=tmp DEBUGLEVEL=1 -failed=0 - -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - failed=`expr $failed + 1` - fi - return $status -} - runcopy() { message="$1" shift testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \ - "$@" + "$@" || failed=`expr $failed + 1` } compare() { - testit "$1" cmp "$2" "$3" + testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1` } sourcepath=tempfile.src.$$ diff --git a/testprogs/blackbox/test_gentest.sh b/testprogs/blackbox/test_gentest.sh index 89cc8c2795b..ec6f0e422bc 100755 --- a/testprogs/blackbox/test_gentest.sh +++ b/testprogs/blackbox/test_gentest.sh @@ -20,20 +20,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin gentest=$samba4bindir/gentest -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 -} +. `dirname $0`/subunit.sh cat <<EOF > st/gentest.ignore all_info.out.fname diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh index 29582055ee0..db4b65f3276 100755 --- a/testprogs/blackbox/test_kinit.sh +++ b/testprogs/blackbox/test_kinit.sh @@ -25,21 +25,7 @@ samba4kinit=$samba4bindir/samba4kinit net=$samba4bindir/net enableaccount="$samba4bindir/smbpython `dirname $0`/../../source/setup/enableaccount" -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 -} - +. `dirname $0`/subunit.sh test_smbclient() { name="$1" diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh index 4067a7fc433..8e1af997191 100755 --- a/testprogs/blackbox/test_ldb.sh +++ b/testprogs/blackbox/test_ldb.sh @@ -14,6 +14,8 @@ PREFIX=$3 shift 2 options="$*" +. `dirname $0`/subunit.sh + check() { name="$1" shift diff --git a/testprogs/blackbox/test_locktest.sh b/testprogs/blackbox/test_locktest.sh index c08b408107c..88fa0ef8924 100755 --- a/testprogs/blackbox/test_locktest.sh +++ b/testprogs/blackbox/test_locktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin locktest=$samba4bindir/locktest -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 -} +. `dirname $0`/subunit.sh testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100 -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_masktest.sh b/testprogs/blackbox/test_masktest.sh index ef429a1fb06..c1f765c1dd7 100755 --- a/testprogs/blackbox/test_masktest.sh +++ b/testprogs/blackbox/test_masktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin masktest=$samba4bindir/masktest -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 -} +. `dirname $0`/subunit.sh testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh index 38c33ad3c16..089a7c3a2b4 100755 --- a/testprogs/blackbox/test_ndrdump.sh +++ b/testprogs/blackbox/test_ndrdump.sh @@ -4,27 +4,14 @@ # Copyright (C) 2008 Andrew Bartlett # based on test_smbclient.sh +. `dirname $0`/subunit.sh + failed=0 samba4bindir=`dirname $0`/../../source/bin ndrdump=$samba4bindir/ndrdump files=`dirname $0`/ndrdump -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 -} - testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh index 4df64cac947..d2c5c675e2e 100755 --- a/testprogs/blackbox/test_smbclient.sh +++ b/testprogs/blackbox/test_smbclient.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin smbclient=$samba4bindir/smbclient -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 -} +. `dirname $0`/subunit.sh runcmd() { name="$1" diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh index 1ece5a60f24..ec8b9ebd443 100755 --- a/testprogs/blackbox/test_wbinfo.sh +++ b/testprogs/blackbox/test_wbinfo.sh @@ -17,20 +17,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin wbinfo=$samba4bindir/wbinfo -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 -} +. `dirname $0`/subunit.sh testfail() { name="$1" |