From 191ff344e92eb62c26307504f5cee59cc6313991 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 2 Aug 2012 07:29:55 -0700 Subject: [PATCH] ITS#7344 cleanup, integration --- tests/run.in | 3 +- tests/scripts/defines.sh | 1 + tests/scripts/test064-constraint | 67 ++++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/tests/run.in b/tests/run.in index 559e1be328..5e6178bbbd 100644 --- a/tests/run.in +++ b/tests/run.in @@ -39,6 +39,7 @@ AC_sql=sql@BUILD_SQL@ # overlays AC_accesslog=accesslog@BUILD_ACCESSLOG@ +AC_constraint=constraint@BUILD_CONSTRAINT@ AC_dds=dds@BUILD_DDS@ AC_dynlist=dynlist@BUILD_DYNLIST@ AC_memberof=memberof@BUILD_MEMBEROF@ @@ -69,7 +70,7 @@ if test "${AC_meta}" = "metamod" && test "${AC_LIBS_DYNAMIC}" = "static" ; then fi export AC_bdb AC_hdb AC_ldap AC_mdb AC_meta AC_monitor AC_null AC_relay AC_sql \ - AC_accesslog AC_dds AC_dynlist AC_memberof AC_pcache AC_ppolicy \ + AC_accesslog AC_constraint AC_dds AC_dynlist AC_memberof AC_pcache AC_ppolicy \ AC_refint AC_retcode AC_rwm AC_unique AC_syncprov AC_translucent \ AC_valsort \ AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \ diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 68254c498e..f3d3edd4e8 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -28,6 +28,7 @@ BACKSQL=${AC_sql-sqlno} # overlays ACCESSLOG=${AC_accesslog-accesslogno} +CONSTRAINT=${AC_constraint-constraintno} DDS=${AC_dds-ddsno} DYNLIST=${AC_dynlist-dynlistno} MEMBEROF=${AC_memberof-memberofno} diff --git a/tests/scripts/test064-constraint b/tests/scripts/test064-constraint index 4a69b3fc7b..4332346fe9 100755 --- a/tests/scripts/test064-constraint +++ b/tests/scripts/test064-constraint @@ -3,6 +3,11 @@ echo "running defines.sh" . $SRCDIR/scripts/defines.sh +if test $CONSTRAINT = constraintno; then + echo "Constraint overlay not available, test skipped" + exit 0 +fi + CONSTRAINTDIR="$DATADIR/constraint" ROOTLDIF="$CONSTRAINTDIR/root.ldif" USERLDIF="$CONSTRAINTDIR/user.ldif" @@ -22,12 +27,6 @@ cn: config olcArgsFile: $TESTDIR/slapd.args olcPidFile: $TESTDIR/slapd.pid -dn: cn=module,cn=config -objectClass: olcModuleList -cn: module -olcModulePath: $TESTWD/../servers/slapd/overlays -olcModuleLoad: constraint.la - dn: cn=schema,cn=config objectClass: olcSchemaConfig cn: schema @@ -39,6 +38,7 @@ include: file://$TESTWD/schema/inetorgperson.ldif dn: olcDatabase=config,cn=config objectClass: olcDatabaseConfig olcDatabase: config +olcRootPW:< file://$CONFIGPWF dn: olcDatabase={1}$BACKEND,cn=config objectClass: olcDatabaseConfig @@ -46,11 +46,40 @@ objectClass: olc${BACKEND}Config olcDatabase: $BACKEND olcSuffix: $BASEDN olcRootDN: $MANAGERDN -olcRootPW:< file://$CONFIGPWF +olcRootPW: $PASSWD olcDbDirectory: $TESTDIR/db.1.a olcDbIndex: objectClass eq,pres olcDbIndex: ou,cn,mail,surname,givenname eq,pres,sub +EOF + +echo "Starting slapd on TCP/IP port $PORT1..." +$SLAPD -F $CONFDIR -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 & +PID=$! +if test $WAIT != 0 ; then + echo PID $PID + read foo +fi + +sleep 1 + +echo "Inserting constraint overlay... " +if [ "$CONSTRAINT" = constraintmod ]; then + $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF < $TESTOUT 2>&1 +dn: cn=module,cn=config +objectClass: olcModuleList +cn: module +olcModulePath: $TESTWD/../servers/slapd/overlays +olcModuleLoad: constraint.la +EOF + RC=$? + if test $RC != 0 ; then + echo "ldapadd failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $PID + exit $RC + fi +fi +$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <> $TESTOUT 2>&1 dn: olcOverlay=constraint,olcDatabase={1}$BACKEND,cn=config objectClass: olcOverlayConfig objectClass: olcConstraintConfig @@ -58,27 +87,23 @@ olcOverlay: constraint olcConstraintAttribute: mail count 3 olcConstraintAttribute: mail regex ^[[:alnum:]]+@example.com$ olcConstraintAttribute: description count 2 - EOF - -$SLAPD -F $CONFDIR -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 & -PID=$! -if test $WAIT != 0 ; then - echo PID $PID - read foo +RC=$? +if test $RC != 0 ; then + echo "ldapadd failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $PID + exit $RC fi -sleep 1 - echo "Adding basic structure..." -$LDAPADD -D $MANAGERDN -H $URI1 -y $CONFIGPWF -f $ROOTLDIF &>/dev/null +$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $ROOTLDIF &>/dev/null RC=$? if test $RC != 0 ; then echo "ldapadd failed ($RC)!" test $KILLSERVERS != no && kill -HUP $PID exit $RC fi -$LDAPADD -D $MANAGERDN -H $URI1 -y $CONFIGPWF -f $USERLDIF &>/dev/null +$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $USERLDIF &>/dev/null RC=$? if test $RC != 0 ; then echo "ldapadd failed ($RC)!" @@ -89,14 +114,14 @@ fi echo "Running constraint tests..." for ldif in $SRCDIR/data/constraint/{*ok*,*fail*}.ldif; do ### reload - $LDAPDELETE -D $MANAGERDN -H $URI1 -y $CONFIGPWF $USERDN &>/dev/null + $LDAPDELETE -D "$MANAGERDN" -H $URI1 -w $PASSWD $USERDN &>/dev/null RC=$? if test $RC != 0 ; then echo "ldapdelete failed ($RC)!" test $KILLSERVERS != no && kill -HUP $PID exit $RC fi - $LDAPADD -D $MANAGERDN -H $URI1 -y $CONFIGPWF -f $USERLDIF &>/dev/null + $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $USERLDIF &>/dev/null RC=$? if test $RC != 0 ; then echo "ldapadd failed ($RC)!" @@ -108,7 +133,7 @@ for ldif in $SRCDIR/data/constraint/{*ok*,*fail*}.ldif; do echo -n " [$ldif]: " ### modify - $LDAPMODIFY -H $URI1 -x -D "$MANAGERDN" -f $ldif -y $CONFIGPWF &>/dev/null + $LDAPMODIFY -H $URI1 -x -D "$MANAGERDN" -f $ldif -w $PASSWD &>/dev/null RC=$? if test $RC == 0 ; then echo "OK" | tee -a $SCRIPTOUT -- 2.39.5