source: branches/samba-3.2.x/source/lib/ldb/tests/test-generic.sh@ 247

Last change on this file since 247 was 133, checked in by Paul Smedley, 18 years ago

Update trunk to 3.2.0pre3

File size: 4.4 KB
Line 
1#!/bin/sh
2
3if [ -z "$LDB_SPECIALS" ]; then
4 LDB_SPECIALS=1
5 export LDB_SPECIALS
6fi
7
8echo "LDB_URL: $LDB_URL"
9
10echo "Adding base elements"
11$VALGRIND ldbadd $LDBDIR/tests/test.ldif || exit 1
12
13echo "Adding again - should fail"
14ldbadd $LDBDIR/tests/test.ldif 2> /dev/null && {
15 echo "Should have failed to add again - gave $?"
16 exit 1
17}
18
19echo "Modifying elements"
20$VALGRIND ldbmodify $LDBDIR/tests/test-modify.ldif || exit 1
21
22echo "Showing modified record"
23$VALGRIND ldbsearch '(uid=uham)' || exit 1
24
25echo "Rename entry"
26OLDDN="cn=Ursula Hampster,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST"
27NEWDN="cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST"
28$VALGRIND ldbrename "$OLDDN" "$NEWDN" || exit 1
29
30echo "Showing renamed record"
31$VALGRIND ldbsearch '(uid=uham)' || exit 1
32
33echo "Starting ldbtest"
34$VALGRIND ldbtest --num-records 100 --num-searches 10 || exit 1
35
36if [ $LDB_SPECIALS = 1 ]; then
37 echo "Adding index"
38 $VALGRIND ldbadd $LDBDIR/tests/test-index.ldif || exit 1
39fi
40
41echo "Adding bad attributes - should fail"
42$VALGRIND ldbadd $LDBDIR/tests/test-wrong_attributes.ldif && {
43 echo "Should fhave failed - gave $?"
44 exit 1
45}
46
47echo "testing indexed search"
48$VALGRIND ldbsearch '(uid=uham)' || exit 1
49$VALGRIND ldbsearch '(&(objectclass=person)(objectclass=person)(objectclass=top))' || exit 1
50$VALGRIND ldbsearch '(&(uid=uham)(uid=uham))' || exit 1
51$VALGRIND ldbsearch '(|(uid=uham)(uid=uham))' || exit 1
52$VALGRIND ldbsearch '(|(uid=uham)(uid=uham)(objectclass=OpenLDAPperson))' || exit 1
53$VALGRIND ldbsearch '(&(uid=uham)(uid=uham)(!(objectclass=xxx)))' || exit 1
54$VALGRIND ldbsearch '(&(objectclass=person)(uid=uham)(!(uid=uhamxx)))' uid \* \+ dn || exit 1
55$VALGRIND ldbsearch '(&(uid=uham)(uid=uha*)(title=*))' uid || exit 1
56
57# note that the "((" is treated as an attribute not an expression
58# this matches the openldap ldapsearch behaviour of looking for a '='
59# to see if the first argument is an expression or not
60$VALGRIND ldbsearch '((' uid || exit 1
61$VALGRIND ldbsearch '(objectclass=)' uid || exit 1
62$VALGRIND ldbsearch -b 'cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST' -s base "" sn || exit 1
63
64echo "Test wildcard match"
65$VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif || exit 1
66$VALGRIND ldbsearch '(cn=test*multi)' || exit 1
67$VALGRIND ldbsearch '(cn=*test*multi*)' || exit 1
68$VALGRIND ldbsearch '(cn=*test_multi)' || exit 1
69$VALGRIND ldbsearch '(cn=test_multi*)' || exit 1
70$VALGRIND ldbsearch '(cn=test*multi*test*multi)' || exit 1
71$VALGRIND ldbsearch '(cn=test*multi*test*multi*multi_*)' || exit 1
72
73echo "Starting ldbtest indexed"
74$VALGRIND ldbtest --num-records 100 --num-searches 500 || exit 1
75