]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Log test timing information
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 8 Apr 2022 17:00:58 +0000 (18:00 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 12 Apr 2022 16:53:52 +0000 (16:53 +0000)
tests/scripts/all
tests/scripts/defines.sh
tests/scripts/functions.sh [new file with mode: 0755]
tests/scripts/lloadd-all

index cd6690c779b1b63e39a4628daf20a40231f55180..a4808f43586bc0402cc61e54eed71c8d2d98c2cd 100755 (executable)
@@ -25,7 +25,7 @@ FAILCOUNT=0
 SKIPCOUNT=0
 SLEEPTIME=10
 
-echo ">>>>> Executing all LDAP tests for $BACKEND"
+echo ">>>>> $(timer) Executing all LDAP tests for $BACKEND"
 
 if [ -n "$NOEXIT" ]; then
        echo "Result    Test" > $TESTWD/results
@@ -50,7 +50,7 @@ for CMD in $SRCDIR/scripts/test*; do
 
        BCMD=`basename $CMD`
        if [ -x "$CMD" ]; then
-               MSG=">>>>> Starting ${TB}$BCMD${TN} for $BACKEND..."
+               MSG=">>>>> $(timer) Starting ${TB}$BCMD${TN} for $BACKEND..."
                [ -n "$TESTINST" ] && echo "$MSG" >&2
                echo "$MSG"
                START=`date +%s`
@@ -63,11 +63,11 @@ for CMD in $SRCDIR/scripts/test*; do
                END=`date +%s`
 
                if test $RC -eq 0 ; then
-                       MSG=">>>>> Finished $BCMD for $BACKEND after $(( $END - $START )) seconds."
+                       MSG=">>>>> $(timer) Finished $BCMD for $BACKEND after $(( $END - $START )) seconds."
                        [ -n "$TESTINST" ] && echo "$MSG" >&2
                        echo "$MSG"
                else
-                       MSG=">>>>> Failed   $BCMD for $BACKEND after $(( $END - $START )) seconds"
+                       MSG=">>>>> $(timer) Failed   $BCMD for $BACKEND after $(( $END - $START )) seconds"
                        [ -n "$TESTINST" ] && echo "$MSG" >&2
                        echo "$MSG"
                        FAILCOUNT=`expr $FAILCOUNT + 1`
@@ -80,7 +80,7 @@ for CMD in $SRCDIR/scripts/test*; do
                        fi
                fi
        else
-               MSG=">>>>> Skipping ${TB}$BCMD${TN} for $BACKEND."
+               MSG=">>>>> $(timer) Skipping ${TB}$BCMD${TN} for $BACKEND."
                [ -n "$TESTINST" ] && echo "$MSG" >&2
                echo "$MSG"
                SKIPCOUNT=`expr $SKIPCOUNT + 1`
index 23e7c0c2f7fe54ef177ea701e95c208eb34fb494..192b30440e91064281b1636a79edc5f3dbb55ae8 100755 (executable)
@@ -17,6 +17,11 @@ umask 077
 
 TESTWD=`pwd`
 
+if [ -z "$STARTTIME" ]; then
+    STARTTIME=$(date +%s)
+fi
+export STARTTIME
+
 # per instance
 TESTDIR=${USER_TESTDIR-$TESTWD/testrun}
 BASEPORT=${SLAPD_BASEPORT-9010}
@@ -455,3 +460,4 @@ MEMBEROFOUT=$DATADIR/memberof.out
 MEMBEROFREFINTOUT=$DATADIR/memberof-refint.out
 SHTOOL="$SRCDIR/../build/shtool"
 
+. $ABS_SRCDIR/scripts/functions.sh
diff --git a/tests/scripts/functions.sh b/tests/scripts/functions.sh
new file mode 100755 (executable)
index 0000000..c10dfeb
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 2022 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+timer() {
+       if [ -n "$STARTTIME" ]; then
+               date -u -d "now - $STARTTIME sec" +%T
+       fi
+}
index 3f744d18817a9413cb30ccf215d97e2acb6a79a0..07a90de867e9e1809fddb5bbea1e419ccc684720 100755 (executable)
@@ -25,7 +25,7 @@ FAILCOUNT=0
 SKIPCOUNT=0
 SLEEPTIME=10
 
-echo ">>>>> Executing all LDAP tests for the Load Balancer"
+echo ">>>>> $(timer) Executing all LDAP tests for the Load Balancer"
 
 if [ -n "$NOEXIT" ]; then
     echo "Result    Test" > $TESTWD/results
@@ -49,7 +49,7 @@ for CMD in $SRCDIR/scripts/lloadd/test*; do
 
     BCMD=`basename $CMD`
     if [ -x "$CMD" ]; then
-        MSG=">>>>> Starting ${TB}$BCMD${TN} for lloadd+$BACKEND..."
+        MSG=">>>>> $(timer) Starting ${TB}$BCMD${TN} for lloadd+$BACKEND..."
         [ -n "$TESTINST" ] && echo "$MSG" >&2
         echo "$MSG"
         START=`date +%s`
@@ -62,11 +62,11 @@ for CMD in $SRCDIR/scripts/lloadd/test*; do
         END=`date +%s`
 
         if test $RC -eq 0 ; then
-            MSG=">>>>> Finished $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds."
+            MSG=">>>>> $(timer) Finished $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds."
             [ -n "$TESTINST" ] && echo "$MSG" >&2
             echo "$MSG"
         else
-            MSG=">>>>> Failed   $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds"
+            MSG=">>>>> $(timer) Failed   $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds"
             [ -n "$TESTINST" ] && echo "$MSG" >&2
             echo "$MSG"
             FAILCOUNT=`expr $FAILCOUNT + 1`
@@ -79,7 +79,7 @@ for CMD in $SRCDIR/scripts/lloadd/test*; do
             fi
         fi
     else
-        MSG=">>>>> Skipping ${TB}$BCMD${TN} for lloadd+$BACKEND."
+        MSG=">>>>> $(timer) Skipping ${TB}$BCMD${TN} for lloadd+$BACKEND."
         [ -n "$TESTINST" ] && echo "$MSG" >&2
         echo "$MSG"
         SKIPCOUNT=`expr $SKIPCOUNT + 1`