1 1.1 lukem #! /bin/sh 2 1.1.1.4 tron # $OpenLDAP$ 3 1.1 lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4 1.1 lukem ## 5 1.1.1.10 christos ## Copyright 1998-2024 The OpenLDAP Foundation. 6 1.1 lukem ## All rights reserved. 7 1.1 lukem ## 8 1.1 lukem ## Redistribution and use in source and binary forms, with or without 9 1.1 lukem ## modification, are permitted only as authorized by the OpenLDAP 10 1.1 lukem ## Public License. 11 1.1 lukem ## 12 1.1 lukem ## A copy of this license is available in the file LICENSE in the 13 1.1 lukem ## top-level directory of the distribution or, alternatively, at 14 1.1 lukem ## <http://www.OpenLDAP.org/license.html>. 15 1.1 lukem 16 1.1 lukem echo "running defines.sh" 17 1.1 lukem . $SRCDIR/scripts/defines.sh 18 1.1 lukem 19 1.1 lukem mkdir -p $TESTDIR $DBDIR1 20 1.1 lukem 21 1.1 lukem echo "Starting slapd on TCP/IP port $PORT1..." 22 1.1.1.9 christos . $CONFFILTER $BACKEND < $CONF > $CONF1 23 1.1.1.9 christos $SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 24 1.1 lukem PID=$! 25 1.1 lukem if test $WAIT != 0 ; then 26 1.1 lukem echo PID $PID 27 1.1 lukem read foo 28 1.1 lukem fi 29 1.1 lukem KILLPIDS="$PID" 30 1.1 lukem 31 1.1 lukem sleep 1 32 1.1 lukem 33 1.1 lukem echo "Using ldapsearch to check that slapd is running..." 34 1.1 lukem for i in 0 1 2 3 4 5; do 35 1.1.1.9 christos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 36 1.1 lukem 'objectclass=*' > /dev/null 2>&1 37 1.1 lukem RC=$? 38 1.1 lukem if test $RC = 0 ; then 39 1.1 lukem break 40 1.1 lukem fi 41 1.1 lukem echo "Waiting 5 seconds for slapd to start..." 42 1.1 lukem sleep 5 43 1.1 lukem done 44 1.1 lukem 45 1.1 lukem echo "Using ldapadd to populate the database..." 46 1.1.1.9 christos $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD < \ 47 1.1 lukem $LDIFORDERED > $TESTOUT 2>&1 48 1.1 lukem RC=$? 49 1.1 lukem if test $RC != 0 ; then 50 1.1 lukem echo "ldapadd failed ($RC)!" 51 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 52 1.1 lukem exit $RC 53 1.1 lukem fi 54 1.1 lukem 55 1.1 lukem echo "Using ldapsearch to read all the entries..." 56 1.1.1.9 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 57 1.1 lukem 'objectclass=*' > $SEARCHOUT 2>&1 58 1.1 lukem RC=$? 59 1.1 lukem 60 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 61 1.1 lukem 62 1.1 lukem if test $RC != 0 ; then 63 1.1 lukem echo "ldapsearch failed ($RC)!" 64 1.1 lukem exit $RC 65 1.1 lukem fi 66 1.1 lukem 67 1.1 lukem echo "Filtering ldapsearch results..." 68 1.1.1.3 adam $LDIFFILTER < $SEARCHOUT > $SEARCHFLT 69 1.1 lukem echo "Filtering original ldif used to create database..." 70 1.1.1.3 adam $LDIFFILTER < $LDIF > $LDIFFLT 71 1.1 lukem echo "Comparing filter output..." 72 1.1 lukem $CMP $SEARCHFLT $LDIFFLT > $CMPOUT 73 1.1 lukem 74 1.1 lukem if test $? != 0 ; then 75 1.1 lukem echo "comparison failed - database was not created correctly" 76 1.1 lukem exit 1 77 1.1 lukem fi 78 1.1 lukem 79 1.1 lukem echo ">>>>> Test succeeded" 80 1.1 lukem 81 1.1 lukem test $KILLSERVERS != no && wait 82 1.1 lukem 83 1.1 lukem exit 0 84