From a00cb8f614762e1857c70655298b864295e65770 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 17 May 2002 09:11:30 +0000 Subject: [PATCH] Fix return code tests. --- tests/scripts/test002-populate | 1 + tests/scripts/test003-search | 10 +++++++--- tests/scripts/test005-modrdn | 11 +++-------- tests/scripts/test006-acls | 2 +- tests/scripts/test007-replication | 2 ++ tests/scripts/test009-referral | 4 ++++ tests/scripts/test010-passwd | 9 ++++++++- tests/scripts/test011-subtree-repl | 3 +++ tests/scripts/test012-glue | 3 ++- tests/scripts/test013-language | 4 ++++ tests/scripts/test015-xsearch | 4 ++++ 11 files changed, 39 insertions(+), 14 deletions(-) diff --git a/tests/scripts/test002-populate b/tests/scripts/test002-populate index 81ad49508a..dd785f0944 100755 --- a/tests/scripts/test002-populate +++ b/tests/scripts/test002-populate @@ -54,6 +54,7 @@ fi echo "Using ldapsearch to read all the entries..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'objectclass=*' > $SEARCHOUT 2>&1 +RC=$? kill -HUP $PID diff --git a/tests/scripts/test003-search b/tests/scripts/test003-search index d0173fbac2..94121d32f4 100755 --- a/tests/scripts/test003-search +++ b/tests/scripts/test003-search @@ -69,6 +69,7 @@ cat /dev/null > $SEARCHOUT echo "Testing exact searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'sn=jensen' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -78,6 +79,7 @@ fi echo "Testing OR searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -87,6 +89,7 @@ fi echo "Testing AND matching and ends-with searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -96,14 +99,15 @@ fi echo "Testing NOT searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1 +RC=$? + +kill -HUP $PID + if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" - kill -HUP $PID exit $RC fi -kill -HUP $PID - LDIF=$SEARCHOUTMASTER echo "Filtering ldapsearch results..." diff --git a/tests/scripts/test005-modrdn b/tests/scripts/test005-modrdn index ef4b1520a0..11d3c44f03 100755 --- a/tests/scripts/test005-modrdn +++ b/tests/scripts/test005-modrdn @@ -198,13 +198,14 @@ echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)... $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'cn=James A Jones 1' > $SEARCHOUT 2>&1 RC=$? + +kill -HUP $PID + if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" - kill -HUP $PID exit $RC fi - LDIF=$MODRDNOUTMASTER3 echo "Filtering ldapsearch results..." @@ -216,15 +217,9 @@ $CMP $SEARCHFLT $LDIFFLT > $CMPOUT if test $? != 0 ; then echo "comparison failed - modrdn operations did not complete correctly" - kill -HUP $PID exit 1 fi -kill -HUP $PID echo ">>>>> Test succeeded" - - -# echo "modrdn test not yet written" - exit 0 diff --git a/tests/scripts/test006-acls b/tests/scripts/test006-acls index 0f0d89993a..8a389b67f3 100755 --- a/tests/scripts/test006-acls +++ b/tests/scripts/test006-acls @@ -125,7 +125,7 @@ EOMODS4 echo "Using ldapsearch to retrieve all the entries..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ - 'objectClass=*' | . $LDIFFILTER >> $SEARCHOUT 2>&1 + 'objectClass=*' >> $SEARCHOUT 2>&1 RC=$? kill -HUP $PID if test $RC != 0 ; then diff --git a/tests/scripts/test007-replication b/tests/scripts/test007-replication index a0d9d49bb5..4f93e1a62c 100755 --- a/tests/scripts/test007-replication +++ b/tests/scripts/test007-replication @@ -177,6 +177,7 @@ sleep 15 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'objectclass=*' > $MASTEROUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -188,6 +189,7 @@ fi echo "Using ldapsearch to read all the entries from the slave..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \ 'objectclass=*' > $SLAVEOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" diff --git a/tests/scripts/test009-referral b/tests/scripts/test009-referral index 97f1f096be..63e145eebc 100755 --- a/tests/scripts/test009-referral +++ b/tests/scripts/test009-referral @@ -86,6 +86,7 @@ cat /dev/null > $SEARCHOUT echo "Testing exact searching..." $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \ 'sn=jensen' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID $SLAVEPID @@ -95,6 +96,7 @@ fi echo "Testing OR searching..." $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \ '(|(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID $SLAVEPID @@ -104,6 +106,7 @@ fi echo "Testing AND matching and ends-with searching..." $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \ '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID $SLAVEPID @@ -113,6 +116,7 @@ fi echo "Testing NOT searching..." $LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \ '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID $SLAVEPID diff --git a/tests/scripts/test010-passwd b/tests/scripts/test010-passwd index 8492d96ee6..acf6175319 100755 --- a/tests/scripts/test010-passwd +++ b/tests/scripts/test010-passwd @@ -74,7 +74,8 @@ if test $RC != 0 ; then fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w $PASSWD -s newsecret \ - -D $MANAGERDN "cn=smd5, $BASEDN" >> $TESTOUT 2>&1 + -D "$MANAGERDN" "cn=smd5, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -83,6 +84,7 @@ fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w secret -s newsecret \ -D "cn=sha, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -91,6 +93,7 @@ fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w secret -s newsecret \ -D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -103,6 +106,7 @@ echo "Using ldappasswd (PASS 2) ..." $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w newsecret \ -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -111,6 +115,7 @@ fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w newsecret \ -D "cn=smd5, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -119,6 +124,7 @@ fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w newsecret \ -D "cn=sha, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID @@ -127,6 +133,7 @@ fi $LDAPPASSWD -h $LOCALHOST -p $PORT \ -w newsecret \ -D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldappasswd failed ($RC)!" kill -HUP $PID diff --git a/tests/scripts/test011-subtree-repl b/tests/scripts/test011-subtree-repl index bc6b4732b2..a1db8872e0 100755 --- a/tests/scripts/test011-subtree-repl +++ b/tests/scripts/test011-subtree-repl @@ -182,6 +182,7 @@ sleep 15 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'objectclass=*' > $MASTEROUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -193,6 +194,7 @@ fi echo "Using ldapsearch to read the subtree entries from the master..." $LDAPSEARCH -S "" -b "ou=Groups, $BASEDN" -h $LOCALHOST -p $PORT \ 'objectclass=*' > $SUBMASTEROUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -204,6 +206,7 @@ fi echo "Using ldapsearch to read all the entries from the slave..." $LDAPSEARCH -S "" -b "ou=Groups, $BASEDN" -h $LOCALHOST -p $SLAVEPORT \ 'objectclass=*' > $SLAVEOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" diff --git a/tests/scripts/test012-glue b/tests/scripts/test012-glue index d820cb67d3..51c589ca84 100755 --- a/tests/scripts/test012-glue +++ b/tests/scripts/test012-glue @@ -5,7 +5,7 @@ SRCDIR="." if test $# -ge 1 ; then SRCDIR=$1; shift fi -BACKEND=ldbm +BACKEND=bdb if test $# -ge 1 ; then BACKEND=$1; shift fi @@ -111,6 +111,7 @@ fi echo "Using ldapsearch to read all the entries..." $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \ 'objectclass=*' > $SEARCHOUT 2>&1 +RC=$? kill -HUP $PID diff --git a/tests/scripts/test013-language b/tests/scripts/test013-language index 2068fa7f87..ba8b0eedbc 100755 --- a/tests/scripts/test013-language +++ b/tests/scripts/test013-language @@ -54,6 +54,7 @@ fi echo "Using ldapsearch to read all the entries..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \ '(&)' > $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -64,6 +65,7 @@ fi echo "Using ldapsearch to read name ..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \ '(&)' 'name' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -74,6 +76,7 @@ fi echo "Using ldapsearch to read name language tag ..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \ '(&)' 'name;lang-en-US' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" @@ -84,6 +87,7 @@ fi echo "Using ldapsearch to read name language range ..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT -s base \ '(&)' 'name;lang-en-' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" diff --git a/tests/scripts/test015-xsearch b/tests/scripts/test015-xsearch index c5c60b2e6a..9f66443aa1 100755 --- a/tests/scripts/test015-xsearch +++ b/tests/scripts/test015-xsearch @@ -69,6 +69,7 @@ cat /dev/null > $SEARCHOUT echo "Testing exact searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(sn:=jensen)' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -78,6 +79,7 @@ fi echo "Testing OR searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn:caseExactMatch:=Jones))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -87,6 +89,7 @@ fi echo "Testing AND matching and ends-with searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID @@ -96,6 +99,7 @@ fi echo "Testing NOT searching..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1 +RC=$? if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" kill -HUP $PID -- 2.39.5