]> git.sur5r.net Git - openldap/blob - tests/scripts/test011-glue-slapadd
Fix CONF/CONF1 usage
[openldap] / tests / scripts / test011-glue-slapadd
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
8
9 echo "Running slapadd to build glued slapd databases..."
10 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
11 $SLAPADD -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
12 RC=$?
13 if test $RC != 0 ; then
14         echo "slapadd failed ($RC)!"
15         exit $RC
16 fi
17
18 echo "Starting slapd on TCP/IP port $PORT1..."
19 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
20 PID=$!
21 if test $WAIT != 0 ; then
22     echo PID $PID
23     read foo
24 fi
25 KILLPIDS="$PID"
26
27 echo "Using ldapsearch to retrieve all the entries..."
28 for i in 0 1 2 3 4 5; do
29         $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
30         RC=$?
31         if test $RC = 0 ; then
32                 break
33         fi
34         echo "Waiting 5 seconds for slapd to start..."
35         sleep 5
36 done
37
38 test $KILLSERVERS != no && kill -HUP $KILLPIDS
39
40 if test $RC != 0 ; then
41         echo "ldapsearch failed ($RC)!"
42         exit $RC
43 fi
44
45 echo "Filtering ldapsearch results..."
46 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
47 echo "Filtering original ldif used to create database..."
48 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
49 echo "Comparing filter output..."
50 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
51
52 if test $? != 0 ; then
53         echo "comparison failed - database was not created correctly"
54         echo $SEARCHFLT $LDIFFLT
55         $DIFF $SEARCHFLT $LDIFFLT
56         exit 1
57 fi
58
59 echo ">>>>> Test succeeded"
60 exit 0