[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Freeipa-devel] [PATCH] Run ini_config unit test with "make check"



Run ini_config unit test with "make check"

Also adds support for running ini_config_ut under a parallel build
directory.

-- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From fc7217537ebc8630eac4594f0dc27715ff7f2718 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh redhat com>
Date: Thu, 16 Jul 2009 12:49:52 -0400
Subject: [PATCH] Run ini_config unit test with "make check"

Also adds support for running ini_config_ut under a parallel build
directory.
---
 common/ini/Makefile.am     |   10 ++++++++--
 common/ini/ini_config_ut.c |   11 +++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/common/ini/Makefile.am b/common/ini/Makefile.am
index dc30e94..39ab40b 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 7aa5940..bcb47e6 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)) ||
-- 
1.6.2.5

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]