From 7482ef6bfadc5bd22ca84a642f5696e4e977555b Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 18 Nov 2018 15:15:13 +0100 Subject: [PATCH] Add autoconf checks for LXC and cmocka. If LXC or cmocka are not installed, don't build the blackbox test suite. --- configure.ac | 5 +++++ test/Makefile.am | 2 ++ test/blackbox/run_blackbox_tests/Makefile.am | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ed193cd4..275bf5f1 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,11 @@ AS_IF([test "x$enable_utcp_debug" = "xyes"], ] ); +dnl Blackbox test suite +PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.0], [cmocka=true], [cmocka=false]) +PKG_CHECK_MODULES([LXC], [lxc >= 2.0.0], [lxc=true], [lxc=false]) +AM_CONDITIONAL(BLACKBOX_TESTS, test "$cmocka" = true -a "$lxc" = true) + dnl Install test binaries AC_ARG_ENABLE([install_tests], [AS_HELP_STRING([--enable-install-tests], [include test binaries in installation])], diff --git a/test/Makefile.am b/test/Makefile.am index 77fd5ef1..dce37476 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -10,7 +10,9 @@ TESTS = \ sign-verify.test \ trio.test +if BLACKBOX_TESTS SUBDIRS = blackbox +endif dist_check_SCRIPTS = $(TESTS) diff --git a/test/blackbox/run_blackbox_tests/Makefile.am b/test/blackbox/run_blackbox_tests/Makefile.am index 5b6877df..f5691ea4 100644 --- a/test/blackbox/run_blackbox_tests/Makefile.am +++ b/test/blackbox/run_blackbox_tests/Makefile.am @@ -47,6 +47,6 @@ run_blackbox_tests_SOURCES = \ test_cases_channel_shutdown.c \ test_cases_channel_conn.c -run_blackbox_tests_LDADD = ../../../src/libmeshlink.la -llxc -lcmocka -run_blackbox_tests_CFLAGS = -D_GNU_SOURCE +run_blackbox_tests_LDADD = ../../../src/libmeshlink.la $(LXC_LIBS) $(CMOCKA_LIBS) +run_blackbox_tests_CFLAGS = -D_GNU_SOURCE $(LXC_CFLAGS) $(CMOCKA_CFLAGS) -- 2.39.5