2020-03-03 05:15:18 +01:00
|
|
|
if (WITH_HIVE)
|
2020-03-03 20:56:33 +01:00
|
|
|
add_custom_target(hive_build DEPENDS ${STATIC_LIB} pyllarp)
|
2020-03-03 05:15:18 +01:00
|
|
|
add_custom_target(hive ${CMAKE_COMMAND} -E
|
2020-03-03 06:37:05 +01:00
|
|
|
env PYTHONPATH="$ENV{PYTHONPATH}:${CMAKE_BINARY_DIR}/pybind"
|
2020-03-03 05:15:18 +01:00
|
|
|
${PYTHON_EXECUTABLE} -m pytest
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hive
|
|
|
|
DEPENDS
|
2020-03-03 20:56:33 +01:00
|
|
|
hive_build)
|
2020-03-03 05:15:18 +01:00
|
|
|
endif()
|
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
set(GTEST_EXE testAll)
|
|
|
|
set(CATCH_EXE catchAll)
|
2020-02-10 18:12:20 +01:00
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
# Old gtest-based tests; new tests should use Catch2, instead.
|
|
|
|
list(APPEND GTEST_SRC
|
2019-07-02 23:28:28 +02:00
|
|
|
config/test_llarp_config_ini.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
crypto/test_llarp_crypto_types.cpp
|
|
|
|
crypto/test_llarp_crypto.cpp
|
2019-12-09 20:29:33 +01:00
|
|
|
crypto/test_llarp_key_manager.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
dht/test_llarp_dht_bucket.cpp
|
|
|
|
dht/test_llarp_dht_explorenetworkjob.cpp
|
|
|
|
dht/test_llarp_dht_kademlia.cpp
|
|
|
|
dht/test_llarp_dht_key.cpp
|
|
|
|
dht/test_llarp_dht_node.cpp
|
|
|
|
dht/test_llarp_dht_tx.cpp
|
|
|
|
dht/test_llarp_dht_txowner.cpp
|
|
|
|
dns/test_llarp_dns_dns.cpp
|
|
|
|
exit/test_llarp_exit_context.cpp
|
|
|
|
link/test_llarp_link.cpp
|
2019-05-28 21:45:09 +02:00
|
|
|
llarp_test.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
net/test_llarp_net.cpp
|
2020-01-31 21:23:48 +01:00
|
|
|
router/test_llarp_router_version.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
routing/llarp_routing_transfer_traffic.cpp
|
|
|
|
routing/test_llarp_routing_obtainexitmessage.cpp
|
|
|
|
service/test_llarp_service_address.cpp
|
|
|
|
service/test_llarp_service_identity.cpp
|
2019-02-19 10:43:17 +01:00
|
|
|
test_libabyss.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
test_llarp_encrypted_frame.cpp
|
|
|
|
test_llarp_router_contact.cpp
|
2019-03-13 21:01:10 +01:00
|
|
|
test_md5.cpp
|
2019-09-01 14:58:27 +02:00
|
|
|
util/meta/test_llarp_util_memfn.cpp
|
|
|
|
util/meta/test_llarp_util_traits.cpp
|
2019-02-09 17:16:00 +01:00
|
|
|
util/test_llarp_util_aligned.cpp
|
|
|
|
util/test_llarp_util_bencode.cpp
|
|
|
|
util/test_llarp_util_encode.cpp
|
2020-01-21 19:21:11 +01:00
|
|
|
util/test_llarp_util_log_level.cpp
|
2019-09-01 15:26:16 +02:00
|
|
|
util/thread/test_llarp_util_queue_manager.cpp
|
|
|
|
util/thread/test_llarp_util_queue.cpp
|
|
|
|
util/thread/test_llarp_util_thread_pool.cpp
|
2019-02-09 18:48:34 +01:00
|
|
|
)
|
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
add_executable(${GTEST_EXE}
|
2019-02-09 18:48:34 +01:00
|
|
|
# helpers
|
|
|
|
main.cpp
|
|
|
|
crypto/mock_crypto.cpp
|
|
|
|
dht/mock_context.cpp
|
|
|
|
test_util.cpp
|
|
|
|
# actual test cases
|
2020-02-22 21:07:43 +01:00
|
|
|
${GTEST_SRC}
|
2019-02-09 18:48:34 +01:00
|
|
|
)
|
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
target_link_libraries(${GTEST_EXE} PUBLIC gmock gtest ${STATIC_LIB})
|
|
|
|
target_include_directories(${GTEST_EXE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
2019-02-09 17:16:00 +01:00
|
|
|
|
2020-02-23 20:35:25 +01:00
|
|
|
if(WIN32)
|
2020-02-22 21:07:43 +01:00
|
|
|
target_sources(${GTEST_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/win32/test.rc")
|
|
|
|
target_link_libraries(${GTEST_EXE} PUBLIC ws2_32 iphlpapi shlwapi)
|
2020-02-23 20:35:25 +01:00
|
|
|
endif()
|
2019-06-10 18:42:29 +02:00
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2020-02-22 21:07:43 +01:00
|
|
|
target_link_directories(${GTEST_EXE} PRIVATE /usr/local/lib)
|
2019-07-02 23:28:28 +02:00
|
|
|
endif()
|
2020-02-10 18:12:20 +01:00
|
|
|
|
2020-02-17 14:24:57 +01:00
|
|
|
add_subdirectory(Catch2)
|
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
add_executable(${CATCH_EXE}
|
2020-02-14 22:11:54 +01:00
|
|
|
nodedb/test_nodedb.cpp
|
2020-02-10 18:12:20 +01:00
|
|
|
path/test_path.cpp
|
2020-02-23 20:35:25 +01:00
|
|
|
util/test_llarp_util_bits.cpp
|
|
|
|
util/test_llarp_util_printer.cpp
|
2020-02-22 20:55:53 +01:00
|
|
|
util/test_llarp_util_str.cpp
|
2020-02-24 16:26:46 +01:00
|
|
|
util/test_llarp_util_decaying_hashset.cpp
|
2020-03-17 00:26:18 +01:00
|
|
|
config/test_llarp_config_definition.cpp
|
2020-03-17 22:17:35 +01:00
|
|
|
config/test_llarp_config_output.cpp
|
2020-05-08 19:23:21 +02:00
|
|
|
net/test_ip_address.cpp
|
|
|
|
net/test_sock_addr.cpp
|
2020-02-10 18:12:20 +01:00
|
|
|
check_main.cpp)
|
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
target_link_libraries(${CATCH_EXE} PUBLIC ${STATIC_LIB} Catch2::Catch2)
|
|
|
|
target_include_directories(${CATCH_EXE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
# Custom targets to invoke the different test suites:
|
|
|
|
add_custom_target(catch COMMAND ${CATCH_EXE})
|
|
|
|
add_custom_target(rungtest COMMAND ${GTEST_EXE})
|
2020-02-10 18:12:20 +01:00
|
|
|
|
2020-02-22 21:07:43 +01:00
|
|
|
# Add a custom "check" target that runs all the test suites:
|
|
|
|
add_custom_target(check DEPENDS rungtest catch)
|