1#! /bin/sh
2# OpenLDAP: pkg/ldap/tests/scripts/sql-all,v 1.5.2.5 2010/04/13 20:24:00 kurt Exp
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2010 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
16SHTOOL="$SRCDIR/../build/shtool"
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
24SLEEPTIME=10
25
26echo "#######################################################################"
27echo "###                                                                 ###"
28echo "### SQL tests                                                       ###"
29echo "###                                                                 ###"
30echo "#######################################################################"
31echo "###"
32echo "### SQL tests require the sql backend, a properly configured"
33echo "### ODBC and a database populated with data from the applicable"
34echo "### servers/slapd/back-sql/rdbms_depend/* files."
35echo "###"
36echo "### Set SLAPD_USE_SQL to the desired RDBMS to enable this test;"
37echo "###"
38echo "### Currently supported RDBMSes are:"
39echo "###         ibmdb2, mysql, pgsql"
40echo "###"
41echo "### Set SLAPD_USE_SQLWRITE=yes to enable the write tests"
42echo "###"
43echo "### See servers/slapd/back-sql/rdbms_depend/README for more "
44echo "### details on how to set up the RDBMS and the ODBC"
45echo "###"
46
47echo ">>>>> Executing all LDAP tests for $BACKEND"
48
49for CMD in $SRCDIR/scripts/sql-test*; do
50	# remove cruft from prior test
51	if test $PRESERVE = yes ; then
52		/bin/rm -rf testrun/db.*
53	else
54		/bin/rm -rf testrun
55	fi
56
57	echo ">>>>> Starting ${TB}`basename $CMD`${TN} ..."
58	$CMD
59	RC=$?
60	if test $RC -eq 0 ; then
61		echo ">>>>> $CMD completed ${TB}OK${TN}."
62	else
63		echo ">>>>> $CMD ${TB}failed${TN} (exit $RC)"
64		exit $RC
65	fi
66
67	echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
68	sleep $SLEEPTIME
69	echo ""
70done
71