1 #! /bin/sh 2 # $OpenLDAP$ 3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4 ## 5 ## Copyright 1998-2024 The OpenLDAP Foundation. 6 ## All rights reserved. 7 ## 8 ## Redistribution and use in source and binary forms, with or without 9 ## modification, are permitted only as authorized by the OpenLDAP 10 ## Public License. 11 ## 12 ## A copy of this license is available in the file LICENSE in the 13 ## top-level directory of the distribution or, alternatively, at 14 ## <http://www.OpenLDAP.org/license.html>. 15 16 . $SRCDIR/scripts/defines.sh 17 18 TB="" TN="" 19 if test -t 1 ; then 20 TB=`$SHTOOL echo -e "%B" 2>/dev/null` 21 TN=`$SHTOOL echo -e "%b" 2>/dev/null` 22 fi 23 24 FAILCOUNT=0 25 SKIPCOUNT=0 26 SLEEPTIME=10 27 28 # check for BSD vs GNU date 29 date -j >/dev/null 2>&1 30 RC=$? 31 if [ $RC -ne 0 ]; then 32 DATEOPT="-d @" 33 else 34 DATEOPT="-r " 35 fi 36 37 echo ">>>>> $(timer) Executing all LDAP tests for the Load Balancer" 38 39 if [ -n "$NOEXIT" ]; then 40 echo "Result Test" > $TESTWD/results 41 fi 42 43 for CMD in $SRCDIR/scripts/lloadd/test*; do 44 case "$CMD" in 45 *~) continue;; 46 *.bak) continue;; 47 *.orig) continue;; 48 *.sav) continue;; 49 *) test -f "$CMD" || continue;; 50 esac 51 52 # remove cruft from prior test 53 if test $PRESERVE = yes ; then 54 /bin/rm -rf $TESTDIR/db.* 55 else 56 /bin/rm -rf $TESTDIR 57 fi 58 59 BCMD=`basename $CMD` 60 if [ -x "$CMD" ]; then 61 MSG=">>>>> $(timer) Starting ${TB}$BCMD${TN} for lloadd+$BACKEND..." 62 [ -n "$TESTINST" ] && echo "$MSG" >&2 63 echo "$MSG" 64 START=`date +%s` 65 if [ -n "$TESTINST" ]; then 66 $CMD 2>&1 67 else 68 $CMD 69 fi 70 RC=$? 71 END=`date +%s` 72 73 if test $RC -eq 0 ; then 74 MSG=">>>>> $(timer) Finished $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds." 75 [ -n "$TESTINST" ] && echo "$MSG" >&2 76 echo "$MSG" 77 else 78 MSG=">>>>> $(timer) Failed $BCMD for lloadd+$BACKEND after $(( $END - $START )) seconds" 79 [ -n "$TESTINST" ] && echo "$MSG" >&2 80 echo "$MSG" 81 FAILCOUNT=`expr $FAILCOUNT + 1` 82 83 if [ -n "$NOEXIT" ]; then 84 echo "Continuing." 85 else 86 echo "(exit $RC)" 87 exit $RC 88 fi 89 fi 90 else 91 MSG=">>>>> $(timer) Skipping ${TB}$BCMD${TN} for lloadd+$BACKEND." 92 [ -n "$TESTINST" ] && echo "$MSG" >&2 93 echo "$MSG" 94 SKIPCOUNT=`expr $SKIPCOUNT + 1` 95 RC="-" 96 fi 97 98 if [ -n "$NOEXIT" ]; then 99 echo "$RC $BCMD" >> $TESTWD/results 100 fi 101 102 # echo ">>>>> waiting $SLEEPTIME seconds for things to exit" 103 # sleep $SLEEPTIME 104 echo "" 105 done 106 107 if [ -n "$NOEXIT" ]; then 108 if [ "$FAILCOUNT" -gt 0 ]; then 109 cat $TESTWD/results 110 echo "$FAILCOUNT tests for $BACKEND ${TB}failed${TN}. Please review the test log." 111 else 112 echo "All executed tests for $BACKEND ${TB}succeeded${TN}." 113 fi 114 fi 115 116 echo "$SKIPCOUNT tests for the Load Balancer were ${TB}skipped${TN}." 117