From f583e8aebf51c49bd03d2dc4a8ecc9d5d5a3b3ef Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 30 Apr 2014 23:16:12 +0200 Subject: [PATCH] build system: Disable integration tests if valgrind or chrpath are missing. --- Makefile.am | 2 -- README | 3 ++- configure.ac | 15 ++++++++++++--- t/Makefile.am | 4 ++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 10794f0..92c89f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,9 +4,7 @@ SUBDIRS = src if BUILD_DOCUMENTATION SUBDIRS += doc endif -if BUILD_TESTING SUBDIRS += t -endif EXTRA_DIST = autogen.sh version-gen.sh diff --git a/README b/README index 92193ef..a737ebc 100644 --- a/README +++ b/README @@ -68,7 +68,8 @@ Testing library. It used used to mock I/O related functions. In case this function is not available, the respective tests will be disabled automatically. - The integration tests require valgrind and chrpath. + The integration tests require valgrind and chrpath. If any of these are not + available, integration tests will be disabled automatically. For the latest build status, see: diff --git a/configure.ac b/configure.ac index 420021f..7b8d801 100644 --- a/configure.ac +++ b/configure.ac @@ -253,7 +253,7 @@ Build dependencies:]) dnl Testing. PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], - [build_testing="yes"], [build_testing="no"]) + [unit_tests="yes"], [unit_tests="no"]) AC_CHECK_HEADERS(libgen.h) @@ -396,6 +396,14 @@ if test "x$A2X" = "x"; then fi AC_SUBST([A2X]) +integration_tests="yes" +AC_PATH_PROG([VALGRIND], [valgrind]) +AC_PATH_PROG([CHRPATH], [chrpath]) +if test "x$VALGRIND" = "x" || test "x$CHRPATH" = "x"; then + integration_tests="no (missing valgrind and/or chrpath)" +fi +AM_CONDITIONAL([INTEGRATION_TESTING], test "x$integration_tests" = "xyes") + dnl Plugin checks. puppet_storeconfigs_default=$with_libdbi if test "x$puppet_storeconfigs_default" != "xyes"; then @@ -422,7 +430,7 @@ AC_SDB_PLUGIN([syslog], [yes], [plugin logging to syslog]) AM_CONDITIONAL([BUILD_DOCUMENTATION], test "x$build_documentation" = "xyes") -AM_CONDITIONAL([BUILD_TESTING], test "x$build_testing" = "xyes") +AM_CONDITIONAL([UNIT_TESTING], test "x$unit_tests" = "xyes") AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile src/liboconfig/Makefile t/Makefile]) @@ -447,9 +455,10 @@ AC_MSG_RESULT([ xmlto / xsltproc: . . . . . $have_xmlto / $have_xsltproc]) AC_MSG_RESULT() AC_MSG_RESULT([ Features:]) AC_MSG_RESULT([ documentation: . . . . . . $build_documentation]) -AC_MSG_RESULT([ unit testing: . . . . . . . $build_testing]) +AC_MSG_RESULT([ unit testing: . . . . . . . $unit_tests]) AC_MSG_RESULT([ stdio mocking: . . . . . $have_fopencookie]) AC_MSG_RESULT([ coverage testing: . . . . . $enable_gcov]) +AC_MSG_RESULT([ integration testing: . . . $integration_tests]) AC_MSG_RESULT() AC_MSG_RESULT([ Libraries:]) AC_MSG_RESULT([ libdbi: . . . . . . . . . . $with_libdbi]) diff --git a/t/Makefile.am b/t/Makefile.am index 971b581..bfeadcf 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -17,8 +17,10 @@ noinst_LTLIBRARIES = # unit tests # +if UNIT_TESTING TESTS += unit/libsysdb_test unit/libsysdb_net_test check_PROGRAMS += unit/libsysdb_test unit/libsysdb_net_test +endif unit_libsysdb_test_SOURCES = \ unit/libsysdb_test.c unit/libsysdb_test.h \ @@ -51,7 +53,9 @@ unit_libsysdb_net_test_LDADD = $(top_builddir)/src/libsysdb.la @CHECK_LIBS@ # integration tests # +if INTEGRATION_TESTING TESTS += integration/simple_config.sh integration/simple_query.sh +endif noinst_LTLIBRARIES += integration/mock_plugin.la integration_mock_plugin_la_SOURCES = integration/mock_plugin.c -- 2.30.2