Skip to content

Commit

Permalink
apply fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
egecetin committed Dec 28, 2024
1 parent 9ca0e8b commit 7145c60
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 102 deletions.
112 changes: 39 additions & 73 deletions 3rdParty/MemPlumber/MemPlumber/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,73 +1,39 @@
cmake_minimum_required (VERSION 3.0)

# Build options
option(TEST_VERBOSE "Run tests in verbose mode" OFF)
option(MEM_CHECK_VERBOSE "Run mem check in verbose mode" OFF)

if(TEST_VERBOSE)
add_definitions(-DTEST_VERBOSE)
endif()

if(MEM_CHECK_VERBOSE)
add_definitions(-DMEM_CHECK_VERBOSE)
endif()

add_subdirectory(test-lib)

add_executable(basic-tests
test-macros.h
basic-tests.cpp
)

add_executable(static-var-tests
test-macros.h
static-var-tests.cpp
)

add_executable(inner-lib-tests
test-macros.h
inner-lib-tests.cpp
)

add_executable(load-tests
test-macros.h
load-tests.cpp
)

target_link_libraries(basic-tests PUBLIC
memplumber
)

target_link_libraries(static-var-tests PUBLIC
memplumber
)

target_link_libraries(inner-lib-tests PUBLIC
memplumber
TestLib
)

target_link_libraries(load-tests PUBLIC
memplumber
TestLib
)

add_test(
NAME basic-tests
COMMAND $<TARGET_FILE:basic-tests>
)

add_test(
NAME static-var-tests
COMMAND $<TARGET_FILE:static-var-tests>
)

add_test(
NAME inner-lib-tests
COMMAND $<TARGET_FILE:inner-lib-tests>
)

add_test(
NAME load-tests
COMMAND $<TARGET_FILE:load-tests>
)
cmake_minimum_required(VERSION 3.0)

# Build options
option(TEST_VERBOSE "Run tests in verbose mode" OFF)
option(MEM_CHECK_VERBOSE "Run mem check in verbose mode" OFF)

if(TEST_VERBOSE)
add_definitions(-DTEST_VERBOSE)
endif()

if(MEM_CHECK_VERBOSE)
add_definitions(-DMEM_CHECK_VERBOSE)
endif()

add_subdirectory(test-lib)

add_executable(basic-tests test-macros.h basic-tests.cpp)

add_executable(static-var-tests test-macros.h static-var-tests.cpp)

add_executable(inner-lib-tests test-macros.h inner-lib-tests.cpp)

add_executable(load-tests test-macros.h load-tests.cpp)

target_link_libraries(basic-tests PUBLIC memplumber)

target_link_libraries(static-var-tests PUBLIC memplumber)

target_link_libraries(inner-lib-tests PUBLIC memplumber TestLib)

target_link_libraries(load-tests PUBLIC memplumber TestLib)

add_test(NAME basic-tests COMMAND $<TARGET_FILE:basic-tests>)

add_test(NAME static-var-tests COMMAND $<TARGET_FILE:static-var-tests>)

add_test(NAME inner-lib-tests COMMAND $<TARGET_FILE:inner-lib-tests>)

add_test(NAME load-tests COMMAND $<TARGET_FILE:load-tests>)
11 changes: 4 additions & 7 deletions 3rdParty/MemPlumber/MemPlumber/Tests/test-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cmake_minimum_required (VERSION 3.0)
project (TestLib CXX)

add_library (TestLib
test-lib.cpp
test-lib.h
)
cmake_minimum_required(VERSION 3.0)
project(TestLib CXX)

add_library(TestLib test-lib.cpp test-lib.h)
15 changes: 4 additions & 11 deletions Tests/Packet++Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ add_executable(
Tests/VrrpTest.cpp
Tests/WakeOnLanTests.cpp
Tests/WireGuardTests.cpp
Utils/TestUtils.cpp)
Utils/TestUtils.cpp
)

target_link_libraries(
Packet++Test
PUBLIC memplumber
Packet++
PcppTestFramework
EndianPortable)
target_link_libraries(Packet++Test PUBLIC memplumber Packet++ PcppTestFramework EndianPortable)

if(MSVC)
# This executable requires getopt.h not available on VStudio
Expand All @@ -60,7 +56,4 @@ endif()
set_property(TARGET Packet++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Bin")
set_property(TARGET Packet++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Bin")
set_property(TARGET Packet++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Bin")
add_test(
NAME Packet++Test
COMMAND $<TARGET_FILE:Packet++Test>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/)
add_test(NAME Packet++Test COMMAND $<TARGET_FILE:Packet++Test> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/)
15 changes: 4 additions & 11 deletions Tests/Pcap++Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ add_executable(
Tests/RawSocketTests.cpp
Tests/SystemUtilsTests.cpp
Tests/TcpReassemblyTests.cpp
Tests/XdpTests.cpp)
Tests/XdpTests.cpp
)

target_link_libraries(
Pcap++Test
PUBLIC memplumber
Pcap++
PcppTestFramework
EndianPortable)
target_link_libraries(Pcap++Test PUBLIC memplumber Pcap++ PcppTestFramework EndianPortable)

if(MSVC)
# This executable requires getopt.h not available on VStudio
Expand All @@ -33,7 +29,4 @@ set_property(TARGET Pcap++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURREN
set_property(TARGET Pcap++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Bin")
set_property(TARGET Pcap++Test PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Bin")

add_test(
NAME Pcap++Test
COMMAND $<TARGET_FILE:Pcap++Test> -n
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/)
add_test(NAME Pcap++Test COMMAND $<TARGET_FILE:Pcap++Test> -n WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/)

0 comments on commit 7145c60

Please sign in to comment.