Use the subunit shell library.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 16 Apr 2008 12:52:29 +0000 (14:52 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 16 Apr 2008 12:52:29 +0000 (14:52 +0200)
testprogs/blackbox/test_cifsdd.sh
testprogs/blackbox/test_gentest.sh
testprogs/blackbox/test_kinit.sh
testprogs/blackbox/test_ldb.sh
testprogs/blackbox/test_locktest.sh
testprogs/blackbox/test_masktest.sh
testprogs/blackbox/test_ndrdump.sh
testprogs/blackbox/test_smbclient.sh
testprogs/blackbox/test_wbinfo.sh

index 23df04c84c9aef95a3aeb6e9e1459cfe25867645..43564a0c77f3ba9601ecc1c4087e44181dfc535a 100755 (executable)
@@ -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.$$
index 89cc8c2795b7971ceada30eb5f2bf52a31ea3040..ec6f0e422bc3d44f6c01d184b77201284af51a7e 100755 (executable)
@@ -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
index 29582055ee0832cfcc1350c4d7ac3b860504a8e6..db4b65f327659452201c66095e32f7be78d2e6bc 100755 (executable)
@@ -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"
index 4067a7fc4331a873ff2ab3657855705b6b73ad4d..8e1af99719178cf7bf2c32ddc2a9a5d557fd82a6 100755 (executable)
@@ -14,6 +14,8 @@ PREFIX=$3
 shift 2
 options="$*"
 
+. `dirname $0`/subunit.sh
+
 check() {
        name="$1"
        shift
index c08b408107c0073d9d894d29385e9df6c22128e8..88fa0ef89242920d9022990eb8087c733cdcef69 100755 (executable)
@@ -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`
 
index ef429a1fb06b556af787591e5a3cbbff2853d8fe..c1f765c1dd7b2facb43aa208daea0669ac27d45e 100755 (executable)
@@ -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`
 
index 38c33ad3c160fdb1af8d6ea769ddaf6771b1e9da..089a7c3a2b45746d9e0e7a37a5fb7ccd42ed1476 100755 (executable)
@@ -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`
index 4df64cac947040995e6397d768689fe1f424ca88..d2c5c675e2ef7dafee77dac9241471b386453f74 100755 (executable)
@@ -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"
index b309b302dd33d21c6101f278db73e0d702b91944..d993ed2ca7da00b4b9ff22ac2c0134fc40a7966e 100755 (executable)
@@ -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"