s4-dbcheck: support the 'none' option for prompts
[kai/samba-autobuild/.git] / lib / ldb / tests / test-ldap.sh
1 #!/bin/sh
2
3 PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
4 export PATH
5 SCHEMA_NEEDED="core nis cosine inetorgperson openldap"
6
7 # setup needed schema files
8 for 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
26 done
27
28 if [ -z "$LDBDIR" ]; then
29     LDBDIR=`dirname $0`/..
30     export LDBDIR
31 fi
32
33 LDB_URL=`$LDBDIR/tests/ldapi_url.sh`
34 export LDB_URL
35
36 PATH=bin:$PATH
37 export PATH
38
39 LDB_SPECIALS=0
40 export LDB_SPECIALS
41
42 if $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
47 else
48     echo "ldap tests failed";
49     ret=$?
50 fi
51
52 #$LDBDIR/tests/kill_slapd.sh
53
54 exit $ret