]> git.sur5r.net Git - openldap/blob - tests/scripts/test013-language
fix ITS#2289 (don't use shared data for search state; use msgid instead)
[openldap] / tests / scripts / test013-language
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 MONITORDB=no
13 if test $# -ge 1 ; then
14         MONITORDB=$1; shift
15 fi
16 WAIT=0
17 if test $# -ge 1 ; then
18         WAIT=1; shift
19 fi
20
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
23
24 echo "Cleaning up in $DBDIR..."
25
26 rm -f $DBDIR/[!C]*
27
28 echo "Starting slapd on TCP/IP port $PORT..."
29 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
30 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
31 PID=$!
32 if test $WAIT != 0 ; then
33     echo PID $PID
34     read foo
35 fi
36
37 echo "Using ldapsearch to check that slapd is running..."
38 for i in 0 1 2 3 4 5; do
39         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
40                 'objectclass=*' > /dev/null 2>&1
41         RC=$?
42         if test $RC = 0 ; then
43                 break
44         fi
45         echo "Waiting 5 seconds for slapd to start..."
46         sleep 5
47 done
48
49 echo "Using ldapadd to populate the database..."
50 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
51         $LDIFLANG > $TESTOUT 2>&1
52 RC=$?
53 if test $RC != 0 ; then
54         echo "ldapadd failed ($RC)!"
55         kill -HUP $PID
56         exit $RC
57 fi
58
59 echo "Using ldapsearch to read all the entries..."
60 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \
61         '(&)' > $SEARCHOUT 2>&1
62 RC=$?
63
64 if test $RC != 0 ; then
65         echo "ldapsearch failed ($RC)!"
66         kill -HUP $PID
67         exit $RC
68 fi
69
70 echo "Using ldapsearch to read name ..."
71 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \
72         '(&)' 'name' >> $SEARCHOUT 2>&1
73 RC=$?
74
75 if test $RC != 0 ; then
76         echo "ldapsearch failed ($RC)!"
77         kill -HUP $PID
78         exit $RC
79 fi
80
81 echo "Using ldapsearch to read name language tag ..."
82 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \
83         '(&)' 'name;lang-en-US' >> $SEARCHOUT 2>&1
84 RC=$?
85
86 if test $RC != 0 ; then
87         echo "ldapsearch failed ($RC)!"
88         kill -HUP $PID
89         exit $RC
90 fi
91
92 echo "Using ldapsearch to read name language range ..."
93 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \
94         '(&)' 'name;lang-en-' >> $SEARCHOUT 2>&1
95 RC=$?
96
97 if test $RC != 0 ; then
98         echo "ldapsearch failed ($RC)!"
99         kill -HUP $PID
100         exit $RC
101 fi
102
103 kill -HUP $PID
104
105 echo "Filtering ldapsearch results..."
106 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
107 echo "Filtering language ldif ..."
108 . $LDIFFILTER < $LDIFLANGOUT > $LDIFFLT
109 echo "Comparing filter output..."
110 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
111
112 if test $? != 0 ; then
113         echo "comparison failed - language test failed!"
114         exit 1
115 fi
116
117 echo ">>>>> Test succeeded"
118
119
120 exit 0