summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-07-16 12:49:52 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-07-16 16:30:38 -0400
commitccff2c2124b9ff085fb8473610a35daf1ab875cd (patch)
tree1e2e2c98cd746bb01359e7096caddf9204791b44 /common
parentd783b0fb0caf9d3c957cadb69f933eba1544d16e (diff)
downloadsssd-ccff2c2124b9ff085fb8473610a35daf1ab875cd.tar.gz
sssd-ccff2c2124b9ff085fb8473610a35daf1ab875cd.tar.bz2
sssd-ccff2c2124b9ff085fb8473610a35daf1ab875cd.zip
Run ini_config unit test with "make check"
Also adds support for running ini_config_ut under a parallel build directory.
Diffstat (limited to 'common')
-rw-r--r--common/ini/Makefile.am10
-rw-r--r--common/ini/ini_config_ut.c11
2 files changed, 19 insertions, 2 deletions
diff --git a/common/ini/Makefile.am b/common/ini/Makefile.am
index dc30e947..39ab40b3 100644
--- a/common/ini/Makefile.am
+++ b/common/ini/Makefile.am
@@ -16,7 +16,11 @@ ACLOCAL_AMFLAGS = -I m4
# Set up the pkg-config file
pkgconfigdir = $(libdir)/pkgconfig
-dist_noinst_DATA = ini_config.pc
+dist_noinst_DATA = \
+ ini_config.pc \
+ ini.conf \
+ ini.d/real.conf \
+ ini.d/test.conf
# Build library
noinst_LTLIBRARIES = libini_config.la
@@ -25,6 +29,8 @@ libini_config_la_SOURCES = \
ini_config.h
# Build unit test
-noinst_PROGRAMS = ini_config_ut
+check_PROGRAMS = ini_config_ut
ini_config_ut_SOURCES = ini_config_ut.c
ini_config_ut_LDADD = libini_config.la ../collection/libcollection.la
+
+TESTS = ini_config_ut
diff --git a/common/ini/ini_config_ut.c b/common/ini/ini_config_ut.c
index 7aa59405..bcb47e6d 100644
--- a/common/ini/ini_config_ut.c
+++ b/common/ini/ini_config_ut.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include <unistd.h>
#define TRACE_HOME
#include "ini_config.h"
#include "collection.h"
@@ -801,6 +802,16 @@ int main(int argc, char *argv[])
{
int error;
+ char *srcdir;
+
+ srcdir = getenv("srcdir");
+ if(srcdir) {
+ if(chdir(srcdir) == 0) {
+ error = errno;
+ return error;
+ }
+ }
+
if ((error = basic_test()) ||
(error = single_file()) ||
(error = real_test(NULL)) ||