From 6b6a5d30a87c3a46bdf020acf24ba8a7a74dbcc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 15 Aug 2023 15:53:33 -0400 Subject: [PATCH] cmake/tests: add DHTNET_TESTABLE Change-Id: Id327a60cbd1afb57a35eedfcb73ff972acf6fb4b --- CMakeLists.txt | 3 +++ include/multiplexed_socket.h | 4 ++-- src/multiplexed_socket.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a458489..4a72860 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,9 @@ target_include_directories(dhtnet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> ) +if (BUILD_TESTING) + target_compile_definitions(dhtnet PUBLIC DHTNET_TESTABLE) +endif() target_compile_definitions(dhtnet PUBLIC PJ_AUTOCONF=1) # set_target_properties(dhtnet PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/${dhtnet_HEADERS}") diff --git a/include/multiplexed_socket.h b/include/multiplexed_socket.h index 1d37166..a090a8c 100644 --- a/include/multiplexed_socket.h +++ b/include/multiplexed_socket.h @@ -162,7 +162,7 @@ public: void eraseChannel(uint16_t channel); -#ifdef LIBJAMI_TESTABLE +#ifdef DHTNET_TESTABLE /** * Check if we can send beacon on the socket */ @@ -341,7 +341,7 @@ public: */ std::shared_ptr<dht::crypto::Certificate> peerCertificate() const; -#ifdef LIBJAMI_TESTABLE +#ifdef DHTNET_TESTABLE std::shared_ptr<MultiplexedSocket> underlyingSocket() const; #endif diff --git a/src/multiplexed_socket.cpp b/src/multiplexed_socket.cpp index 9c6d59d..97c9e1c 100644 --- a/src/multiplexed_socket.cpp +++ b/src/multiplexed_socket.cpp @@ -718,7 +718,7 @@ MultiplexedSocket::peerCertificate() const return pimpl_->endpoint->peerCertificate(); } -#ifdef LIBJAMI_TESTABLE +#ifdef DHTNET_TESTABLE bool MultiplexedSocket::canSendBeacon() const { @@ -1038,7 +1038,7 @@ ChannelSocket::onRecv(std::vector<uint8_t>&& pkt) pimpl_->cv.notify_all(); } -#ifdef LIBJAMI_TESTABLE +#ifdef DHTNET_TESTABLE std::shared_ptr<MultiplexedSocket> ChannelSocket::underlyingSocket() const { -- GitLab