1*e670fd5cSchristos#! /bin/sh 2*e670fd5cSchristos# $OpenLDAP$ 3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4*e670fd5cSchristos## 5*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation. 6*e670fd5cSchristos## All rights reserved. 7*e670fd5cSchristos## 8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without 9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP 10*e670fd5cSchristos## Public License. 11*e670fd5cSchristos## 12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the 13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at 14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>. 15*e670fd5cSchristos 16*e670fd5cSchristosecho "running defines.sh" 17*e670fd5cSchristos. $SRCDIR/scripts/defines.sh 18*e670fd5cSchristos 19*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1 20*e670fd5cSchristos 21*e670fd5cSchristosecho "Running slapadd to build slapd database..." 22*e670fd5cSchristos. $CONFFILTER $BACKEND < $CONF > $ADDCONF 23*e670fd5cSchristos$SLAPADD -f $ADDCONF -l $LDIFORDERED 24*e670fd5cSchristosRC=$? 25*e670fd5cSchristosif test $RC != 0 ; then 26*e670fd5cSchristos echo "slapadd failed ($RC)!" 27*e670fd5cSchristos exit $RC 28*e670fd5cSchristosfi 29*e670fd5cSchristos 30*e670fd5cSchristosecho "Testing modify, add, and delete using slapmodify..." 31*e670fd5cSchristos$SLAPMODIFY -f $ADDCONF -d $LVL -l $LDIFMODIFY > $TESTOUT 2>&1 32*e670fd5cSchristosRC=$? 33*e670fd5cSchristosif test $RC != 0 ; then 34*e670fd5cSchristos echo "slapmodify failed ($RC)!" 35*e670fd5cSchristos exit $RC 36*e670fd5cSchristosfi 37*e670fd5cSchristos 38*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT1..." 39*e670fd5cSchristos. $CONFFILTER $BACKEND < $CONF > $CONF1 40*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 41*e670fd5cSchristosPID=$! 42*e670fd5cSchristosif test $WAIT != 0 ; then 43*e670fd5cSchristos echo PID $PID 44*e670fd5cSchristos read foo 45*e670fd5cSchristosfi 46*e670fd5cSchristosKILLPIDS="$PID" 47*e670fd5cSchristos 48*e670fd5cSchristossleep 1 49*e670fd5cSchristos 50*e670fd5cSchristosecho "Using ldapsearch to retrieve all the entries..." 51*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 52*e670fd5cSchristos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 > $SEARCHOUT 2>&1 53*e670fd5cSchristos RC=$? 54*e670fd5cSchristos if test $RC = 0 ; then 55*e670fd5cSchristos break 56*e670fd5cSchristos fi 57*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 58*e670fd5cSchristos sleep 5 59*e670fd5cSchristosdone 60*e670fd5cSchristos 61*e670fd5cSchristosif test $RC != 0 ; then 62*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 63*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 64*e670fd5cSchristos exit $RC 65*e670fd5cSchristosfi 66*e670fd5cSchristos 67*e670fd5cSchristosLDIF=$MODIFYOUTPROVIDER 68*e670fd5cSchristos 69*e670fd5cSchristosecho "Filtering ldapsearch results..." 70*e670fd5cSchristos$LDIFFILTER < $SEARCHOUT > $SEARCHFLT 71*e670fd5cSchristosecho "Filtering original ldif used to create database..." 72*e670fd5cSchristos$LDIFFILTER < $LDIF > $LDIFFLT 73*e670fd5cSchristosecho "Comparing filter output..." 74*e670fd5cSchristos$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 75*e670fd5cSchristos 76*e670fd5cSchristosif test $? != 0 ; then 77*e670fd5cSchristos echo "modify operations did not complete correctly" 78*e670fd5cSchristos echo $SEARCHFLT $LDIFFLT 79*e670fd5cSchristos $DIFF $SEARCHFLT $LDIFFLT 80*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 81*e670fd5cSchristos exit 1 82*e670fd5cSchristosfi 83*e670fd5cSchristos 84*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 85*e670fd5cSchristos 86*e670fd5cSchristosecho ">>>>> Test succeeded" 87*e670fd5cSchristos 88*e670fd5cSchristostest $KILLSERVERS != no && wait 89*e670fd5cSchristos 90*e670fd5cSchristosexit 0 91