This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/test/glimpse_detector/CMakeLists.txt
2024-08-21 18:04:16 +08:00

53 lines
3.3 KiB
CMake

add_executable(gtest_glimpse_detector gtest_glimpse_detector_main.cpp)
target_include_directories(gtest_glimpse_detector PRIVATE ${CMAKE_SOURCE_DIR}/deps/)
target_include_directories(gtest_glimpse_detector PRIVATE ${CMAKE_SOURCE_DIR}/decoders/glimpse_detector)
target_link_libraries(
gtest_glimpse_detector PRIVATE stellar_devel glimpse_detector cjson-static
dl "-rdynamic"
gtest gmock
)
target_link_libraries(gtest_glimpse_detector PRIVATE -Wl,--whole-archive glimpse_detector -Wl,--no-whole-archive)
set(TEST_MAIN ${CMAKE_CURRENT_BINARY_DIR}/gtest_glimpse_detector)
add_test(NAME GLIMPSE_TEST_SETUP COMMAND sh -c "
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/conf &&
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/plugin &&
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/log &&
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tsgconf &&
cp ${CMAKE_SOURCE_DIR}/conf/stellar.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/spec.toml ${CMAKE_CURRENT_BINARY_DIR}/plugin/ &&
cp ${CMAKE_SOURCE_DIR}/conf/log.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/tsg_l7_protocol.conf ${CMAKE_CURRENT_BINARY_DIR}/tsgconf/ &&
tomlq -t -i '.packet_io.dumpfile_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml &&
tomlq -t -i '.packet_io.mode=\"dumpfilelist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml
")
set_tests_properties(GLIMPSE_TEST_SETUP
PROPERTIES FIXTURES_SETUP GLIMPSE_TEST_SETUP)
add_test(NAME GLIMPSE_TEST_APP
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/app_pcap -type f | sort -V | ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/app_pcap.json")
add_test(NAME GLIMPSE_TEST_DNS
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/dns_pcap -type f | sort -V | ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/dns_pcap.json")
add_test(NAME GLIMPSE_TEST_MIXED
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/mixed_pcap -type f | sort -V |${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/mixed_pcap.json")
add_test(NAME GLIMPSE_TEST_OPENVPN
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/openvpn_pcap -type f | sort -V |${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/openvpn_pcap.json")
add_test(NAME GLIMPSE_TEST_PPP
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/ppp_pcap -type f | sort -V | ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/ppp_pcap.json")
add_test(NAME GLIMPSE_TEST_SOCKS
COMMAND sh -c "find ${CMAKE_CURRENT_SOURCE_DIR}/test_pcap/socks_pcap -type f | sort -V | ${TEST_MAIN} ${CMAKE_CURRENT_SOURCE_DIR}/test_expect/socks_pcap.json")
set_tests_properties(GLIMPSE_TEST_APP GLIMPSE_TEST_DNS GLIMPSE_TEST_MIXED GLIMPSE_TEST_OPENVPN GLIMPSE_TEST_PPP GLIMPSE_TEST_SOCKS
PROPERTIES FIXTURES_REQUIRED GLIMPSE_TEST_SETUP)