diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-03-25 16:15:26 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-03-25 16:15:26 +0000 |
commit | 16b5262cf2e593f9d2086806096f73d526873b3c (patch) | |
tree | 501902c3e72da4f60bc4a9866d56574eddbc0363 /tests/test_common.c | |
parent | 3086d518412247138e743cc954d98ec834a4a0c4 (diff) |
re-organise tests somewhat making things more consistent
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1413 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'tests/test_common.c')
-rw-r--r-- | tests/test_common.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/test_common.c b/tests/test_common.c index ee96733..6911108 100644 --- a/tests/test_common.c +++ b/tests/test_common.c @@ -27,10 +27,7 @@ #include "nslcd/common.h" #include "nslcd/cfg.h" - -/* we include nslcd/cfg.c here to use cfg_defaults() to set the default - regular expression used in test_isvalidname() */ -#include "nslcd/cfg.c" +#include "nslcd/log.h" static void test_isvalidname(void) { @@ -46,8 +43,19 @@ static void test_isvalidname(void) /* the main program... */ int main(int UNUSED(argc),char UNUSED(*argv[])) { - nslcd_cfg=(struct ldap_config *)malloc(sizeof(struct ldap_config)); - cfg_defaults(nslcd_cfg); + char *srcdir; + char fname[100]; + /* build the name of the file */ + srcdir=getenv("srcdir"); + if (srcdir==NULL) + srcdir="."; + snprintf(fname,sizeof(fname),"%s/nslcd-test.conf",srcdir); + fname[sizeof(fname)-1]='\0'; + /* initialize configuration */ + cfg_init(fname); + /* partially initialize logging */ + log_setdefaultloglevel(LOG_DEBUG); + /* run the tests */ test_isvalidname(); return 0; } |