[pulseaudio-discuss] [PATCH] tests: make 'check' optional

Deng Zhengrong dzrongg at gmail.com
Wed Aug 8 19:01:59 PDT 2012


---
 configure.ac    |   15 ++++++++++++++-
 src/Makefile.am |   12 ++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index ffb2a35..9cb5aa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -581,10 +581,21 @@ AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h])
 
 #### check test framework ####
 
-PKG_CHECK_MODULES(LIBCHECK, [ check ])
+AC_ARG_ENABLE([check],
+    AS_HELP_STRING([--disable-check],[Disable unit tests]))
+
+AS_IF([test "x$enable_check" != "xno"],
+    [PKG_CHECK_MODULES(LIBCHECK, [ check ], HAVE_LIBCHECK=1, HAVE_LIBCHECK=0)],
+    HAVE_LIBCHECK=0)
+
+AS_IF([test "x$enable_check" = "xyes" && test "x$HAVE_LIBCHECK" = "x0"],
+    [AC_MSG_ERROR([*** check library not found])])
+
 AC_SUBST(LIBCHECK_CFLAGS)
 AC_SUBST(LIBCHECK_LIBS)
 
+AM_CONDITIONAL([HAVE_LIBCHECK], [test "x$HAVE_LIBCHECK" = x1])
+
 #### json parsing ####
 
 PKG_CHECK_MODULES(LIBJSON, [ json >= 0.9 ])
@@ -1393,6 +1404,7 @@ AS_IF([test "x$HAVE_SIMPLEDB" = "x1"], ENABLE_SIMPLEDB=yes, ENABLE_SIMPLEDB=no)
 AS_IF([test "x$HAVE_ESOUND" = "x1"], ENABLE_ESOUND=yes, ENABLE_ESOUND=no)
 AS_IF([test "x$HAVE_ESOUND" = "x1" -a "x$USE_PER_USER_ESOUND_SOCKET" = "x1"], ENABLE_PER_USER_ESOUND_SOCKET=yes, ENABLE_PER_USER_ESOUND_SOCKET=no)
 AS_IF([test "x$HAVE_GCOV" = "x1"], ENABLE_GCOV=yes, ENABLE_GCOV=no)
+AS_IF([test "x$HAVE_LIBCHECK" = "x1"], ENABLE_LIBCHECK=yes, ENABLE_LIBCHECK=no)
 AS_IF([test "x$enable_legacy_database_entry_format" != "xno"], ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=yes, ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=no)
 
 echo "
@@ -1440,6 +1452,7 @@ echo "
     Enable speex (resampler, AEC): ${ENABLE_SPEEX}
     Enable WebRTC echo canceller:  ${ENABLE_WEBRTC}
     Enable gcov coverage:          ${ENABLE_GCOV}
+    Enable check unit tests:       ${ENABLE_LIBCHECK}
     Database
       tdb:                         ${ENABLE_TDB}
       gdbm:                        ${ENABLE_GDBM}
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f20df2..dfa055e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -297,6 +297,7 @@ TESTS_norun += \
 		alsa-time-test
 endif
 
+if HAVE_LIBCHECK
 TESTS_ENVIRONMENT=MAKE_CHECK=1
 TESTS = $(TESTS_default)
 
@@ -309,6 +310,17 @@ endif
 check-daemon: $(TESTS_daemon)
 	PATH=$(builddir):${PATH} $(top_srcdir)/src/tests/test-daemon.sh $(TESTS_daemon)
 
+else
+TESTS_ENVIRONMENT=
+TESTS =
+noinst_PROGRAMS =
+check_PROGRAMS =
+
+check-daemon:
+	@echo "Please don't specify \"--disable-check\" and make sure check library is installed!"
+
+endif
+
 mainloop_test_SOURCES = tests/mainloop-test.c
 mainloop_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-- 
1.7.7.6



More information about the pulseaudio-discuss mailing list