Add packet injector test frame
This commit is contained in:
39
test/gtest_inject_tcp_rst.cpp
Normal file
39
test/gtest_inject_tcp_rst.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packet_injector_test_frame.h"
|
||||
|
||||
TEST(INJECT_IPV4_BASED_TCP_RST, AFTER_RECV_SYN_ACK)
|
||||
{
|
||||
struct packet_injector_case test = {
|
||||
// descriptor
|
||||
.finish_clean_work_dir = 1,
|
||||
.descriptor = "Inject IPv4 based TCP RST after receiving SYN-ACK packet.",
|
||||
.work_dir = "/tmp/inject_ipv4_based_tcp_rst_after_recv_syn_ack/", // user defined work directory
|
||||
|
||||
// prefix
|
||||
.input_prefix = "pcap/inject_ipv4_based_tcp_rst_after_recv_syn_ack/test/",
|
||||
.output_prefix = "/tmp/",
|
||||
|
||||
// input pcap
|
||||
.input_pcap = "input.pcap",
|
||||
|
||||
// compare
|
||||
.c2s_expect_pcap = "expect-192.0.2.211:59942-192.0.2.110:80-1.pcap",
|
||||
.c2s_output_pcap = "inject-192.0.2.211:59942-192.0.2.110:80-1.pcap",
|
||||
|
||||
.s2c_expect_pcap = "expect-192.0.2.110:80-192.0.2.211:59942-2.pcap",
|
||||
.s2c_output_pcap = "inject-192.0.2.110:80-192.0.2.211:59942-2.pcap",
|
||||
|
||||
// packet injector command
|
||||
.packet_injector_cmd = "./packet_injector -t tcp-rst -c s2c-packet -n 1",
|
||||
.diff_skip_pattern = "-I frame.time -I frame.time_epoch -I ip.id -I ip.ttl -I ip.checksum -I tcp.checksum -I tcp.window_size",
|
||||
};
|
||||
|
||||
packet_injector_test_frame_run(&test);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Reference in New Issue
Block a user