xref: /netbsd-src/external/bsd/openldap/dist/contrib/slapd-modules/variant/tests/scripts/test004-compare (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1#! /bin/sh
2## $OpenLDAP$
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 2016-2021 The OpenLDAP Foundation.
6## All rights reserved.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted only as authorized by the OpenLDAP
10## Public License.
11##
12## A copy of this license is available in the file LICENSE in the
13## top-level directory of the distribution or, alternatively, at
14## <http://www.OpenLDAP.org/license.html>.
15##
16## ACKNOWLEDGEMENTS:
17## This module was written in 2016 by Ondřej Kuzník for Symas Corp.
18
19echo "running defines.sh"
20. $SRCDIR/scripts/defines.sh
21
22. ${SCRIPTDIR}/common.sh
23
24echo "Comparing a regular entry..."
25$LDAPCOMPARE -H $URI1 \
26	"cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN" \
27	"cn:Mark Elliot" >> $TESTOUT 2>&1
28RC=$?
29if test $RC != 6 && test $RC,$BACKEND != 5,null ; then
30	echo "ldapcompare failed ($RC)!"
31	test $KILLSERVERS != no && kill -HUP $KILLPIDS
32	exit 1
33fi
34
35echo "Comparing a variant entry..."
36$LDAPCOMPARE -H $URI1 \
37	"ou=People,$BASEDN" \
38	"description:The Example, Inc. at Anytown" >> $TESTOUT 2>&1
39RC=$?
40if test $RC != 6 && test $RC,$BACKEND != 5,null ; then
41	echo "ldapcompare failed ($RC)!"
42	test $KILLSERVERS != no && kill -HUP $KILLPIDS
43	exit 1
44fi
45
46echo "Comparing a regex entry..."
47$LDAPCOMPARE -H $URI1 \
48	"cn=Barbara Jensen,ou=Information Technology Division,ou=People,$BASEDN" \
49	"ou:Information Technology Division" >> $TESTOUT 2>&1
50RC=$?
51if test $RC != 6 && test $RC,$BACKEND != 5,null ; then
52	echo "ldapcompare failed ($RC)!"
53	test $KILLSERVERS != no && kill -HUP $KILLPIDS
54	exit 1
55fi
56
57test $KILLSERVERS != no && kill -HUP $KILLPIDS
58
59echo ">>>>> Test succeeded"
60
61test $KILLSERVERS != no && wait
62
63exit 0
64