This patch resolves https://fedorahosted.org/sssd/ticket/116

--with-tests was confusing. Since we now build our tests only with
'make check', it doesn't make sense for this to be a configure-
time option. We will detect during configure whether the 'check'
package is available and we will use them if so. Otherwise, we
will only build and execute any test suites that do not rely on
the 'check' framework.

Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From a44d2add848578509538427da5533067069727fc Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <[email protected]>
Date: Tue, 18 Aug 2009 10:29:53 -0400
Subject: [PATCH] Eliminate the --with-tests configure flag

--with-tests was confusing. Since we now build our tests only with
'make check', it doesn't make sense for this to be a configure-
time option. We will detect during configure whether the 'check'
package is available and we will use them if so. Otherwise, we
will only build and execute any test suites that do not rely on
the 'check' framework.
---
 server/Makefile.am    |   26 ++++++++++++++++++--------
 server/conf_macros.m4 |   18 ------------------
 server/configure.ac   |    8 ++++----
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/server/Makefile.am b/server/Makefile.am
index 7ef7eb7..ce5978b 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -49,12 +49,21 @@ sssdlibexec_PROGRAMS = \
     $(sssd_pk) \
     $(sssd_info)
 
-if BUILD_TESTS
 check_PROGRAMS = \
-    sysdb-tests \
-    stress-tests \
-    resolv-tests
-TESTS = sysdb-tests resolv-tests
+    stress-tests
+
+if HAVE_CHECK
+    check_PROGRAMS += \
+        sysdb-tests \
+        resolv-tests 
+endif
+
+TESTS =
+
+if HAVE_CHECK
+    TESTS += \
+        sysdb-tests \
+        resolv-tests
 endif
 
 sssdlib_LTLIBRARIES = \
@@ -322,7 +331,7 @@ sss_groupmod_LDADD = \
 #################
 # Feature Tests #
 #################
-if BUILD_TESTS
+if HAVE_CHECK
 sysdb_tests_SOURCES = \
     tests/sysdb-tests.c \
     $(SSSD_UTIL_OBJ)
@@ -331,6 +340,7 @@ sysdb_tests_CFLAGS = \
 sysdb_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS)
+endif
 
 stress_tests_SOURCES = \
     tests/stress-tests.c \
@@ -338,6 +348,7 @@ stress_tests_SOURCES = \
 stress_tests_LDADD = \
     $(SSSD_LIBS)
 
+if HAVE_CHECK
 resolv_tests_SOURCES = \
     tests/resolv-tests.c \
     $(SSSD_UTIL_OBJ) \
@@ -348,8 +359,7 @@ resolv_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS) \
     $(CARES_LIBS)
-
-endif #BUILD_TESTS
+endif
 
 ####################
 # Plugin Libraries #
diff --git a/server/conf_macros.m4 b/server/conf_macros.m4
index 2613bfb..aa2d578 100644
--- a/server/conf_macros.m4
+++ b/server/conf_macros.m4
@@ -66,24 +66,6 @@ AC_DEFUN([WITH_PIPE_PATH],
     AC_DEFINE_UNQUOTED(PIPE_PATH, "$config_pipepath", [Where to store pipe 
files for the SSSD interconnects])
   ])
 
-AC_DEFUN([WITH_TESTS],
-  [ AC_ARG_WITH([tests],
-                [AC_HELP_STRING([--with-tests],
-                                [Whether to build tests [no]]
-                               )
-                ],
-                [],
-                with_tests=no
-               )
-
-    if test x"$with_tests" == xyes; then
-        AC_DEFINE(HAVE_TESTS, 1, [Build tests])
-        HAVE_TESTS=1
-        AC_SUBST(HAVE_TESTS)
-    fi
-  ])
-AM_CONDITIONAL([BUILD_TESTS], [test x$with_tests = xyes])
-
 AC_DEFUN([WITH_INIT_DIR],
   [ AC_ARG_WITH([init-dir],
                 [AC_HELP_STRING([--with-init-dir=DIR],
diff --git a/server/configure.ac b/server/configure.ac
index 9cd30e2..09d72e9 100644
--- a/server/configure.ac
+++ b/server/configure.ac
@@ -39,7 +39,6 @@ WITH_DB_PATH
 WITH_PLUGIN_PATH
 WITH_PID_PATH
 WITH_PIPE_PATH
-WITH_TESTS
 WITH_INIT_DIR
 WITH_SHADOW_UTILS_PATH
 WITH_MANPAGES
@@ -67,9 +66,10 @@ if test x$has_dbus != xno; then
                   AC_DEFINE([HAVE_DBUS_WATCH_GET_UNIX_FD], [1],
                             [Define if dbus_watch_get_unix_fd exists]))
 fi
-if test x$HAVE_TESTS != x; then
-    PKG_CHECK_MODULES([CHECK],[check])
-fi
+
+PKG_CHECK_MODULES([CHECK], [check], [have_check=1], [have_check=])
+AM_CONDITIONAL([HAVE_CHECK], [test x$have_check != x])
+
 PKG_CHECK_MODULES([NSS],[nss])
 
 if test x$HAVE_MANPAGES != x; then
-- 
1.6.2.5

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
sssd-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to