xref: /netbsd-src/external/bsd/openldap/dist/contrib/slapd-modules/variant/tests/scripts/all (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1*e670fd5cSchristos#! /bin/sh
2*e670fd5cSchristos# $OpenLDAP$
3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4*e670fd5cSchristos##
5*e670fd5cSchristos## Copyright 1998-2016 The OpenLDAP Foundation.
6*e670fd5cSchristos## All rights reserved.
7*e670fd5cSchristos##
8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without
9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP
10*e670fd5cSchristos## Public License.
11*e670fd5cSchristos##
12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the
13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at
14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>.
15*e670fd5cSchristos
16*e670fd5cSchristos. $SRCDIR/scripts/defines.sh
17*e670fd5cSchristos
18*e670fd5cSchristosTB="" TN=""
19*e670fd5cSchristosif test -t 1 ; then
20*e670fd5cSchristos	TB=`$SHTOOL echo -e "%B" 2>/dev/null`
21*e670fd5cSchristos	TN=`$SHTOOL echo -e "%b" 2>/dev/null`
22*e670fd5cSchristosfi
23*e670fd5cSchristos
24*e670fd5cSchristosFAILCOUNT=0
25*e670fd5cSchristosSKIPCOUNT=0
26*e670fd5cSchristosSLEEPTIME=10
27*e670fd5cSchristos
28*e670fd5cSchristosecho ">>>>> Executing all LDAP tests for $BACKEND"
29*e670fd5cSchristos
30*e670fd5cSchristosif [ -n "$NOEXIT" ]; then
31*e670fd5cSchristos	echo "Result	Test" > $TESTWD/results
32*e670fd5cSchristosfi
33*e670fd5cSchristos
34*e670fd5cSchristosfor CMD in ${SCRIPTDIR}/test*; do
35*e670fd5cSchristos	case "$CMD" in
36*e670fd5cSchristos		*~)		continue;;
37*e670fd5cSchristos		*.bak)	continue;;
38*e670fd5cSchristos		*.orig)	continue;;
39*e670fd5cSchristos		*.sav)	continue;;
40*e670fd5cSchristos		*)		test -f "$CMD" || continue;;
41*e670fd5cSchristos	esac
42*e670fd5cSchristos
43*e670fd5cSchristos	# remove cruft from prior test
44*e670fd5cSchristos	if test $PRESERVE = yes ; then
45*e670fd5cSchristos		/bin/rm -rf $TESTDIR/db.*
46*e670fd5cSchristos	else
47*e670fd5cSchristos		/bin/rm -rf $TESTDIR
48*e670fd5cSchristos	fi
49*e670fd5cSchristos	if test $BACKEND = ndb ; then
50*e670fd5cSchristos		mysql --user root <<EOF
51*e670fd5cSchristos		drop database if exists db_1;
52*e670fd5cSchristos		drop database if exists db_2;
53*e670fd5cSchristos		drop database if exists db_3;
54*e670fd5cSchristos		drop database if exists db_4;
55*e670fd5cSchristos		drop database if exists db_5;
56*e670fd5cSchristos		drop database if exists db_6;
57*e670fd5cSchristosEOF
58*e670fd5cSchristos	fi
59*e670fd5cSchristos
60*e670fd5cSchristos	BCMD=`basename $CMD`
61*e670fd5cSchristos	if [ -x "$CMD" ]; then
62*e670fd5cSchristos		echo ">>>>> Starting ${TB}$BCMD${TN} for $BACKEND..."
63*e670fd5cSchristos		$CMD
64*e670fd5cSchristos		RC=$?
65*e670fd5cSchristos		if test $RC -eq 0 ; then
66*e670fd5cSchristos			echo ">>>>> $BCMD completed ${TB}OK${TN} for $BACKEND."
67*e670fd5cSchristos		else
68*e670fd5cSchristos			echo ">>>>> $BCMD ${TB}failed${TN} for $BACKEND"
69*e670fd5cSchristos			FAILCOUNT=`expr $FAILCOUNT + 1`
70*e670fd5cSchristos
71*e670fd5cSchristos			if [ -n "$NOEXIT" ]; then
72*e670fd5cSchristos				echo "Continuing."
73*e670fd5cSchristos			else
74*e670fd5cSchristos				echo "(exit $RC)"
75*e670fd5cSchristos				exit $RC
76*e670fd5cSchristos			fi
77*e670fd5cSchristos		fi
78*e670fd5cSchristos	else
79*e670fd5cSchristos		echo ">>>>> Skipping ${TB}$BCMD${TN} for $BACKEND."
80*e670fd5cSchristos		SKIPCOUNT=`expr $SKIPCOUNT + 1`
81*e670fd5cSchristos		RC="-"
82*e670fd5cSchristos	fi
83*e670fd5cSchristos
84*e670fd5cSchristos	if [ -n "$NOEXIT" ]; then
85*e670fd5cSchristos		echo "$RC	$BCMD" >> $TESTWD/results
86*e670fd5cSchristos	fi
87*e670fd5cSchristos
88*e670fd5cSchristos#	echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
89*e670fd5cSchristos#	sleep $SLEEPTIME
90*e670fd5cSchristos	echo ""
91*e670fd5cSchristosdone
92*e670fd5cSchristos
93*e670fd5cSchristosif [ -n "$NOEXIT" ]; then
94*e670fd5cSchristos	if [ "$FAILCOUNT" -gt 0 ]; then
95*e670fd5cSchristos		cat $TESTWD/results
96*e670fd5cSchristos		echo "$FAILCOUNT tests for $BACKEND ${TB}failed${TN}. Please review the test log."
97*e670fd5cSchristos	else
98*e670fd5cSchristos		echo "All executed tests for $BACKEND ${TB}succeeded${TN}."
99*e670fd5cSchristos	fi
100*e670fd5cSchristosfi
101*e670fd5cSchristos
102*e670fd5cSchristosecho "$SKIPCOUNT tests for $BACKEND were ${TB}skipped${TN}."
103