commit f4c3d7b42aef81fc3e092fc0e9b7e453fcd5e31d
parent df1bc0dda96b1ebf8b014610cf740d112495e9c0
Author: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
Date: Wed, 14 Jun 2023 22:52:38 +0200
Fixes #246: Use rtosc's liblo_server class from tests
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt
@@ -7,7 +7,7 @@ function(quick_test test_name link)
add_executable(${test_name} "${test_name}.cpp")
add_test(NAME ${test_name}
COMMAND ${test_name})
- target_link_libraries(${test_name} ${link} ${ARGN})
+ target_link_libraries(${test_name} ${link} ${ARGN})
endfunction()
#for tests looking for files stored in the source dir
@@ -64,10 +64,12 @@ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
target_link_libraries(ins-test ${test_lib} rt)
if(LIBLO_FOUND)
- quick_test(PortChecker zynaddsubfx_core zynaddsubfx_nio
+ quick_test(PortChecker lo-server zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
${PLATFORM_LIBRARIES})
+ target_include_directories(PortChecker PRIVATE ${RTOSC_TEST_INCLUDE_DIR})
+ target_link_directories(PortChecker PRIVATE ${RTOSC_TEST_LIB_DIR})
endif()
add_executable(save-osc SaveOSC.cpp)
target_link_libraries(save-osc
diff --git a/src/Tests/PortChecker.cpp b/src/Tests/PortChecker.cpp
@@ -7,6 +7,7 @@
#include <rtosc/thread-link.h>
#include <rtosc/rtosc-time.h>
#include <rtosc/port-checker.h>
+#include <liblo-server.h> // from rtosc's test directory
#include "../Misc/Master.h"
#include "../Misc/MiddleWare.h"
@@ -88,7 +89,9 @@ class PortChecker
bool ok;
try {
- rtosc::port_checker pc;
+ int timeout_msecs = 50;
+ rtosc::liblo_server sender(timeout_msecs), other(timeout_msecs);
+ rtosc::port_checker pc(&sender, &other);
ok = pc(mw->getServerPort());
if(!pc.print_sanity_checks())