xref: /netbsd-src/external/bsd/openldap/dist/contrib/slapd-modules/variant/tests/scripts/test004-compare (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
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 2016-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*e670fd5cSchristos## ACKNOWLEDGEMENTS:
17*e670fd5cSchristos## This module was written in 2016 by Ondřej Kuzník for Symas Corp.
18*e670fd5cSchristos
19*e670fd5cSchristosecho "running defines.sh"
20*e670fd5cSchristos. $SRCDIR/scripts/defines.sh
21*e670fd5cSchristos
22*e670fd5cSchristos. ${SCRIPTDIR}/common.sh
23*e670fd5cSchristos
24*e670fd5cSchristosecho "Comparing a regular entry..."
25*e670fd5cSchristos$LDAPCOMPARE -H $URI1 \
26*e670fd5cSchristos	"cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN" \
27*e670fd5cSchristos	"cn:Mark Elliot" >> $TESTOUT 2>&1
28*e670fd5cSchristosRC=$?
29*e670fd5cSchristosif test $RC != 6 && test $RC,$BACKEND != 5,null ; then
30*e670fd5cSchristos	echo "ldapcompare failed ($RC)!"
31*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
32*e670fd5cSchristos	exit 1
33*e670fd5cSchristosfi
34*e670fd5cSchristos
35*e670fd5cSchristosecho "Comparing a variant entry..."
36*e670fd5cSchristos$LDAPCOMPARE -H $URI1 \
37*e670fd5cSchristos	"ou=People,$BASEDN" \
38*e670fd5cSchristos	"description:The Example, Inc. at Anytown" >> $TESTOUT 2>&1
39*e670fd5cSchristosRC=$?
40*e670fd5cSchristosif test $RC != 6 && test $RC,$BACKEND != 5,null ; then
41*e670fd5cSchristos	echo "ldapcompare failed ($RC)!"
42*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
43*e670fd5cSchristos	exit 1
44*e670fd5cSchristosfi
45*e670fd5cSchristos
46*e670fd5cSchristosecho "Comparing a regex entry..."
47*e670fd5cSchristos$LDAPCOMPARE -H $URI1 \
48*e670fd5cSchristos	"cn=Barbara Jensen,ou=Information Technology Division,ou=People,$BASEDN" \
49*e670fd5cSchristos	"ou:Information Technology Division" >> $TESTOUT 2>&1
50*e670fd5cSchristosRC=$?
51*e670fd5cSchristosif test $RC != 6 && test $RC,$BACKEND != 5,null ; then
52*e670fd5cSchristos	echo "ldapcompare failed ($RC)!"
53*e670fd5cSchristos	test $KILLSERVERS != no && kill -HUP $KILLPIDS
54*e670fd5cSchristos	exit 1
55*e670fd5cSchristosfi
56*e670fd5cSchristos
57*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS
58*e670fd5cSchristos
59*e670fd5cSchristosecho ">>>>> Test succeeded"
60*e670fd5cSchristos
61*e670fd5cSchristostest $KILLSERVERS != no && wait
62*e670fd5cSchristos
63*e670fd5cSchristosexit 0
64