diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-08-22 01:32:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:22 -0500 |
commit | 35817c01a87f4bda0f492144a56d39a99bc07eb1 (patch) | |
tree | 6495a245745b48a3b9fffb13934a0681aacfae1d /source4/lib/ldb | |
parent | 862ba2617205832d4d5f0db07c54c4cc436a0f3d (diff) | |
download | samba-35817c01a87f4bda0f492144a56d39a99bc07eb1.tar.gz samba-35817c01a87f4bda0f492144a56d39a99bc07eb1.tar.bz2 samba-35817c01a87f4bda0f492144a56d39a99bc07eb1.zip |
r17679: - fix 'make test-ldap' to skip ldb specials
- allow ldb to be built in a separate build directory, using:
/some/path/to/ldb/configure
make
this will make it much easier to put ldb in the build farm without
interfering with the build farm builds of tdb and talloc
(This used to be commit 580ed6730d33bad62e9799a38377c40f2852ae89)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/Makefile.in | 76 | ||||
-rw-r--r-- | source4/lib/ldb/configure.in | 1 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/init_slapd.sh | 7 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/start_slapd.sh | 9 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/test-generic.sh | 10 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/test-ldap.sh | 13 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/test-tdb.sh | 2 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 7 |
8 files changed, 77 insertions, 48 deletions
diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index 817eba91d7..d3766962d3 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -8,6 +8,9 @@ includedir = @includedir@ libdir = @libdir@ bindir = @bindir@ mandir = @mandir@ +VPATH = @srcdir@:@srcdir@/.. +srcdir = @srcdir@ +builddir = @builddir@ WITH_GCOV = @WITH_GCOV@ WITH_LDAP = @WITH_LDAP@ WITH_SQLITE3 = @WITH_SQLITE3@ @@ -16,22 +19,19 @@ ifeq ($(WITH_LDAP),yes) OPENLDAP_PREFIX=/usr LDAP_LIBS=-L$(OPENLDAP_PREFIX)/lib -llber -lldap LDAP_FLAGS=-DHAVE_LDAP=1 -LDB_LDAP_OBJ=ldb_ldap/ldb_ldap.o +LDB_LDAP_OBJ=$(srcdir)/ldb_ldap/ldb_ldap.o endif ifeq ($(WITH_SQLITE3),yes) SQLITE3_PREFIX=/usr SQLITE3_LIBS=-L$(SQLITE3_PREFIX)/lib -lsqlite3 SQLITE3_FLAGS=-DHAVE_SQLITE3=1 -LDB_SQLITE3_OBJ=ldb_sqlite3/ldb_sqlite3.o +LDB_SQLITE3_OBJ=$(srcdir)/ldb_sqlite3/ldb_sqlite3.o endif -TDBDIR=../tdb -TALLOCDIR=../talloc - CFLAGS1=-Wall -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \ - -Wcast-qual -Wcast-align -Wwrite-strings -g -Iinclude -I. -I.. \ - -I$(TDBDIR)/include -I$(TALLOCDIR) -DUSE_MMAP=1 $(LDAP_FLAGS) + -Wcast-qual -Wcast-align -Wwrite-strings -g -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/.. \ + -I$(srcdir)/../tdb/include -I$(srcdir)/../tdb -I$(srcdir)/../talloc -DUSE_MMAP=1 $(LDAP_FLAGS) # enable the following two lines to build with gcov code coverage support ifeq ($(WITH_GCOV),1) @@ -43,26 +43,32 @@ CFLAGS = $(CFLAGS1) $(GCOV_FLAGS) @CFLAGS@ LIB_FLAGS=-Llib -lldb $(LDAP_LIBS) $(SQLITE3_LIBS) $(GCOV_LIBS) @LIBS@ +TDBDIR=tdb TDB_OBJ=$(TDBDIR)/common/tdb.o $(TDBDIR)/common/dump.o \ $(TDBDIR)/common/io.o $(TDBDIR)/common/lock.o \ $(TDBDIR)/common/open.o $(TDBDIR)/common/traverse.o \ $(TDBDIR)/common/freelist.o $(TDBDIR)/common/error.o \ $(TDBDIR)/common/transaction.o + +TALLOCDIR=talloc TALLOC_OBJ=$(TALLOCDIR)/talloc.o -LDB_TDB_OBJ=ldb_tdb/ldb_tdb.o \ - ldb_tdb/ldb_pack.o ldb_tdb/ldb_search.o ldb_tdb/ldb_index.o \ - ldb_tdb/ldb_cache.o ldb_tdb/ldb_tdb_wrap.o +LDB_TDB_DIR=ldb_tdb +LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \ + $(LDB_TDB_DIR)/ldb_pack.o $(LDB_TDB_DIR)/ldb_search.o $(LDB_TDB_DIR)/ldb_index.o \ + $(LDB_TDB_DIR)/ldb_cache.o $(LDB_TDB_DIR)/ldb_tdb_wrap.o -COMMON_OBJ=common/ldb.o common/ldb_ldif.o \ - common/ldb_parse.o common/ldb_msg.o common/ldb_utf8.o \ - common/ldb_debug.o common/ldb_modules.o \ - common/ldb_dn.o common/ldb_match.o common/ldb_attributes.o \ - common/attrib_handlers.o common/ldb_controls.o common/qsort.o +COMDIR=common +COMMON_OBJ=$(COMDIR)/ldb.o $(COMDIR)/ldb_ldif.o \ + $(COMDIR)/ldb_parse.o $(COMDIR)/ldb_msg.o $(COMDIR)/ldb_utf8.o \ + $(COMDIR)/ldb_debug.o $(COMDIR)/ldb_modules.o \ + $(COMDIR)/ldb_dn.o $(COMDIR)/ldb_match.o $(COMDIR)/ldb_attributes.o \ + $(COMDIR)/attrib_handlers.o $(COMDIR)/ldb_controls.o $(COMDIR)/qsort.o -MODULES_OBJ=modules/operational.o modules/schema.o modules/rdn_name.o \ - modules/objectclass.o \ - modules/paged_results.o modules/sort.o modules/asq.o +MODDIR=modules +MODULES_OBJ=$(MODDIR)/operational.o $(MODDIR)/schema.o $(MODDIR)/rdn_name.o \ + $(MODDIR)/objectclass.o \ + $(MODDIR)/paged_results.o $(MODDIR)/sort.o $(MODDIR)/asq.o OBJS = $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LDAP_OBJ) $(LDB_SQLITE3_OBJ) @@ -72,23 +78,21 @@ BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrena LIBS = $(LDB_LIB)($(OBJS)) -DIRS = lib bin - MANPAGES = $(patsubst %.xml,%,$(wildcard man/*.xml)) EXAMPLES = examples/ldbreader examples/ldifreader -all: $(DIRS) $(BINS) $(LIBS) $(EXAMPLES) $(MANPAGES) doxygen +DIRS = lib bin common ldb_tdb ldb_ldap ldb_sqlite3 modules tools examples tdb talloc + +all: dirs $(BINS) $(LIBS) $(EXAMPLES) $(MANPAGES) doxygen .c.o: @echo Compiling $*.c + @mkdir -p `dirname $@` @$(CC) $(CFLAGS) -c $< -o $@ -lib: - mkdir -p lib - -bin: - mkdir -p bin +dirs: $(DIRS) + mkdir -p $(DIRS) lib/libldb.a: $(OBJS) @@ -157,12 +161,12 @@ etags: test-tdb: $(BINS) @echo "STARTING TDB BACKEND TEST" - tests/test-tdb.sh + $(srcdir)/tests/test-tdb.sh ifeq ($(WITH_LDAP),yes) test-ldap: @echo "STARTING LDAP BACKEND TEST" - tests/test-ldap.sh + $(srcdir)/tests/test-ldap.sh else test-ldap: @echo "SKIP LDAP TEST - NO LDAP SUPPORT" @@ -171,7 +175,7 @@ endif ifeq ($(WITH_SQLITE3),yes) test-sqlite3: @echo "STARTING SQLITE3 BACKEND TEST" - tests/test-sqlite3.sh + $(srcdir)/tests/test-sqlite3.sh else test-sqlite3: @echo "SKIP SQLITE3 TEST - NO SQLITE3 SUPPORT" @@ -180,7 +184,7 @@ endif ifeq (1,0) test-schema: @echo "STARTING SCHEMA MODULE TEST" - tests/test-schema.sh + $(srcdir)/tests/test-schema.sh else test-schema: @echo "SKIPPING SCHEMA MODULE TEST" @@ -198,12 +202,12 @@ install: all cp $(filter %.3, $(MANPAGES)) $(mandir)/man3 gcov: - $(GCOV) -po ldb_sqlite3 ldb_sqlite3/*.c 2| tee ldb_sqlite3.report.gcov - $(GCOV) -po ldb_ldap ldb_ldap/*.c 2| tee ldb_ldap.report.gcov - $(GCOV) -po ldb_tdb ldb_tdb/*.c 2| tee ldb_tdb.report.gcov - $(GCOV) -po common common/*.c 2| tee common.report.gcov - $(GCOV) -po modules modules/*.c 2| tee modules.report.gcov - $(GCOV) -po tools tools/*.c 2| tee tools.report.gcov + $(GCOV) -po ldb_sqlite3 $(srcdir)/ldb_sqlite3/*.c 2| tee ldb_sqlite3.report.gcov + $(GCOV) -po ldb_ldap $(srcdir)/ldb_ldap/*.c 2| tee ldb_ldap.report.gcov + $(GCOV) -po ldb_tdb $(srcdir)/ldb_tdb/*.c 2| tee ldb_tdb.report.gcov + $(GCOV) -po common $(srcdir)/common/*.c 2| tee common.report.gcov + $(GCOV) -po modules $(srcdir)/modules/*.c 2| tee modules.report.gcov + $(GCOV) -po tools $(srcdir)/tools/*.c 2| tee tools.report.gcov ctags: ctags `find $(srcdir) -name "*.[ch]"` diff --git a/source4/lib/ldb/configure.in b/source4/lib/ldb/configure.in index 2400e4649a..e10248d265 100644 --- a/source4/lib/ldb/configure.in +++ b/source4/lib/ldb/configure.in @@ -12,6 +12,7 @@ AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) AC_DEFUN([SMB_EXT_LIB], [echo -n ""]) AC_DEFUN([SMB_ENABLE], [echo -n ""]) AC_INIT(include/ldb.h) +AC_CONFIG_SRCDIR([common/ldb.c]) WITH_GCOV=0 AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[enable GCOV code coverage tests]), diff --git a/source4/lib/ldb/tests/init_slapd.sh b/source4/lib/ldb/tests/init_slapd.sh index fc1ed16a4c..c50ea0ecab 100755 --- a/source4/lib/ldb/tests/init_slapd.sh +++ b/source4/lib/ldb/tests/init_slapd.sh @@ -1,5 +1,10 @@ #!/bin/sh +if [ -z "$LDBDIR" ]; then + LDBDIR=`dirname $0`/.. + export LDBDIR +fi + rm -rf tests/tmp/db mkdir -p tests/tmp/db @@ -10,4 +15,4 @@ sleep 2 if pidof slapd > /dev/null; then killall -9 slapd fi -slapadd -f tests/slapd.conf < tests/init.ldif || exit 1 +slapadd -f $LDBDIR/tests/slapd.conf < $LDBDIR/tests/init.ldif || exit 1 diff --git a/source4/lib/ldb/tests/start_slapd.sh b/source4/lib/ldb/tests/start_slapd.sh index 6dd3eaa9b8..49ce5538f1 100755 --- a/source4/lib/ldb/tests/start_slapd.sh +++ b/source4/lib/ldb/tests/start_slapd.sh @@ -1,7 +1,12 @@ #!/bin/sh -mkdir -p tests/tmp/db +if [ -z "$LDBDIR" ]; then + LDBDIR=`dirname $0`/.. + export LDBDIR +fi -slapd -f tests/slapd.conf -h "`tests/ldapi_url.sh`" $* +mkdir -p $LDBDIR/tests/tmp/db + +slapd -f $LDBDIR/tests/slapd.conf -h "`$LDBDIR/tests/ldapi_url.sh`" $* sleep 2 diff --git a/source4/lib/ldb/tests/test-generic.sh b/source4/lib/ldb/tests/test-generic.sh index 3246b7138f..363bf89065 100755 --- a/source4/lib/ldb/tests/test-generic.sh +++ b/source4/lib/ldb/tests/test-generic.sh @@ -1,5 +1,9 @@ #!/bin/sh +if [ -z "$LDB_SPECIALS" ]; then + export LDB_SPECIALS=1 +fi + echo "LDB_URL: $LDB_URL" echo "Adding base elements" @@ -22,8 +26,10 @@ $VALGRIND ldbsearch '(uid=uham)' || exit 1 echo "Starting ldbtest" time $VALGRIND ldbtest --num-records 100 --num-searches 10 || exit 1 -echo "Adding index" -$VALGRIND ldbadd $LDBDIR/tests/test-index.ldif || exit 1 +if [ $LDB_SPECIALS = 1 ]; then + echo "Adding index" + $VALGRIND ldbadd $LDBDIR/tests/test-index.ldif || exit 1 +fi echo "Adding attributes" $VALGRIND ldbadd $LDBDIR/tests/test-wrong_attributes.ldif || exit 1 diff --git a/source4/lib/ldb/tests/test-ldap.sh b/source4/lib/ldb/tests/test-ldap.sh index d9fa73b641..592e09f408 100755 --- a/source4/lib/ldb/tests/test-ldap.sh +++ b/source4/lib/ldb/tests/test-ldap.sh @@ -24,17 +24,18 @@ for f in $SCHEMA_NEEDED; do fi done -export LDB_URL=`tests/ldapi_url.sh` - -PATH=bin:$PATH -export PATH - if [ -z "$LDBDIR" ]; then - LDBDIR="." + LDBDIR=`dirname $0`/.. export LDBDIR fi +export LDB_URL=`$LDBDIR/tests/ldapi_url.sh` + +PATH=bin:$PATH +export PATH + . $LDBDIR/tests/init_slapd.sh . $LDBDIR/tests/start_slapd.sh +export LDB_SPECIALS=0 . $LDBDIR/tests/test-generic.sh diff --git a/source4/lib/ldb/tests/test-tdb.sh b/source4/lib/ldb/tests/test-tdb.sh index c0f9d7b2de..e1052d1651 100755 --- a/source4/lib/ldb/tests/test-tdb.sh +++ b/source4/lib/ldb/tests/test-tdb.sh @@ -13,7 +13,7 @@ export PATH rm -f $LDB_URL* if [ -z "$LDBDIR" ]; then - LDBDIR="." + LDBDIR=`dirname $0`/.. export LDBDIR fi diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index c912245682..62d8b84061 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -291,6 +291,13 @@ static void start_test_index(struct ldb_context **ldb) struct ldb_dn *basedn; int ret; int flags = 0; + const char *specials; + + specials = getenv("LDB_SPECIALS"); + if (specials && atoi(specials) == 0) { + printf("LDB_SPECIALS disabled - skipping index test\n"); + return; + } if (options->nosync) { flags |= LDB_FLG_NOSYNC; |