r7421: - move test* functions to a seperate file
authorStefan Metzmacher <metze@samba.org>
Thu, 9 Jun 2005 07:14:39 +0000 (07:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:51 +0000 (13:17 -0500)
- print build farm style output when RUN_FROM_BUILD_FARM=yes

metze
(This used to be commit 7e567a6b69d05fa180bb4384b503969f79f18068)

source4/script/tests/selftest.sh
source4/script/tests/test_binding_string.sh
source4/script/tests/test_echo.sh
source4/script/tests/test_functions.sh [new file with mode: 0644]
source4/script/tests/test_posix.sh
source4/script/tests/test_rpc.sh
source4/script/tests/test_w2k3.sh

index f9f4b766db0da37493d25ddba7c6580b5e236e19..436ca719dc0747a95ac69a753a8b30824faaa821 100755 (executable)
@@ -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
index 27310a1c99e7769b8c6b64b30e4e59ddc50098e7..a7934789dcfa111e5958c2e7c28f507a09ee79eb 100755 (executable)
@@ -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
index 2e0ed3ed02395065d403250ec4805a3972e08a4c..882050a5882229f09104da20ad18c02207356be1 100755 (executable)
@@ -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 (file)
index 0000000..8167360
--- /dev/null
@@ -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
+}
index b245dc9ff023aa86cb526b9c068625b3d19f03f9..3e160e3a7632e2fd0ac49e67fcbe904be79469b6 100755 (executable)
@@ -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
index 9d87e638657962f5607b5c31a455a01a800e6ffc..19fd76e483e4fd1a1066c1f0cd00cf76e42e07c5 100755 (executable)
@@ -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
index 6b5f12c721c572084ad7d31708e7dfec4b3eacff..c8f595744210992da430d0d4dfa20041007c9458 100755 (executable)
@@ -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