diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2008-01-31 22:45:21 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2008-01-31 22:45:21 +0100 |
commit | 3d6cee3dde2fe11917ba3703e92130e6d55a3c26 (patch) | |
tree | 9ffb41dfa5a8a78878258c9d76f45277bdd4e3ff /tests | |
parent | ff7b362e3d7fe1e21540b31ca46090dcb7e83abf (diff) |
pass the correct pthread flags for all calls to compiler and linker and link in compat code, handle other assert.h setups and avoid some ! in if statements in shell scripts
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@589 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/test_cfg.c | 7 | ||||
-rw-r--r-- | tests/test_myldap.c | 8 | ||||
-rwxr-xr-x | tests/test_nsscmds.sh | 17 |
4 files changed, 24 insertions, 16 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 90f9e1e..4a781d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,7 @@ noinst_PROGRAMS = test_aliases test_ethers test_group test_hosts \ EXTRA_DIST = nss-ldapd-test.conf test_myldap.sh test_nsscmds.sh AM_CPPFLAGS = -I$(top_srcdir) -AM_CFLAGS = -pthread -g +AM_CFLAGS = $(PTHREAD_CFLAGS) -g # the following enables verbose protocol debugging information to be dumped #AM_CPPFLAGS += -DDEBUG_PROT -DDEBUG_PROT_DUMP @@ -41,7 +41,7 @@ test_dict_SOURCES = test_dict.c ../common/dict.h test_dict_LDADD = ../common/dict.o test_tio_SOURCES = test_tio.c ../common/tio.h ../common/tio.c -test_tio_LDFLAGS = -pthread +test_tio_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) test_cfg_SOURCES = test_cfg.c test_cfg_LDADD = ../nslcd/log.o ../nslcd/attmap.o ../common/dict.o \ @@ -50,10 +50,10 @@ test_cfg_LDADD = ../nslcd/log.o ../nslcd/attmap.o ../common/dict.o \ ../nslcd/host.o ../nslcd/netgroup.o ../nslcd/network.o \ ../nslcd/passwd.o ../nslcd/protocol.o ../nslcd/rpc.o \ ../nslcd/service.o ../nslcd/shadow.o \ - @nslcd_LIBS@ ../common/libtio.a ../common/libdict.a + @nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \ + ../compat/libcompat.a test_myldap_SOURCES = test_myldap.c -test_myldap_CFLAGS = -pthread test_myldap_LDADD = ../nslcd/log.o ../common/dict.o ../common/tio.o \ ../nslcd/common.o ../nslcd/cfg.o \ ../nslcd/myldap.o ../nslcd/pagectrl.o @nslcd_LIBS@ diff --git a/tests/test_cfg.c b/tests/test_cfg.c index 9f9be19..f39e33e 100644 --- a/tests/test_cfg.c +++ b/tests/test_cfg.c @@ -29,10 +29,17 @@ /* we include cfg.c because we want to test the static methods */ #include "nslcd/cfg.c" +#ifndef __ASSERT_FUNCTION +#define __ASSERT_FUNCTION "" +#endif /* not __ASSERT_FUNCTION */ + #define assertstreq(str1,str2) \ (assertstreq_impl(str1,str2,"strcmp(" __STRING(str1) "," __STRING(str2) ")==0", \ __FILE__, __LINE__, __ASSERT_FUNCTION)) +/* for Solaris: */ +#define __assert_fail(assertion,file,line,function) __assert(assertion,file,line) + /* method for determening string equalness */ static void assertstreq_impl(const char *str1,const char *str2, const char *assertion,const char *file, diff --git a/tests/test_myldap.c b/tests/test_myldap.c index 18e9ab6..a29415d 100644 --- a/tests/test_myldap.c +++ b/tests/test_myldap.c @@ -144,10 +144,10 @@ static void test_get_values(void) /* get rdn values */ rdnval=myldap_get_rdn_value(entry,"cn"); if (i<MAXRESULTS) - printf("test_myldap: test_get_values(): [%d] cdrdn=%s\n",i,rdnval); + printf("test_myldap: test_get_values(): [%d] cdrdn=%s\n",i,rdnval==NULL?"NULL":rdnval); rdnval=myldap_get_rdn_value(entry,"uid"); if (i<MAXRESULTS) - printf("test_myldap: test_get_values(): [%d] uidrdn=%s\n",i,rdnval); + printf("test_myldap: test_get_values(): [%d] uidrdn=%s\n",i,rdnval==NULL?"NULL":rdnval); /* check objectclass */ assert(myldap_has_objectclass(entry,"posixAccount")); } @@ -283,9 +283,9 @@ static void test_connections(void) } /* set new URIs */ i=0; - nslcd_cfg->ldc_uris[i++]="ldapi://%2fdev%2fnull/"; +/* nslcd_cfg->ldc_uris[i++]="ldapi://%2fdev%2fnull/";*/ nslcd_cfg->ldc_uris[i++]="ldap://10.10.10.10/"; - nslcd_cfg->ldc_uris[i++]="ldapi://%2fdev%2fnonexistent/"; +/* nslcd_cfg->ldc_uris[i++]="ldapi://%2fdev%2fnonexistent/";*/ nslcd_cfg->ldc_uris[i++]="ldap://nosuchhost/"; nslcd_cfg->ldc_uris[i++]=NULL; /* initialize session */ diff --git a/tests/test_nsscmds.sh b/tests/test_nsscmds.sh index 3b8ad84..ad6e8ad 100755 --- a/tests/test_nsscmds.sh +++ b/tests/test_nsscmds.sh @@ -30,8 +30,10 @@ set -e # check if LDAP is configured correctly cfgfile="/etc/nss-ldapd.conf" -if ! [ -r "$cfgfile" ] +if [ -r "$cfgfile" ] then + : +else echo "test_nsscmds.sh: $cfgfile: not found" exit 77 fi @@ -46,10 +48,12 @@ ldapsearch -b "$base" -s base -x -H "$uri" > /dev/null 2>&1 || { } # basic check to see if nslcd is running -if ! [ -S /var/run/nslcd/socket ] || \ - ! [ -f /var/run/nslcd/nslcd.pid ] || \ - ! kill -s 0 `cat /var/run/nslcd/nslcd.pid` > /dev/null 2>&1 +if [ -S /var/run/nslcd/socket ] && \ + [ -f /var/run/nslcd/nslcd.pid ] && \ + kill -s 0 `cat /var/run/nslcd/nslcd.pid` > /dev/null 2>&1 then + : +else echo "test_nsscmds.sh: nslcd not running" exit 77 fi @@ -74,10 +78,7 @@ check() { actualfile=`mktemp -t actual.XXXXXX 2> /dev/null || tempfile -s .actual 2> /dev/null` eval "$cmd" > "$actualfile" 2>&1 || true # check for differences - if ! diff -Nauwi "$expectfile" "$actualfile" - then - FAIL=`expr $FAIL + 1` - fi + diff -Nauwi "$expectfile" "$actualfile" || FAIL=`expr $FAIL + 1` # remove temporary files rm "$expectfile" "$actualfile" } |