From 7af2e24f4eb76820f9c1c9aad841ab6c91d0435a Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Thu, 19 Nov 2015 09:36:40 +0200 Subject: another stream program tests --- .gitignore | 1 + scripts/exp/stl_simple_prog2-0-ex.erf | Bin 0 -> 792 bytes src/gtest/trex_stateless_gtest.cpp | 63 +++++++++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 scripts/exp/stl_simple_prog2-0-ex.erf diff --git a/.gitignore b/.gitignore index 2f3d1759..34c7060d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ scripts/exp/stl_single_pkt_burst1-0.erf scripts/exp/stl_single_sctp_pkt-0.erf scripts/exp/stl_single_stream-0.erf scripts/exp/stl_simple_prog1-0.erf +scripts/exp/stl_simple_prog2-0.erf diff --git a/scripts/exp/stl_simple_prog2-0-ex.erf b/scripts/exp/stl_simple_prog2-0-ex.erf new file mode 100644 index 00000000..3ec46e2f Binary files /dev/null and b/scripts/exp/stl_simple_prog2-0-ex.erf differ diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp index cf80a50c..2e720255 100644 --- a/src/gtest/trex_stateless_gtest.cpp +++ b/src/gtest/trex_stateless_gtest.cpp @@ -110,7 +110,6 @@ public: return (res); } - public: int m_threads; double m_time_diff; @@ -225,6 +224,68 @@ TEST_F(basic_stl, load_pcap_file) { } +TEST_F(basic_stl, simple_prog2) { + + CBasicStl t1; + CParserOption * po =&CGlobalInfo::m_options; + po->preview.setVMode(7); + po->preview.setFileWrite(true); + po->out_file ="exp/stl_simple_prog2"; + + TrexStreamsCompiler compile; + + + std::vector streams; + + /* stream1 */ + TrexStream * stream1 = new TrexStream(TrexStream::stSINGLE_BURST, 0,100); + stream1->set_pps(1.0); + stream1->set_single_burst(5); + stream1->m_enabled = true; + stream1->m_self_start = true; + stream1->m_next_stream_id=200; + + CPcapLoader pcap; + pcap.load_pcap_file("cap2/udp_64B.pcap",0); + pcap.update_ip_src(0x10000001); + pcap.clone_packet_into_stream(stream1); + + streams.push_back(stream1); + + + /* stream1 */ + + TrexStream * stream2 = new TrexStream(TrexStream::stSINGLE_BURST, 0,200); + stream2->set_pps(1.0); + stream2->set_single_burst(5); + stream2->m_isg_usec = 2000000; /*time betwean stream 1 to stream 2 */ + stream2->m_enabled = true; + stream2->m_self_start = false; + + pcap.load_pcap_file("cap2/udp_64B.pcap",0); + pcap.update_ip_src(0x10000002); + pcap.clone_packet_into_stream(stream2); + streams.push_back(stream2); + + + TrexStreamsCompiledObj comp_obj(0,1.0); + + EXPECT_TRUE(compile.compile(streams, comp_obj) ); + + TrexStatelessDpStart * lpstart = new TrexStatelessDpStart( comp_obj.clone(), 10.0 ); + + + t1.m_msg = lpstart; + + bool res=t1.init(); + + delete stream1 ; + delete stream2 ; + + EXPECT_EQ_UINT32(1, res?1:0)<< "pass"; +} + + TEST_F(basic_stl, simple_prog1) { -- cgit 1.2.3-korg