From 253dcbbbc0b9d44543b19c99181833f1673a1537 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Fri, 26 Feb 2016 15:44:21 -0800 Subject: [PATCH] Provide configure option to disable tests Building the tests is enabled by default, but because the test suite requires root privileges to run at the moment, people should have to option to disable the tests entirely. Signed-off-by: Patrick McCarty --- Makefile.am | 2 ++ configure.ac | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Makefile.am b/Makefile.am index eac45b7..328648f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,9 +103,11 @@ install-exec-hook: perl findstatic.pl */*.o | grep -v Checking ||: TEST_EXTENSIONS = .sh +if ENABLE_TESTS TESTS = $(dist_check_SCRIPTS) dist_check_SCRIPTS = \ test/run.sh +endif release: @git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \ diff --git a/configure.ac b/configure.ac index 5e2bea7..50c9e4a 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,11 @@ AS_IF([test "$enable_lzma" != "no"], [ ]) AM_CONDITIONAL([ENABLE_LZMA], [test "$enable_lzma" != "no"]) +AC_ARG_ENABLE( + [tests], + [AS_HELP_STRING([--disable-tests], [Do not enable functional tests (enabled by default)])] +) + have_coverage=no AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage])) if test "x$enable_coverage" = "xyes" ; then @@ -52,6 +57,13 @@ if test "x$enable_coverage" = "xyes" ; then fi AM_CONDITIONAL([COVERAGE], [test "$have_coverage" = "yes"]) +AS_IF([test "$enable_tests" != "no"], [ + AC_PATH_PROG([have_valgrind], [valgrind]) + AS_IF([test -z "${have_valgrind}"], [ + AC_MSG_ERROR([Must have valgrind installed to run functional tests]) + ]) +]) +AM_CONDITIONAL([ENABLE_TESTS], [test "$enable_tests" != "no"]) AC_CONFIG_FILES([Makefile data/bsdiff.pc]) AC_OUTPUT