diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 00f1430c7a..b38d7e862f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -58,7 +58,6 @@ jobs: --with-python=3 --with-systemd-journal=no --disable-smtp - --disable-grpc --disable-java --disable-java-modules --disable-mqtt diff --git a/CMakeLists.txt b/CMakeLists.txt index deb298b208..4e0ca72395 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -377,10 +377,6 @@ endif() include(add_tests) -# The inclusion of CTest triggers enable_testing() -# CMake will generate tests only if the enable_testing() command has been invoked. -# The CTest module invokes the command automatically when the BUILD_TESTING option is ON. - if (BUILD_TESTING) if (NOT CRITERION_FOUND) message(FATAL_ERROR "BUILD_TESTING enabled without criterion detected!") @@ -388,6 +384,10 @@ if (BUILD_TESTING) set(CTEST_ENVIRONMENT "G_SLICE=always-malloc,debug-blocks" "G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly") + + # The inclusion of CTest triggers enable_testing() + # CMake will generate tests only if the enable_testing() command has been invoked. + # The CTest module invokes the command automatically when the BUILD_TESTING option is ON. include(CTest) # This flag might be a security issue, do not use in production code, unfortunately we still need it for criterion tests and the current mocking soution diff --git a/configure.ac b/configure.ac index 0e9d96c523..77c362ec27 100644 --- a/configure.ac +++ b/configure.ac @@ -2301,6 +2301,7 @@ AM_CONDITIONAL([HAVE_FMEMOPEN], [test x$ac_cv_func_fmemopen = xyes]) AM_CONDITIONAL([HAVE_JAVAH], [test -n "$JAVAH_BIN"]) AM_CONDITIONAL(ENABLE_IPV6, [test $enable_ipv6 = yes]) +AM_CONDITIONAL(OS_TYPE_MACOS, [test $ostype = "Darwin"]) AC_SUBST(PYTHON_VENV) AC_SUBST(PYTHON_VENV_DIR) diff --git a/contrib/Brewfile b/contrib/Brewfile index 4f4dd38ace..a9797418d2 100644 --- a/contrib/Brewfile +++ b/contrib/Brewfile @@ -26,4 +26,6 @@ brew "python@3", link: true, force: true brew "rabbitmq-c" brew "riemann-client" +brew "grpc" + brew "criterion" diff --git a/libtest/CMakeLists.txt b/libtest/CMakeLists.txt index 17ca1479ba..17872650f8 100644 --- a/libtest/CMakeLists.txt +++ b/libtest/CMakeLists.txt @@ -1,3 +1,7 @@ +if (NOT BUILD_TESTING) + return () +endif () + set(LIBTEST_HEADERS config_parse_lib.h fake-time.h diff --git a/modules/grpc/otel/tests/Makefile.am b/modules/grpc/otel/tests/Makefile.am index 706734d99b..281d3413df 100644 --- a/modules/grpc/otel/tests/Makefile.am +++ b/modules/grpc/otel/tests/Makefile.am @@ -1,5 +1,6 @@ if ENABLE_GRPC +if ! OS_TYPE_MACOS modules_grpc_otel_tests_TESTS = \ modules/grpc/otel/tests/test_otel_protobuf_parser \ modules/grpc/otel/tests/test_otel_protobuf_formatter \ @@ -7,6 +8,7 @@ modules_grpc_otel_tests_TESTS = \ modules/grpc/otel/tests/test_otel_filterx check_PROGRAMS += ${modules_grpc_otel_tests_TESTS} +endif modules_grpc_otel_tests_test_otel_protobuf_parser_SOURCES = \ modules/grpc/otel/tests/test-otel-protobuf-parser.cpp diff --git a/modules/kafka/CMakeLists.txt b/modules/kafka/CMakeLists.txt index 13997f7b54..adb8cfc093 100644 --- a/modules/kafka/CMakeLists.txt +++ b/modules/kafka/CMakeLists.txt @@ -1,23 +1,21 @@ -find_package(rdkafka 1.1.0) +if (NOT DEFINED ENABLE_KAFKA OR ENABLE_KAFKA) + find_package(rdkafka 1.1.0) +endif () -if (RDKAFKA_FOUND) - option(ENABLE_KAFKA "Enable kafka module" ON) -else() - option(ENABLE_KAFKA "Enable kafka module" OFF) -endif() +module_switch (ENABLE_KAFKA "Enable kafka module" RDKAFKA_FOUND) -if (NOT ENABLE_KAFKA) - return() -endif() +if (ENABLE_KAFKA AND NOT RDKAFKA_FOUND) + message (FATAL_ERROR "Kafka enabled but no librdkafka found") +endif () -if (NOT RDKAFKA_FOUND) - message(FATAL_ERROR "Kafka enabled but no librdkafka found") +if (NOT ENABLE_KAFKA) + return() endif() +check_symbol_exists (rd_kafka_init_transactions "librdkafka/rdkafka.h" SYSLOG_NG_HAVE_RD_KAFKA_INIT_TRANSACTIONS) set(CMAKE_REQUIRED_INCLUDES ${RDKAFKA_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${RDKAFKA_LIBRARY}) -check_symbol_exists(rd_kafka_init_transactions "librdkafka/rdkafka.h" SYSLOG_NG_HAVE_RD_KAFKA_INIT_TRANSACTIONS) set(KAFKA_SOURCES kafka-parser.c diff --git a/modules/mqtt/CMakeLists.txt b/modules/mqtt/CMakeLists.txt index faf4c92ec9..d0092a33ef 100644 --- a/modules/mqtt/CMakeLists.txt +++ b/modules/mqtt/CMakeLists.txt @@ -3,6 +3,11 @@ if (NOT DEFINED ENABLE_MQTT OR ENABLE_MQTT) endif() module_switch(ENABLE_MQTT "Enable mqtt" eclipse-paho-mqtt-c_FOUND) + +if (ENABLE_MQTT AND NOT eclipse-paho-mqtt-c_FOUND) + message (FATAL_ERROR "MQTT enabled but no eclipse-paho-mqtt-c library found") +endif () + if (NOT ENABLE_MQTT) return() endif()