]> git.sur5r.net Git - openldap/blob - tests/scripts/test001-ldif2ldbm
Update build environment to fix VPATH support.
[openldap] / tests / scripts / test001-ldif2ldbm
1 #!/bin/sh
2
3 if [ $# -eq 0 ]; then
4         SRCDIR="."
5 else
6         SRCDIR=$1; shift
7 fi
8
9 echo "running defines.sh $SRCDIR"
10
11 . $SRCDIR/scripts/defines.sh $SRCDIR
12
13 echo "Datadir is $DATADIR"
14
15 echo "Cleaning up in $DBDIR..."
16
17 rm -f $DBDIR/[!C]*
18
19 echo "Running ldif2ldbm to build slapd database..."
20 $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools
21 RC=$?
22 if [ $RC != 0 ]; then
23         echo "ldif2ldbm failed!"
24         exit $RC
25 fi
26
27 echo "Starting slapd on TCP/IP port $PORT..."
28 $SLAPD -f $CONF -p $PORT -d 1 > $MASTERLOG 2>&1 &
29 PID=$!
30
31 echo "Using ldapsearch to retrieve all the entries..."
32 for i in 0 1 2 3 4 5; do
33         $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
34                 'objectClass=*' > $SEARCHOUT 2>&1
35         RC=$?
36         if [ $RC = 1 ]; then
37                 echo "Waiting 5 seconds for slapd to start..."
38                 sleep 5
39         fi
40 done
41
42 kill -HUP $PID
43
44 if [ $RC != 0 ]; then
45         echo "ldapsearch failed!"
46         exit $RC
47 fi
48
49 echo "Comparing retrieved entries to LDIF file used to create database"
50 cmp $SEARCHOUT $LDIF
51 if [ $? != 0 ]; then
52         echo "comparison failed - database was not created correctly"
53         exit 1
54 fi
55
56 echo ">>>>> Test succeeded"
57
58
59 exit 0