]> git.sur5r.net Git - openldap/blob - tests/scripts/test013-language
Check ldapmodify for success.
[openldap] / tests / scripts / test013-language
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1
8
9 echo "Starting slapd on TCP/IP port $PORT1..."
10 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
11 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
12 PID=$!
13 if test $WAIT != 0 ; then
14     echo PID $PID
15     read foo
16 fi
17 KILLPIDS="$PID"
18
19 echo "Using ldapsearch to check that slapd is running..."
20 for i in 0 1 2 3 4 5; do
21         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
22                 'objectclass=*' > /dev/null 2>&1
23         RC=$?
24         if test $RC = 0 ; then
25                 break
26         fi
27         echo "Waiting 5 seconds for slapd to start..."
28         sleep 5
29 done
30
31 echo "Using ldapadd to populate the database..."
32 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
33         $LDIFLANG > $TESTOUT 2>&1
34 RC=$?
35 if test $RC != 0 ; then
36         echo "ldapadd failed ($RC)!"
37         test $KILLSERVERS != no && kill -HUP $KILLPIDS
38         exit $RC
39 fi
40
41 echo "Using ldapsearch to read all the entries..."
42 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s base \
43         '(&)' > $SEARCHOUT 2>&1
44 RC=$?
45
46 if test $RC != 0 ; then
47         echo "ldapsearch failed ($RC)!"
48         test $KILLSERVERS != no && kill -HUP $KILLPIDS
49         exit $RC
50 fi
51
52 echo "Using ldapsearch to read name ..."
53 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s base \
54         '(&)' 'name' >> $SEARCHOUT 2>&1
55 RC=$?
56
57 if test $RC != 0 ; then
58         echo "ldapsearch failed ($RC)!"
59         test $KILLSERVERS != no && kill -HUP $KILLPIDS
60         exit $RC
61 fi
62
63 echo "Using ldapsearch to read name language tag ..."
64 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s base \
65         '(&)' 'name;lang-en-US' >> $SEARCHOUT 2>&1
66 RC=$?
67
68 if test $RC != 0 ; then
69         echo "ldapsearch failed ($RC)!"
70         test $KILLSERVERS != no && kill -HUP $KILLPIDS
71         exit $RC
72 fi
73
74 echo "Using ldapsearch to read name language range ..."
75 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s base \
76         '(&)' 'name;lang-en-' >> $SEARCHOUT 2>&1
77 RC=$?
78
79 if test $RC != 0 ; then
80         echo "ldapsearch failed ($RC)!"
81         test $KILLSERVERS != no && kill -HUP $KILLPIDS
82         exit $RC
83 fi
84
85 test $KILLSERVERS != no && kill -HUP $KILLPIDS
86
87 echo "Filtering ldapsearch results..."
88 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
89 echo "Filtering language ldif ..."
90 . $LDIFFILTER < $LDIFLANGOUT > $LDIFFLT
91 echo "Comparing filter output..."
92 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
93
94 if test $? != 0 ; then
95         echo "comparison failed - language test failed!"
96         exit 1
97 fi
98
99 echo ">>>>> Test succeeded"
100 exit 0