|
1 | 1 | include_directories(..) |
2 | 2 | include_directories(../../modules/ModuleCmd) |
3 | 3 |
|
4 | | -# Test testBeacon |
5 | | -add_executable(testBeacon |
6 | | -testBeacon.cpp |
7 | | -../Beacon.cpp |
8 | | -../../listener/Listener.cpp |
9 | | -../../listener/ListenerTcp.cpp |
10 | | -../../listener/ListenerSmb.cpp |
11 | | -../../../thirdParty/base64/base64.cpp) |
12 | | -IF (WIN32) |
13 | | - set_property(TARGET testBeacon PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
14 | | - target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule SocksServer ) |
15 | | -ELSE() |
16 | | - target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule SocksServer ) |
17 | | -ENDIF() |
18 | | -add_custom_command(TARGET testBeacon POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
19 | | -$<TARGET_FILE:testBeacon> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeacon>") |
20 | | -add_test(NAME testBeacon COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeacon>") |
21 | | - |
22 | | -# Test testBeaconDns |
23 | | -add_executable(testBeaconDns |
24 | | -testBeaconDns.cpp |
25 | | -../Beacon.cpp |
26 | | -../../listener/Listener.cpp |
27 | | -../../listener/ListenerTcp.cpp |
28 | | -../../listener/ListenerSmb.cpp |
29 | | -../../../thirdParty/base64/base64.cpp) |
30 | | -IF (WIN32) |
31 | | - set_property(TARGET testBeaconDns PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
32 | | - target_link_libraries(testBeaconDns SocketHandler Dnscommunication PipeHandler MemoryModule SocksServer ) |
33 | | -ELSE() |
34 | | - target_link_libraries(testBeaconDns SocketHandler Dnscommunication PipeHandler MemoryModule SocksServer ) |
35 | | -ENDIF() |
36 | | -add_custom_command(TARGET testBeaconDns POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
37 | | -$<TARGET_FILE:testBeaconDns> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconDns>") |
38 | | -add_test(NAME testBeaconDns COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconDns>") |
39 | | - |
40 | | -# Test testBeaconGithub |
41 | | -add_executable(testBeaconGithub |
42 | | -testBeaconGithub.cpp |
43 | | -../Beacon.cpp |
44 | | -../../listener/Listener.cpp |
45 | | -../../listener/ListenerTcp.cpp |
46 | | -../../listener/ListenerSmb.cpp |
47 | | -../../../thirdParty/base64/base64.cpp) |
48 | | -IF (WIN32) |
49 | | - set_property(TARGET testBeaconGithub PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
50 | | - target_link_libraries(testBeaconGithub SocketHandler PipeHandler MemoryModule SocksServer ) |
51 | | -ELSE() |
52 | | - target_link_libraries(testBeaconGithub SocketHandler PipeHandler MemoryModule SocksServer httplib::httplib) |
53 | | -ENDIF() |
54 | | -add_custom_command(TARGET testBeaconGithub POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
55 | | -$<TARGET_FILE:testBeaconGithub> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconGithub>") |
56 | | -add_test(NAME testBeaconGithub COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconGithub>") |
57 | | - |
58 | | -# Test testBeaconHttp |
59 | | -add_executable(testBeaconHttp |
60 | | -testBeaconHttp.cpp |
61 | | -../Beacon.cpp |
62 | | -../../listener/Listener.cpp |
63 | | -../../listener/ListenerTcp.cpp |
64 | | -../../listener/ListenerSmb.cpp |
65 | | -../../../thirdParty/base64/base64.cpp) |
66 | | -IF (WIN32) |
67 | | - set_property(TARGET testBeaconHttp PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
68 | | - target_link_libraries(testBeaconHttp SocketHandler PipeHandler MemoryModule SocksServer ) |
69 | | -ELSE() |
70 | | - target_link_libraries(testBeaconHttp SocketHandler PipeHandler MemoryModule SocksServer httplib::httplib) |
71 | | -ENDIF() |
72 | | -add_custom_command(TARGET testBeaconHttp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
73 | | -$<TARGET_FILE:testBeaconHttp> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconHttp>") |
74 | | -add_test(NAME testBeaconHttp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconHttp>") |
75 | | - |
76 | | -# Test testBeaconSmb |
77 | | -add_executable(testBeaconSmb |
78 | | -testBeaconSmb.cpp |
79 | | -../Beacon.cpp |
80 | | -../../listener/Listener.cpp |
81 | | -../../listener/ListenerTcp.cpp |
82 | | -../../listener/ListenerSmb.cpp |
83 | | -../../../thirdParty/base64/base64.cpp) |
84 | | -IF (WIN32) |
85 | | - set_property(TARGET testBeaconSmb PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
86 | | - target_link_libraries(testBeaconSmb SocketHandler PipeHandler MemoryModule SocksServer ) |
87 | | -ELSE() |
88 | | - target_link_libraries(testBeaconSmb SocketHandler PipeHandler MemoryModule SocksServer ) |
89 | | -ENDIF() |
90 | | -add_custom_command(TARGET testBeaconSmb POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
91 | | -$<TARGET_FILE:testBeaconSmb> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconSmb>") |
92 | | -add_test(NAME testBeaconSmb COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconSmb>") |
93 | | - |
94 | | -# Test testBeaconTcp |
95 | | -add_executable(testBeaconTcp |
96 | | -testBeaconTcp.cpp |
97 | | -../Beacon.cpp |
98 | | -../../listener/Listener.cpp |
99 | | -../../listener/ListenerTcp.cpp |
100 | | -../../listener/ListenerSmb.cpp |
101 | | -../../../thirdParty/base64/base64.cpp) |
102 | | -IF (WIN32) |
103 | | - set_property(TARGET testBeaconTcp PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") |
104 | | - target_link_libraries(testBeaconTcp SocketHandler PipeHandler MemoryModule SocksServer ) |
105 | | -ELSE() |
106 | | - target_link_libraries(testBeaconTcp SocketHandler PipeHandler MemoryModule SocksServer ) |
107 | | -ENDIF() |
108 | | -add_custom_command(TARGET testBeaconTcp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy |
109 | | -$<TARGET_FILE:testBeaconTcp> "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconTcp>") |
110 | | -add_test(NAME testBeaconTcp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$<TARGET_FILE_NAME:testBeaconTcp>") |
| 4 | +# Unit tests using Catch2 |
| 5 | +add_executable(beacon_unit_tests |
| 6 | + testBeacon.cpp |
| 7 | + ../Beacon.cpp |
| 8 | + ../../listener/Listener.cpp |
| 9 | + ../../listener/ListenerTcp.cpp |
| 10 | + ../../listener/ListenerSmb.cpp |
| 11 | + ../../../thirdParty/base64/base64.cpp) |
| 12 | + |
| 13 | +target_link_libraries(beacon_unit_tests |
| 14 | + Catch2::Catch2WithMain |
| 15 | + nlohmann_json::nlohmann_json |
| 16 | + SocketHandler |
| 17 | + PipeHandler |
| 18 | + MemoryModule |
| 19 | + SocksServer) |
| 20 | + |
| 21 | +add_test(NAME beacon_unit_tests COMMAND beacon_unit_tests) |
| 22 | + |
| 23 | +# Functional tests for transport variants (simple main) |
| 24 | +add_executable(testBeaconDns |
| 25 | + testBeaconDns.cpp |
| 26 | + ../Beacon.cpp |
| 27 | + ../BeaconDns.cpp |
| 28 | + ../../listener/Listener.cpp |
| 29 | + ../../listener/ListenerTcp.cpp |
| 30 | + ../../listener/ListenerSmb.cpp |
| 31 | + ../../../thirdParty/base64/base64.cpp) |
| 32 | + |
| 33 | +target_link_libraries(testBeaconDns |
| 34 | + nlohmann_json::nlohmann_json |
| 35 | + SocketHandler |
| 36 | + Dnscommunication |
| 37 | + PipeHandler |
| 38 | + MemoryModule |
| 39 | + SocksServer) |
| 40 | + |
| 41 | +add_test(NAME testBeaconDns COMMAND testBeaconDns) |
| 42 | + |
| 43 | +add_executable(testBeaconGithub |
| 44 | + testBeaconGithub.cpp |
| 45 | + ../Beacon.cpp |
| 46 | + ../BeaconGithub.cpp |
| 47 | + ../../listener/Listener.cpp |
| 48 | + ../../listener/ListenerTcp.cpp |
| 49 | + ../../listener/ListenerSmb.cpp |
| 50 | + ../../../thirdParty/base64/base64.cpp) |
| 51 | + |
| 52 | +target_link_libraries(testBeaconGithub |
| 53 | + nlohmann_json::nlohmann_json |
| 54 | + SocketHandler |
| 55 | + PipeHandler |
| 56 | + MemoryModule |
| 57 | + SocksServer |
| 58 | + httplib::httplib) |
| 59 | + |
| 60 | +add_test(NAME testBeaconGithub COMMAND testBeaconGithub) |
| 61 | + |
| 62 | +add_executable(testBeaconHttp |
| 63 | + testBeaconHttp.cpp |
| 64 | + ../Beacon.cpp |
| 65 | + ../BeaconHttp.cpp |
| 66 | + ../../listener/Listener.cpp |
| 67 | + ../../listener/ListenerTcp.cpp |
| 68 | + ../../listener/ListenerSmb.cpp |
| 69 | + ../../../thirdParty/base64/base64.cpp) |
| 70 | + |
| 71 | +target_link_libraries(testBeaconHttp |
| 72 | + nlohmann_json::nlohmann_json |
| 73 | + SocketHandler |
| 74 | + PipeHandler |
| 75 | + MemoryModule |
| 76 | + SocksServer |
| 77 | + httplib::httplib) |
| 78 | + |
| 79 | +add_test(NAME testBeaconHttp COMMAND testBeaconHttp) |
| 80 | + |
| 81 | +add_executable(testBeaconSmb |
| 82 | + testBeaconSmb.cpp |
| 83 | + ../Beacon.cpp |
| 84 | + ../BeaconSmb.cpp |
| 85 | + ../../listener/Listener.cpp |
| 86 | + ../../listener/ListenerTcp.cpp |
| 87 | + ../../listener/ListenerSmb.cpp |
| 88 | + ../../../thirdParty/base64/base64.cpp) |
| 89 | + |
| 90 | +target_link_libraries(testBeaconSmb |
| 91 | + nlohmann_json::nlohmann_json |
| 92 | + SocketHandler |
| 93 | + PipeHandler |
| 94 | + MemoryModule |
| 95 | + SocksServer) |
| 96 | + |
| 97 | +add_test(NAME testBeaconSmb COMMAND testBeaconSmb) |
| 98 | + |
| 99 | +add_executable(testBeaconTcp |
| 100 | + testBeaconTcp.cpp |
| 101 | + ../Beacon.cpp |
| 102 | + ../BeaconTcp.cpp |
| 103 | + ../../listener/Listener.cpp |
| 104 | + ../../listener/ListenerTcp.cpp |
| 105 | + ../../listener/ListenerSmb.cpp |
| 106 | + ../../../thirdParty/base64/base64.cpp) |
| 107 | + |
| 108 | +target_link_libraries(testBeaconTcp |
| 109 | + nlohmann_json::nlohmann_json |
| 110 | + SocketHandler |
| 111 | + PipeHandler |
| 112 | + MemoryModule |
| 113 | + SocksServer) |
| 114 | + |
| 115 | +add_test(NAME testBeaconTcp COMMAND testBeaconTcp) |
0 commit comments