nss-pam-ldapd commit: r1413 - nss-pam-ldapd/tests
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1413 - nss-pam-ldapd/tests
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1413 - nss-pam-ldapd/tests
- Date: Fri, 25 Mar 2011 17:15:31 +0100 (CET)
Author: arthur
Date: Fri Mar 25 17:15:26 2011
New Revision: 1413
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1413
Log:
re-organise tests somewhat making things more consistent
Modified:
nss-pam-ldapd/tests/Makefile.am
nss-pam-ldapd/tests/test_cfg.c
nss-pam-ldapd/tests/test_common.c
nss-pam-ldapd/tests/test_myldap.c
Modified: nss-pam-ldapd/tests/Makefile.am
==============================================================================
--- nss-pam-ldapd/tests/Makefile.am Fri Mar 25 17:08:03 2011 (r1412)
+++ nss-pam-ldapd/tests/Makefile.am Fri Mar 25 17:15:26 2011 (r1413)
@@ -18,11 +18,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
-TESTS = test_dict test_set test_tio test_cfg test_myldap.sh test_nsscmds.sh \
- test_pamcmds.sh test_getpeercred test_common test_expr
+TESTS = test_dict test_set test_tio test_expr test_getpeercred test_cfg \
+ test_myldap.sh test_common test_nsscmds.sh test_pamcmds.sh
-check_PROGRAMS = test_dict test_set test_tio test_cfg test_myldap \
- test_getpeercred test_common test_expr
+check_PROGRAMS = test_dict test_set test_tio test_expr test_getpeercred \
+ test_cfg test_myldap test_common
EXTRA_DIST = nslcd-test.conf test_myldap.sh test_nsscmds.sh test_pamcmds.sh \
in_testenv.sh test_pamcmds.expect usernames.txt
@@ -47,36 +47,28 @@
test_tio_SOURCES = test_tio.c ../common/tio.h ../common/tio.c
test_tio_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-test_cfg_SOURCES = test_cfg.c
-test_cfg_LDADD = ../nslcd/log.o ../nslcd/attmap.o \
- ../nslcd/common.o ../nslcd/myldap.o \
- ../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.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 \
- ../common/libexpr.a ../compat/libcompat.a
-
test_expr_SOURCES = test_expr.c
test_expr_LDADD = ../common/set.o ../common/dict.o
-test_myldap_SOURCES = test_myldap.c
-test_myldap_LDADD = ../nslcd/log.o ../nslcd/common.o ../nslcd/cfg.o \
- ../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.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/myldap.o @nslcd_LIBS@ ../common/libtio.a \
- ../common/libdict.a ../compat/libcompat.a
-
test_getpeercred_SOURCES = test_getpeercred.c
test_getpeercred_LDADD = ../compat/libcompat.a
+# common objects that are included for the tests of nslcd functionality
+common_nslcd_LDADD = ../nslcd/log.o ../nslcd/common.o \
+ ../nslcd/myldap.o ../nslcd/attmap.o \
+ ../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.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/pam.o \
+ @nslcd_LIBS@ @PTHREAD_LIBS@ ../common/libtio.a \
+ ../common/libdict.a ../common/libexpr.a \
+ ../compat/libcompat.a
+
+test_cfg_SOURCES = test_cfg.c
+test_cfg_LDADD = $(common_nslcd_LDADD)
+
+test_myldap_SOURCES = test_myldap.c
+test_myldap_LDADD = ../nslcd/cfg.o $(common_nslcd_LDADD)
+
test_common_SOURCES = test_common.c
-test_common_LDADD = ../nslcd/log.o ../nslcd/common.o \
- ../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.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/attmap.o \
- ../nslcd/myldap.o @nslcd_LIBS@ ../common/libtio.a \
- ../common/libdict.a ../common/libexpr.a
../compat/libcompat.a
+test_common_LDADD = ../nslcd/cfg.o $(common_nslcd_LDADD)
Modified: nss-pam-ldapd/tests/test_cfg.c
==============================================================================
--- nss-pam-ldapd/tests/test_cfg.c Fri Mar 25 17:08:03 2011 (r1412)
+++ nss-pam-ldapd/tests/test_cfg.c Fri Mar 25 17:15:26 2011 (r1413)
@@ -83,7 +83,6 @@
assert(parse_boolean(__FILE__,__LINE__,"Foo")==0); */
}
-
static void test_parse_scope(void)
{
assert(parse_scope(__FILE__,__LINE__,"sUb")==LDAP_SCOPE_SUBTREE);
Modified: nss-pam-ldapd/tests/test_common.c
==============================================================================
--- nss-pam-ldapd/tests/test_common.c Fri Mar 25 17:08:03 2011 (r1412)
+++ nss-pam-ldapd/tests/test_common.c Fri Mar 25 17:15:26 2011 (r1413)
@@ -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 @@
/* 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;
}
Modified: nss-pam-ldapd/tests/test_myldap.c
==============================================================================
--- nss-pam-ldapd/tests/test_myldap.c Fri Mar 25 17:08:03 2011 (r1412)
+++ nss-pam-ldapd/tests/test_myldap.c Fri Mar 25 17:15:26 2011 (r1413)
@@ -39,18 +39,6 @@
int id;
};
-static const char *foo="";
-
-/* this is a simple way to get this into an executable,
- we should probably read a valid config instead */
-const char **base_get_var(int UNUSED(map)) {return NULL;}
-int *scope_get_var(int UNUSED(map)) {return NULL;}
-const char **filter_get_var(int UNUSED(map)) {return &foo;}
-const char **attmap_get_var(int UNUSED(map),const char UNUSED(*name)) {return
&foo;}
-const char *attmap_get_value(MYLDAP_ENTRY UNUSED(*entry),const char
UNUSED(*attr),char UNUSED(*buffer),size_t UNUSED(buflen)) {return "";}
-void *attmap_add_attributes(void UNUSED(*set),const char UNUSED(*attr))
{return NULL;}
-const char *attmap_set_mapping(const char UNUSED(**var),const char
UNUSED(*value)) {return NULL;}
-
/* the maxium number of results to print (all results are retrieved) */
#define MAXRESULTS 10
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1413 - nss-pam-ldapd/tests,
Commits of the nss-pam-ldapd project