1#!/bin/sh
2
3PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
4export PATH
5SCHEMA_NEEDED="core nis cosine inetorgperson openldap"
6
7# setup needed schema files
8for f in $SCHEMA_NEEDED; do
9    if [ ! -r tests/schema/$f.schema ]; then
10	mkdir -p tests/schema
11	if [ -r /etc/ldap/schema/$f.schema ]; then
12	    ln -s /etc/ldap/schema/$f.schema tests/schema/$f.schema
13	    continue;
14	fi
15	if [ -r /etc/openldap/schema/$f.schema ]; then
16	    ln -s /etc/openldap/schema/$f.schema tests/schema/$f.schema
17	    continue;
18	fi
19
20	echo "SKIPPING TESTS: you need the following OpenLDAP schema files"
21	for f in $SCHEMA_NEEDED; do
22	    echo "  $f.schema"
23	done
24	exit 0
25    fi
26done
27
28if [ -z "$LDBDIR" ]; then
29    LDBDIR=`dirname $0`/..
30    export LDBDIR
31fi
32
33LDB_URL=`$LDBDIR/tests/ldapi_url.sh`
34export LDB_URL
35
36PATH=bin:$PATH
37export PATH
38
39LDB_SPECIALS=0
40export LDB_SPECIALS
41
42if $LDBDIR/tests/init_slapd.sh &&
43   $LDBDIR/tests/start_slapd.sh &&
44   $LDBDIR/tests/test-generic.sh; then
45    echo "ldap tests passed";
46    ret=0
47else
48    echo "ldap tests failed";
49    ret=$?
50fi
51
52#$LDBDIR/tests/kill_slapd.sh
53
54exit $ret
55