Rename test_bdecode_performance to bdecode_benchmark, fix CMake issues.
It's not a test as such, since it's got its own main() that takes arguments, doesn't return a result that can be directly compared against expected results, and doesn't make use of the test_common infrastructure. The CMake build attempts to build all files named test_*.cpp with test_common, whose main() and load_file() symbols clash with those that the benchmark provides. Instead of making an exception, let's rename it to something that doesn't start with "test_". Its usage message even claims it's called bdecode_benchmark, so we use that. Also, complete the file listing for test_common in CMake and use an OBJECT pseudo-library there instead of STATIC. It's just as good and jives better with having symbols provided by the executable. (Follow-up patch in the works to provide Asio symbols that way.) test_natpmp is a proper test but doesn't currently build, so exclude it from the build for now.
This commit is contained in:
parent
a699cfae7e
commit
991f0c2a45
|
@ -362,22 +362,23 @@ configure_file(examples/run_cmake.sh.in examples/run_cmake.sh)
|
||||||
|
|
||||||
# === build tests ===
|
# === build tests ===
|
||||||
if(build_tests)
|
if(build_tests)
|
||||||
FILE(GLOB tests RELATIVE "${PROJECT_SOURCE_DIR}" "test/test_*.cpp")
|
file(GLOB tests RELATIVE "${PROJECT_SOURCE_DIR}" "test/test_*.cpp")
|
||||||
add_library(test_common STATIC test/main.cpp test/setup_transfer.cpp
|
list(REMOVE_ITEM tests "test/test_natpmp.cpp") # doesn't build at time of writing
|
||||||
test/dht_server.cpp test/udp_tracker.cpp test/peer_server.cpp
|
list(REMOVE_ITEM tests "test/test_utils.cpp") # helper file, not a test
|
||||||
test/web_seed_suite.cpp test/test_utils.cpp)
|
|
||||||
|
add_library(test_common OBJECT test/main.cpp test/test.cpp
|
||||||
|
test/setup_transfer.cpp test/dht_server.cpp test/udp_tracker.cpp
|
||||||
|
test/peer_server.cpp test/web_seed_suite.cpp test/swarm_suite.cpp
|
||||||
|
test/test_utils.cpp)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
foreach(s ${tests})
|
foreach(s ${tests})
|
||||||
get_filename_component (sn ${s} NAME_WE)
|
get_filename_component (sn ${s} NAME_WE)
|
||||||
add_executable(${sn} ${s})
|
add_executable(${sn} ${s} $<TARGET_OBJECTS:test_common>)
|
||||||
target_link_libraries(${sn} torrent-rasterbar test_common)
|
target_link_libraries(${sn} torrent-rasterbar)
|
||||||
add_test(${sn} ${s})
|
add_test(${sn} ${s})
|
||||||
endforeach(s)
|
endforeach(s)
|
||||||
|
|
||||||
# add_executable(test_upnp test/test_upnp.cpp)
|
add_executable(bdecode_benchmark test/bdecode_benchmark.cpp)
|
||||||
# target_link_libraries(test_upnp torrent-rasterbar)
|
target_link_libraries(bdecode_benchmark torrent-rasterbar)
|
||||||
|
|
||||||
# add_executable(test_natpmp test/test_natpmp.cpp)
|
|
||||||
# target_link_libraries(test_natpmp torrent-rasterbar)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -9,7 +9,7 @@ exe test_natpmp : test_natpmp.cpp /torrent//torrent
|
||||||
exe enum_if : enum_if.cpp /torrent//torrent
|
exe enum_if : enum_if.cpp /torrent//torrent
|
||||||
: <threading>multi <debug-iterators>on <invariant-checks>full ;
|
: <threading>multi <debug-iterators>on <invariant-checks>full ;
|
||||||
|
|
||||||
exe bdecode_benchmark : test_bdecode_performance.cpp /torrent//torrent
|
exe bdecode_benchmark : bdecode_benchmark.cpp /torrent//torrent
|
||||||
: <variant>release ;
|
: <variant>release ;
|
||||||
|
|
||||||
explicit test_natpmp ;
|
explicit test_natpmp ;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
||||||
test_programs = \
|
test_programs = \
|
||||||
|
bdecode_benchmark \
|
||||||
test_primitives \
|
test_primitives \
|
||||||
test_recheck \
|
test_recheck \
|
||||||
test_stat_cache \
|
test_stat_cache \
|
||||||
|
@ -8,7 +9,6 @@ test_programs = \
|
||||||
test_privacy \
|
test_privacy \
|
||||||
test_priority \
|
test_priority \
|
||||||
test_auto_unchoke \
|
test_auto_unchoke \
|
||||||
test_bdecode_performance \
|
|
||||||
test_checking \
|
test_checking \
|
||||||
test_fast_extension \
|
test_fast_extension \
|
||||||
test_http_connection \
|
test_http_connection \
|
||||||
|
@ -158,13 +158,13 @@ test_primitives_SOURCES = \
|
||||||
test_dos_blocker.cpp \
|
test_dos_blocker.cpp \
|
||||||
test_upnp.cpp
|
test_upnp.cpp
|
||||||
|
|
||||||
|
bdecode_benchmark_SOURCES = bdecode_benchmark.cpp
|
||||||
test_recheck_SOURCES = test_recheck.cpp
|
test_recheck_SOURCES = test_recheck.cpp
|
||||||
test_stat_cache_SOURCES = test_stat_cache.cpp
|
test_stat_cache_SOURCES = test_stat_cache.cpp
|
||||||
test_file_SOURCES = test_file.cpp
|
test_file_SOURCES = test_file.cpp
|
||||||
test_privacy_SOURCES = test_privacy.cpp
|
test_privacy_SOURCES = test_privacy.cpp
|
||||||
test_priority_SOURCES = test_priority.cpp
|
test_priority_SOURCES = test_priority.cpp
|
||||||
test_auto_unchoke_SOURCES = test_auto_unchoke.cpp
|
test_auto_unchoke_SOURCES = test_auto_unchoke.cpp
|
||||||
test_bdecode_performance_SOURCES = test_bdecode_performance.cpp
|
|
||||||
test_checking_SOURCES = test_checking.cpp
|
test_checking_SOURCES = test_checking.cpp
|
||||||
test_fast_extension_SOURCES = test_fast_extension.cpp
|
test_fast_extension_SOURCES = test_fast_extension.cpp
|
||||||
test_http_connection_SOURCES = test_http_connection.cpp
|
test_http_connection_SOURCES = test_http_connection.cpp
|
||||||
|
|
Loading…
Reference in New Issue