source: branches/samba-3.5.x/source3/lib/ldb/tests/test-tdb-features.sh

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 2.3 KB
Line 
1#!/bin/sh
2
3echo "Running tdb feature tests"
4
5mv $LDB_URL $LDB_URL.2
6
7checkcount() {
8 count=$1
9 expression="$2"
10 n=`bin/ldbsearch "$expression" | grep '^dn' | wc -l`
11 if [ $n != $count ]; then
12 echo "Got $n but expected $count for $expression"
13 $VALGRIND bin/ldbsearch "$expression"
14 exit 1
15 fi
16 echo "OK: $count $expression"
17}
18
19echo "Testing case sensitive search"
20cat <<EOF | $VALGRIND bin/ldbadd || exit 1
21dn: cn=t1,cn=TEST
22objectClass: testclass
23test: foo
24EOF
25checkcount 1 '(test=foo)'
26checkcount 0 '(test=FOO)'
27checkcount 0 '(test=FO*)'
28
29echo "Making case insensitive"
30cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
31dn: @ATTRIBUTES
32changetype: add
33add: test
34test: CASE_INSENSITIVE
35EOF
36
37echo $ldif | $VALGRIND bin/ldbmodify || exit 1
38checkcount 1 '(test=foo)'
39checkcount 1 '(test=FOO)'
40checkcount 1 '(test=fo*)'
41
42echo "adding i"
43cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
44dn: cn=t1,cn=TEST
45changetype: modify
46add: i
47i: 0x100
48EOF
49checkcount 1 '(i=0x100)'
50checkcount 0 '(i=256)'
51
52echo "marking i as INTEGER"
53cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
54dn: @ATTRIBUTES
55changetype: modify
56add: i
57i: INTEGER
58EOF
59checkcount 1 '(i=0x100)'
60checkcount 1 '(i=256)'
61
62echo "adding j"
63cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
64dn: cn=t1,cn=TEST
65changetype: modify
66add: j
67j: 0x100
68EOF
69checkcount 1 '(j=0x100)'
70checkcount 0 '(j=256)'
71
72echo "Adding wildcard attribute"
73cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
74dn: @ATTRIBUTES
75changetype: modify
76add: *
77*: INTEGER
78EOF
79checkcount 1 '(j=0x100)'
80checkcount 1 '(j=256)'
81
82echo "Testing class search"
83checkcount 0 '(objectClass=otherclass)'
84checkcount 1 '(objectClass=testclass)'
85
86echo "Adding subclass"
87cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
88dn: @SUBCLASSES
89changetype: add
90add: otherclass
91otherclass: testclass
92EOF
93checkcount 1 '(objectClass=otherclass)'
94checkcount 1 '(objectClass=testclass)'
95
96echo "Adding index"
97cat <<EOF | $VALGRIND bin/ldbadd || exit 1
98dn: @INDEXLIST
99@IDXATTR: i
100@IDXATTR: test
101EOF
102checkcount 1 '(i=0x100)'
103checkcount 1 '(i=256)'
104checkcount 0 '(i=-256)'
105checkcount 1 '(test=foo)'
106checkcount 1 '(test=FOO)'
107checkcount 1 '(test=*f*o)'
108
109echo "making test case sensitive"
110cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
111dn: @ATTRIBUTES
112changetype: modify
113replace: test
114test: NONE
115EOF
116checkcount 1 '(test=foo)'
117checkcount 0 '(test=FOO)'
118checkcount 1 '(test=f*o*)'
119
Note: See TracBrowser for help on using the repository browser.