Home | History | Annotate | Line # | Download | only in scripts
      1 #! /bin/sh
      2 # $OpenLDAP$
      3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
      4 ##
      5 ## Copyright 1998-2022 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 echo ">>>>> Executing all LDAP tests for $BACKEND"
     29 
     30 if [ -n "$NOEXIT" ]; then
     31 	echo "Result	Test" > $TESTWD/results
     32 fi
     33 
     34 for CMD in ${SCRIPTDIR}/test*; do
     35 	case "$CMD" in
     36 		*~)		continue;;
     37 		*.bak)	continue;;
     38 		*.orig)	continue;;
     39 		*.sav)	continue;;
     40 		*.py)	continue;;
     41 		*)		test -f "$CMD" || continue;;
     42 	esac
     43 
     44 	# remove cruft from prior test
     45 	if test $PRESERVE = yes ; then
     46 		/bin/rm -rf $TESTDIR/db.*
     47 	else
     48 		/bin/rm -rf $TESTDIR
     49 	fi
     50 
     51 	BCMD=`basename $CMD`
     52 	if [ -x "$CMD" ]; then
     53 		echo ">>>>> Starting ${TB}$BCMD${TN} for $BACKEND..."
     54 		$CMD
     55 		RC=$?
     56 		if test $RC -eq 0 ; then
     57 			echo ">>>>> $BCMD completed ${TB}OK${TN} for $BACKEND."
     58 		else
     59 			echo ">>>>> $BCMD ${TB}failed${TN} for $BACKEND"
     60 			FAILCOUNT=`expr $FAILCOUNT + 1`
     61 
     62 			if [ -n "$NOEXIT" ]; then
     63 				echo "Continuing."
     64 			else
     65 				echo "(exit $RC)"
     66 				exit $RC
     67 			fi
     68 		fi
     69 	else
     70 		echo ">>>>> Skipping ${TB}$BCMD${TN} for $BACKEND."
     71 		SKIPCOUNT=`expr $SKIPCOUNT + 1`
     72 		RC="-"
     73 	fi
     74 
     75 	if [ -n "$NOEXIT" ]; then
     76 		echo "$RC	$BCMD" >> $TESTWD/results
     77 	fi
     78 
     79 #	echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
     80 #	sleep $SLEEPTIME
     81 	echo ""
     82 done
     83 
     84 if [ -n "$NOEXIT" ]; then
     85 	if [ "$FAILCOUNT" -gt 0 ]; then
     86 		cat $TESTWD/results
     87 		echo "$FAILCOUNT tests for $BACKEND ${TB}failed${TN}. Please review the test log."
     88 	else
     89 		echo "All executed tests for $BACKEND ${TB}succeeded${TN}."
     90 	fi
     91 fi
     92 
     93 echo "$SKIPCOUNT tests for $BACKEND were ${TB}skipped${TN}."
     94