summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-30 03:32:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:58 -0500
commitbed487f6a3ad93f27d8dcb31cbad6b57f5032034 (patch)
treee4bc8f0b892047fd95ae381eeea3a8fbdb4e0f67 /source4
parent939cb07232fc522ff53b32a6f201a8ff951aa4ae (diff)
downloadsamba-bed487f6a3ad93f27d8dcb31cbad6b57f5032034.tar.gz
samba-bed487f6a3ad93f27d8dcb31cbad6b57f5032034.tar.bz2
samba-bed487f6a3ad93f27d8dcb31cbad6b57f5032034.zip
r8009: expanded the ldb test suite. It worried me that some changes I have
pending, which I know break lots of features, still passed our test suite! Now they don't. (This used to be commit 5801167c8dfc8a61bfeac396bca8ffd3d5270296)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/tests/test-tdb-features.sh78
-rwxr-xr-xsource4/lib/ldb/tests/test-tdb.sh4
2 files changed, 81 insertions, 1 deletions
diff --git a/source4/lib/ldb/tests/test-tdb-features.sh b/source4/lib/ldb/tests/test-tdb-features.sh
new file mode 100644
index 0000000000..7ed55430f7
--- /dev/null
+++ b/source4/lib/ldb/tests/test-tdb-features.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+echo "Running tdb feature tests"
+
+rm -f $LDB_URL
+
+checkcount() {
+ count=$1
+ expression="$2"
+ n=`bin/ldbsearch "$expression" | grep ^dn | wc -l`
+ if [ $n != $count ]; then
+ echo "Got $n but expected $count for $expression"
+ bin/ldbsearch "$expression"
+ exit 1
+ fi
+ echo "OK: $count $expression"
+}
+
+echo "Testing case sensitve search"
+cat <<EOF | bin/ldbadd || exit 1
+dn: cn=t1,cn=TEST
+test: foo
+EOF
+
+
+echo $ldif | bin/ldbadd || exit 1
+bin/ldbsearch
+
+checkcount 1 '(test=foo)'
+checkcount 0 '(test=FOO)'
+checkcount 0 '(test=fo*)'
+
+echo "Making case insensitive"
+cat <<EOF | bin/ldbmodify || exit 1
+dn: @ATTRIBUTES
+changetype: add
+add: test
+test: CASE_INSENSITIVE
+EOF
+
+echo $ldif | bin/ldbmodify || exit 1
+checkcount 1 '(test=foo)'
+checkcount 1 '(test=FOO)'
+checkcount 0 '(test=fo*)'
+
+echo "adding wildcard"
+cat <<EOF | bin/ldbmodify || exit 1
+dn: @ATTRIBUTES
+changetype: modify
+add: test
+test: WILDCARD
+EOF
+checkcount 1 '(test=foo)'
+checkcount 1 '(test=FOO)'
+checkcount 1 '(test=fo*)'
+
+echo "adding i"
+cat <<EOF | bin/ldbmodify || exit 1
+dn: cn=t1,cn=TEST
+changetype: modify
+add: i
+i: 0x100
+EOF
+checkcount 1 '(i=0x100)'
+checkcount 0 '(i=256)'
+
+echo "marking i as INTEGER"
+cat <<EOF | bin/ldbmodify || exit 1
+dn: @ATTRIBUTES
+changetype: modify
+add: i
+i: INTEGER
+EOF
+checkcount 1 '(i=0x100)'
+checkcount 1 '(i=256)'
+
+
+rm -f $LDB_URL
diff --git a/source4/lib/ldb/tests/test-tdb.sh b/source4/lib/ldb/tests/test-tdb.sh
index 9c2f9cd7ba..470975e8b8 100755
--- a/source4/lib/ldb/tests/test-tdb.sh
+++ b/source4/lib/ldb/tests/test-tdb.sh
@@ -1,10 +1,12 @@
#!/bin/sh
-export LDB_URL="tdb://tdbtest.ldb"
+export LDB_URL="tdbtest.ldb"
rm -f tdbtest.ldb
. tests/test-generic.sh
. tests/test-extended.sh
+
+. tests/test-tdb-features.sh