created data directory in test directory for pcap files for IcmpPacket tests
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 19 Mar 2015 09:13:11 +0000 (10:13 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 19 Mar 2015 09:13:11 +0000 (10:13 +0100)
test/CMakeLists.test_icmppacket.txt
test/data/CMakeLists.txt [new file with mode: 0644]
test/data/icmp_echorequest.pcap [moved from test/test_icmppacket_echorequest.pcap with 100% similarity]
test/test_icmppacket.cpp

index 4f548b9..822ab62 100644 (file)
@@ -1,8 +1,19 @@
 # compiler: creates the binaries
 add_executable(test_icmppacket
-    test_icmppacket.cpp
     ${CMAKE_SOURCE_DIR}/src/boost_assert_handler.cpp
+    ${CMAKE_SOURCE_DIR}/src/host/messagepayload.cpp
+    ${CMAKE_SOURCE_DIR}/src/ip/ipheader.cpp
+    ${CMAKE_SOURCE_DIR}/src/ip/ipv4header.cpp
+    ${CMAKE_SOURCE_DIR}/src/ip/ipv6header.cpp
     ${CMAKE_SOURCE_DIR}/src/icmp/icmppacket.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmpheader.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmpdata.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmpdata_pingfailreply.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmpechodata.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmpdestinationunreachabledata.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmptimeexceededdata.cpp
+    ${CMAKE_SOURCE_DIR}/src/icmp/icmppacketfactory.cpp
+    test_icmppacket.cpp
 )
 
 # linker: link the program against the libraries
@@ -14,3 +25,5 @@ target_link_libraries(
 
 # cmake: invocation via "make test"
 add_test(test_icmppacket test_icmppacket)
+
+add_subdirectory(data)
diff --git a/test/data/CMakeLists.txt b/test/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bf94587
--- /dev/null
@@ -0,0 +1 @@
+configure_file(icmp_echorequest.pcap ${CMAKE_CURRENT_BINARY_DIR}/icmp_echorequest.pcap COPYONLY)
index 2b6dde20eca68d1322ac09c6ddab6d725716e94f..6266b25a72226c39979c4300d450cca99704d314 100644 (file)
@@ -35,7 +35,7 @@
 //  helper function and consts
 //------------------------------------------------------------------------------
 
-bool check_and_consume_pcap_headers(std::istream &input_stream);
+bool check_and_consume_pcap_headers(std::ifstream &input_stream);
 IcmpPacketItem read_packet(const std::string &file_name);
 
 const uint8_t pcap_magic_bytes[] = {0xa1, 0xb2, 0xc3, 0xd4};
Simple merge