2023-02-11 17:27:36 +00:00
|
|
|
include(GoogleTest)
|
|
|
|
|
2023-01-01 19:49:48 +00:00
|
|
|
add_executable(libtransmission-test)
|
2021-08-16 01:45:50 +00:00
|
|
|
|
2023-01-01 19:49:48 +00:00
|
|
|
target_sources(libtransmission-test
|
|
|
|
PRIVATE
|
|
|
|
announce-list-test.cc
|
|
|
|
announcer-test.cc
|
|
|
|
announcer-udp-test.cc
|
|
|
|
benc-test.cc
|
|
|
|
bitfield-test.cc
|
|
|
|
block-info-test.cc
|
|
|
|
blocklist-test.cc
|
|
|
|
buffer-test.cc
|
|
|
|
clients-test.cc
|
|
|
|
completion-test.cc
|
|
|
|
copy-test.cc
|
|
|
|
crypto-test-ref.h
|
|
|
|
crypto-test.cc
|
|
|
|
error-test.cc
|
|
|
|
dht-test.cc
|
|
|
|
file-piece-map-test.cc
|
|
|
|
file-test.cc
|
|
|
|
getopt-test.cc
|
|
|
|
handshake-test.cc
|
|
|
|
history-test.cc
|
|
|
|
json-test.cc
|
|
|
|
lpd-test.cc
|
|
|
|
magnet-metainfo-test.cc
|
|
|
|
makemeta-test.cc
|
|
|
|
move-test.cc
|
|
|
|
net-test.cc
|
|
|
|
open-files-test.cc
|
|
|
|
peer-mgr-active-requests-test.cc
|
|
|
|
peer-mgr-wishlist-test.cc
|
|
|
|
peer-msgs-test.cc
|
|
|
|
platform-test.cc
|
|
|
|
quark-test.cc
|
|
|
|
remove-test.cc
|
|
|
|
rename-test.cc
|
|
|
|
rpc-test.cc
|
|
|
|
session-test.cc
|
|
|
|
session-alt-speeds-test.cc
|
|
|
|
settings-test.cc
|
|
|
|
strbuf-test.cc
|
|
|
|
subprocess-test-script.cmd
|
|
|
|
subprocess-test.cc
|
|
|
|
test-fixtures.h
|
|
|
|
timer-test.cc
|
|
|
|
torrent-files-test.cc
|
|
|
|
torrent-magnet-test.cc
|
|
|
|
torrent-metainfo-test.cc
|
|
|
|
torrents-test.cc
|
|
|
|
utils-test.cc
|
|
|
|
variant-test.cc
|
|
|
|
watchdir-test.cc
|
|
|
|
web-utils-test.cc)
|
|
|
|
|
|
|
|
set_property(
|
|
|
|
TARGET libtransmission-test
|
|
|
|
PROPERTY FOLDER "tests")
|
2022-11-12 20:01:57 +00:00
|
|
|
|
2021-08-16 01:45:50 +00:00
|
|
|
target_compile_definitions(libtransmission-test
|
|
|
|
PRIVATE
|
2021-10-15 18:13:33 +00:00
|
|
|
-DLIBTRANSMISSION_TEST_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets"
|
2021-08-16 01:45:50 +00:00
|
|
|
__TRANSMISSION__)
|
|
|
|
|
|
|
|
target_compile_options(libtransmission-test
|
2023-01-01 19:49:48 +00:00
|
|
|
PRIVATE $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wno-sign-compare>) # patches welcomed
|
2021-08-16 01:45:50 +00:00
|
|
|
|
|
|
|
target_link_libraries(libtransmission-test
|
|
|
|
PRIVATE
|
|
|
|
${TR_NAME}
|
2023-01-02 16:23:51 +00:00
|
|
|
gtestall
|
|
|
|
dht::dht
|
|
|
|
fmt::fmt-header-only
|
|
|
|
libevent::event
|
|
|
|
WideInteger::WideInteger)
|
2021-08-16 01:45:50 +00:00
|
|
|
|
2023-03-11 12:42:56 +00:00
|
|
|
if(NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
|
|
|
|
gtest_discover_tests(libtransmission-test
|
|
|
|
TEST_PREFIX "LT.")
|
|
|
|
else()
|
|
|
|
add_test(
|
|
|
|
NAME libtransmission-test
|
|
|
|
COMMAND libtransmission-test)
|
|
|
|
endif()
|
2020-08-11 18:11:55 +00:00
|
|
|
|
|
|
|
add_custom_command(
|
2021-08-16 01:45:50 +00:00
|
|
|
TARGET libtransmission-test
|
|
|
|
PRE_BUILD
|
|
|
|
COMMAND
|
2023-01-01 19:49:48 +00:00
|
|
|
${CMAKE_COMMAND}
|
|
|
|
-E copy_if_different
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/subprocess-test-script.cmd
|
|
|
|
$<TARGET_FILE_DIR:libtransmission-test>/subprocess-test.cmd)
|
|
|
|
|
|
|
|
add_executable(subprocess-test)
|
2021-08-16 01:45:50 +00:00
|
|
|
|
2023-01-01 19:49:48 +00:00
|
|
|
target_sources(subprocess-test
|
|
|
|
PRIVATE
|
|
|
|
subprocess-test-program.cc)
|
2021-08-16 01:45:50 +00:00
|
|
|
|
2023-01-01 19:49:48 +00:00
|
|
|
set_property(
|
|
|
|
TARGET subprocess-test
|
|
|
|
PROPERTY FOLDER "tests")
|
2022-11-12 20:01:57 +00:00
|
|
|
|
2021-08-16 01:45:50 +00:00
|
|
|
target_include_directories(subprocess-test
|
|
|
|
PRIVATE
|
|
|
|
${CMAKE_SOURCE_DIR}/libtransmission)
|
|
|
|
|
|
|
|
target_link_libraries(subprocess-test
|
|
|
|
PRIVATE
|
|
|
|
${TR_NAME})
|
|
|
|
|
|
|
|
add_dependencies(libtransmission-test
|
|
|
|
subprocess-test)
|