Log test timing information

This commit is contained in:
Ondřej Kuzník 2022-04-08 18:00:58 +01:00 committed by Quanah Gibson-Mount
parent f7bdf7aaf4
commit 2bb3661c04
4 changed files with 36 additions and 10 deletions

View file

@ -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`

View file

@ -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

20
tests/scripts/functions.sh Executable file
View file

@ -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
}

View file

@ -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`