1#! /bin/sh 2# $OpenLDAP$ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 1998-2021 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 18TB="" TN="" 19if test -t 1 ; then 20 TB=`$SHTOOL echo -e "%B" 2>/dev/null` 21 TN=`$SHTOOL echo -e "%b" 2>/dev/null` 22fi 23 24FAILCOUNT=0 25SKIPCOUNT=0 26SLEEPTIME=10 27 28echo ">>>>> Executing all LDAP tests for the Load Balancer" 29 30if [ -n "$NOEXIT" ]; then 31 echo "Result Test" > $TESTWD/results 32fi 33 34for CMD in $SRCDIR/scripts/lloadd/test*; do 35 case "$CMD" in 36 *~) continue;; 37 *.bak) continue;; 38 *.orig) continue;; 39 *.sav) continue;; 40 *) test -f "$CMD" || continue;; 41 esac 42 43 # remove cruft from prior test 44 if test $PRESERVE = yes ; then 45 /bin/rm -rf $TESTDIR/db.* 46 else 47 /bin/rm -rf $TESTDIR 48 fi 49 if test $BACKEND = ndb ; then 50 mysql --user root <<EOF 51 drop database if exists db_1; 52 drop database if exists db_2; 53 drop database if exists db_3; 54 drop database if exists db_4; 55 drop database if exists db_5; 56 drop database if exists db_6; 57EOF 58 fi 59 60 BCMD=`basename $CMD` 61 if [ -x "$CMD" ]; then 62 echo ">>>>> Starting ${TB}$BCMD${TN} for $BACKEND..." 63 START=`date +%s` 64 $CMD 65 RC=$? 66 END=`date +%s` 67 68 if test $RC -eq 0 ; then 69 echo ">>>>> $BCMD completed ${TB}OK${TN} for $BACKEND after $(( $END - $START )) seconds." 70 else 71 echo ">>>>> $BCMD ${TB}failed${TN} for $BACKEND after $(( $END - $START )) seconds" 72 FAILCOUNT=`expr $FAILCOUNT + 1` 73 74 if [ -n "$NOEXIT" ]; then 75 echo "Continuing." 76 else 77 echo "(exit $RC)" 78 exit $RC 79 fi 80 fi 81 else 82 echo ">>>>> Skipping ${TB}$BCMD${TN} for $BACKEND." 83 SKIPCOUNT=`expr $SKIPCOUNT + 1` 84 RC="-" 85 fi 86 87 if [ -n "$NOEXIT" ]; then 88 echo "$RC $BCMD" >> $TESTWD/results 89 fi 90 91# echo ">>>>> waiting $SLEEPTIME seconds for things to exit" 92# sleep $SLEEPTIME 93 echo "" 94done 95 96if [ -n "$NOEXIT" ]; then 97 if [ "$FAILCOUNT" -gt 0 ]; then 98 cat $TESTWD/results 99 echo "$FAILCOUNT tests for $BACKEND ${TB}failed${TN}. Please review the test log." 100 else 101 echo "All executed tests for $BACKEND ${TB}succeeded${TN}." 102 fi 103fi 104 105echo "$SKIPCOUNT tests for the Load Balancer were ${TB}skipped${TN}." 106