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