]> git.sur5r.net Git - openldap/blob - tests/scripts/test004-modify
Disable broken test011
[openldap] / tests / scripts / test004-modify
1 #! /bin/sh
2 # $OpenLDAP$
3
4 SRCDIR="."
5 if test $# -ge 1 ; then
6         SRCDIR=$1; shift
7 fi
8 BACKEND=bdb
9 if test $# -ge 1 ; then
10         BACKEND=$1; shift
11 fi
12 WAIT=0
13 if test $# -ge 1 ; then
14         WAIT=1; shift
15 fi
16
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
19
20 echo "running defines.sh $SRCDIR $BACKEND"
21 . $SRCDIR/scripts/defines.sh
22
23 echo "Cleaning up in $DBDIR..."
24
25 rm -f $DBDIR/[!C]*
26
27 echo "Running slapadd to build slapd database..."
28 . $CONFFILTER $BACKEND < $CONF > $DBCONF
29 $SLAPADD -f $DBCONF -l $LDIFORDERED
30 RC=$?
31 if test $RC != 0 ; then
32         echo "slapadd failed ($RC)!"
33         exit $RC
34 fi
35
36 echo "Starting slapd on TCP/IP port $PORT..."
37 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
38 PID=$!
39 if test $WAIT != 0 ; then
40     echo PID $PID
41     read foo
42 fi
43
44 echo "Testing slapd modify operations..."
45 for i in 0 1 2 3 4 5; do
46         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
47                 'objectclass=*' > /dev/null 2>&1
48         RC=$?
49         if test $RC = 1 ; then
50                 echo "Waiting 5 seconds for slapd to start..."
51                 sleep 5
52         fi
53 done
54
55 if test $RC != 0 ; then
56         echo "ldapsearch failed ($RC)!"
57         kill -HUP $PID
58         exit $RC
59 fi
60
61 echo "Testing modify, add, and delete..."
62 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
63         $TESTOUT 2>&1 << EOMODS
64 version: 1
65
66 # LEADING COMMENT AND WHITE SPACE
67
68 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michigan,c=US
69 # EMBEDDED COMMENT
70 changetype: modify
71 add: drink
72 drink: Orange Juice
73
74 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
75 changetype: modify
76 # EMBEDDED COMMENT
77  CONTINUED
78 replace: description
79 description: The replaced multiLineDescription $ Blah Woof.
80 -
81 replace: drink
82 drink: Iced Tea
83 drink: Mad Dog 20/20
84
85 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
86 delete: member
87 member: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
88 member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
89 -
90 add: member
91 member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,o=University of Michigan,c=US
92 member: cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michigan,c=US
93
94 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
95 changetype: modify
96 delete: member
97 -
98 add: member
99 member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,o=University of Michigan,c=US
100
101 dn: cn=Gern Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
102 changetype: add
103 objectclass: top
104 objectclass: person
105 objectclass: OpenLDAPperson
106 cn: Gern Jensen
107 sn: Jensen
108 uid: gjensen
109 title: Chief Investigator, ITD
110 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
111 seealso: cn=All Staff,ou=Groups,o=University of Michigan,c=US
112 drink: Coffee
113 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
114 description: Very odd
115 facsimiletelephonenumber: +1 313 555 7557
116 telephonenumber: +1 313 555 8343
117 mail: gjensen@mailgw.umich.edu
118 homephone: +1 313 555 8844
119
120 dn: cn=James A Jones 2,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
121 changetype: delete
122 # TRAILING COMMENT AND WHITE SPACE
123
124 EOMODS
125
126 RC=$?
127 if test $RC != 0 ; then
128         echo "ldapmodify failed ($RC)!"
129         kill -HUP $PID
130         exit $RC
131 fi
132
133 echo "Using ldapsearch to retrieve all the entries..."
134 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
135             'objectClass=*' > $SEARCHOUT 2>&1
136 RC=$?
137 kill -HUP $PID
138 if test $RC != 0 ; then
139         echo "ldapsearch failed ($RC)!"
140         exit $RC
141 fi
142
143 LDIF=$MODIFYOUTMASTER
144
145 echo "Filtering ldapsearch results..."
146 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
147 echo "Filtering original ldif used to create database..."
148 . $LDIFFILTER < $LDIF > $LDIFFLT
149 echo "Comparing filter output..."
150 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
151
152 if test $? != 0 ; then
153         echo "comparison failed - modify operations did not complete correctly"
154         exit 1
155 fi
156
157 echo ">>>>> Test succeeded"
158
159 exit 0