From d24c1397d377a4bb4174e4e690bbc964c31b34eb Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 26 Jan 2008 08:33:14 +0000 Subject: somewhat improve the output from the tests git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@564 ef36b2f9-881f-0410-afb5-c4e39611909c --- tests/test_myldap.c | 66 +++++++++++++++++++++++++-------------------------- tests/test_nsscmds.sh | 34 +++++++++++++------------- tests/test_tio.c | 4 ++-- 3 files changed, 52 insertions(+), 52 deletions(-) (limited to 'tests') diff --git a/tests/test_myldap.c b/tests/test_myldap.c index bbef98b..18e9ab6 100644 --- a/tests/test_myldap.c +++ b/tests/test_myldap.c @@ -58,43 +58,43 @@ static void test_search(void) int i; int rc; /* initialize session */ - printf("test_search(): getting session...\n"); + printf("test_myldap: test_search(): getting session...\n"); session=myldap_create_session(); assert(session!=NULL); /* perform search */ - printf("test_search(): doing search...\n"); + printf("test_myldap: test_search(): doing search...\n"); search=myldap_search(session,nslcd_cfg->ldc_base, LDAP_SCOPE_SUBTREE, "(objectclass=posixaccount)", attrs); assert(search!=NULL); /* go over results */ - printf("test_search(): get results...\n"); + printf("test_myldap: test_search(): get results...\n"); for (i=0;(entry=myldap_get_entry(search,&rc))!=NULL;i++) { if (ildc_base, LDAP_SCOPE_SUBTREE, "(objectclass=posixGroup)", attrs); assert(search!=NULL); /* go over results */ - printf("test_search(): get results...\n"); + printf("test_myldap: test_search(): get results...\n"); for (i=0;(entry=myldap_get_entry(search,&rc))!=NULL;i++) { if (ildc_base, LDAP_SCOPE_SUBTREE, @@ -190,26 +190,26 @@ static void test_two_searches(void) /* get a result from search2 */ entry=myldap_get_entry(search2,NULL); assert(entry!=NULL); - printf("test_two_searches(): [search2] DN %s\n",myldap_get_dn(entry)); + printf("test_myldap: test_two_searches(): [search2] DN %s\n",myldap_get_dn(entry)); vals=myldap_get_values(entry,"cn"); assert((vals!=NULL)&&(vals[0]!=NULL)); - printf("test_two_searches(): [search2] cn=%s\n",vals[0]); + printf("test_myldap: test_two_searches(): [search2] cn=%s\n",vals[0]); /* get another result from search1 */ entry=myldap_get_entry(search1,NULL); assert(entry!=NULL); - printf("test_two_searches(): [search1] DN %s\n",myldap_get_dn(entry)); + printf("test_myldap: test_two_searches(): [search1] DN %s\n",myldap_get_dn(entry)); vals=myldap_get_values(entry,"cn"); assert((vals!=NULL)&&(vals[0]!=NULL)); - printf("test_two_searches(): [search1] cn=%s\n",vals[0]); + printf("test_myldap: test_two_searches(): [search1] cn=%s\n",vals[0]); /* stop search1 */ myldap_search_close(search1); /* get another result from search2 */ entry=myldap_get_entry(search2,NULL); assert(entry!=NULL); - printf("test_two_searches(): [search2] DN %s\n",myldap_get_dn(entry)); + printf("test_myldap: test_two_searches(): [search2] DN %s\n",myldap_get_dn(entry)); vals=myldap_get_values(entry,"cn"); assert((vals!=NULL)&&(vals[0]!=NULL)); - printf("test_two_searches(): [search2] cn=%s\n",vals[0]); + printf("test_myldap: test_two_searches(): [search2] cn=%s\n",vals[0]); /* clean up */ myldap_session_close(session); } @@ -237,11 +237,11 @@ static void *worker(void *arg) for (i=0;(entry=myldap_get_entry(search,&rc))!=NULL;i++) { if (iid,i,myldap_get_dn(entry)); + printf("test_myldap: test_threads(): [worker %d] [%d] DN %s\n",args->id,i,myldap_get_dn(entry)); else if (i==MAXRESULTS) - printf("test_threads(): [worker %d] ...\n",args->id); + printf("test_myldap: test_threads(): [worker %d] ...\n",args->id); } - printf("test_threads(): [worker %d] DONE: %s\n",args->id,ldap_err2string(rc)); + printf("test_myldap: test_threads(): [worker %d] DONE: %s\n",args->id,ldap_err2string(rc)); /* clean up */ myldap_session_close(session); return 0; @@ -289,11 +289,11 @@ static void test_connections(void) nslcd_cfg->ldc_uris[i++]="ldap://nosuchhost/"; nslcd_cfg->ldc_uris[i++]=NULL; /* initialize session */ - printf("test_connections(): getting session...\n"); + printf("test_myldap: test_connections(): getting session...\n"); session=myldap_create_session(); assert(session!=NULL); /* perform search */ - printf("test_connections(): doing search...\n"); + printf("test_myldap: test_connections(): doing search...\n"); search=myldap_search(session,nslcd_cfg->ldc_base, LDAP_SCOPE_SUBTREE, "(objectclass=posixaccount)", diff --git a/tests/test_nsscmds.sh b/tests/test_nsscmds.sh index 085bdf4..fe59a87 100755 --- a/tests/test_nsscmds.sh +++ b/tests/test_nsscmds.sh @@ -35,7 +35,7 @@ base="dc=test,dc=tld" # try to fetch the base DN (fail with exit 77 to indicate problem) ldapsearch -b "$base" -s base -x -H "$uri" > /dev/null 2>&1 || { - echo "LDAP server $uri not available for $base" + echo "test_nsscmds.sh: LDAP server $uri not available for $base" exit 77 } @@ -44,7 +44,7 @@ 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 - echo "nslcd not running" + echo "test_nsscmds.sh: nslcd not running" exit 77 fi @@ -52,7 +52,7 @@ fi # TODO: check if /etc/nsswitch.conf is correct -echo "using LDAP server $uri" +echo "test_nsscmds.sh: using LDAP server $uri" # the total number of errors FAIL=0 @@ -64,7 +64,7 @@ check() { expectfile=`mktemp -t expected.XXXXXX 2> /dev/null || tempfile -s .expected 2> /dev/null` cat > "$expectfile" # run the command - echo 'checking "'"$cmd"'"' + echo 'test_nsscmds.sh: checking "'"$cmd"'"' actualfile=`mktemp -t actual.XXXXXX 2> /dev/null || tempfile -s .actual 2> /dev/null` eval "$cmd" > "$actualfile" 2>&1 || true # check for differences @@ -78,7 +78,7 @@ check() { ########################################################################### -echo "testing aliases..." +echo "test_nsscmds.sh: testing aliases..." # check all aliases check "getent aliases|sort" << EOM @@ -99,7 +99,7 @@ EOM ########################################################################### -echo "testing ether..." +echo "test_nsscmds.sh: testing ether..." # get an entry by hostname check "getent ethers testhost" << EOM @@ -129,7 +129,7 @@ EOM ########################################################################### -echo "testing group..." +echo "test_nsscmds.sh: testing group..." check "getent group testgroup" << EOM testgroup:*:6100:arthur,test @@ -169,7 +169,7 @@ EOM ########################################################################### -echo "testing hosts..." +echo "test_nsscmds.sh: testing hosts..." check "getent hosts testhost" << EOM 10.0.0.1 testhost testhostalias @@ -196,7 +196,7 @@ EOM ########################################################################### -echo "testing netgroup..." +echo "test_nsscmds.sh: testing netgroup..." # check netgroup lookup of test netgroup check "getent netgroup tstnetgroup" << EOM @@ -205,7 +205,7 @@ EOM ########################################################################### -echo "testing networks..." +echo "test_nsscmds.sh: testing networks..." check "getent networks testnet" << EOM testnet 10.0.0.0 @@ -221,7 +221,7 @@ EOM ########################################################################### -echo "testing passwd..." +echo "test_nsscmds.sh: testing passwd..." check "getent passwd ecolden" << EOM ecolden:x:5972:1000:Estelle Colden:/home/ecolden:/bin/bash @@ -242,7 +242,7 @@ EOM ########################################################################### -echo "testing protocols..." +echo "test_nsscmds.sh: testing protocols..." check "getent protocols protfoo" << EOM protfoo 140 protfooalias @@ -266,7 +266,7 @@ EOM ########################################################################### -echo "testing rpc..." +echo "test_nsscmds.sh: testing rpc..." check "getent rpc rpcfoo" << EOM rpcfoo 160002 rpcfooalias @@ -286,7 +286,7 @@ EOM ########################################################################### -echo "testing services..." +echo "test_nsscmds.sh: testing services..." check "getent services foosrv" << EOM foosrv 15349/tcp @@ -330,7 +330,7 @@ EOM ########################################################################### -echo "testing shadow..." +echo "test_nsscmds.sh: testing shadow..." # NOTE: the output of this should depend on whether we are root or not @@ -356,9 +356,9 @@ getent passwd | sed 's/:.*//' | sort | \ if [ $FAIL -eq 0 ] then - echo "all tests passed" + echo "test_nsscmds.sh: all tests passed" exit 0 else - echo "$FAIL tests failed" + echo "test_nsscmds.sh: $FAIL tests failed" exit 1 fi diff --git a/tests/test_tio.c b/tests/test_tio.c index f3bc8f8..3e4343b 100644 --- a/tests/test_tio.c +++ b/tests/test_tio.c @@ -167,8 +167,8 @@ static int test_blocks(size_t wbs, size_t wbl, size_t rbs, size_t rbl) /* set up the socket pair */ assert(socketpair(AF_UNIX,SOCK_STREAM,0,sp)==0); /* log */ - printf("writing %d blocks of %d bytes (%d total)\n",wbl,wbs,wbl*wbs); - printf("reading %d blocks of %d bytes (%d total)\n",rbl,rbs,rbl*rbs); + printf("test_tio: writing %d blocks of %d bytes (%d total)\n",wbl,wbs,wbl*wbs); + printf("test_tio: reading %d blocks of %d bytes (%d total)\n",rbl,rbs,rbl*rbs); /* start the writer thread */ wargs.fd=sp[0]; wargs.blocksize=wbs; -- cgit v1.2.3