diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-11-30 15:33:27 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-11-30 15:33:27 +0200 |
commit | aae096450194f4be650fb0f8f1be21f6d5874a30 (patch) | |
tree | bfa747680b5acb182785157f21b08d6ea7a96f83 | |
parent | 2e51cea370c6c401453d77b23f552811a669d86a (diff) |
another vm test
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | scripts/exp/stl_vm_enable0-0-ex.erf | bin | 0 -> 880 bytes | |||
-rw-r--r-- | scripts/exp/stl_vm_enable1-0-ex.erf | bin | 0 -> 6160 bytes | |||
-rw-r--r-- | scripts/exp/stl_vm_enable2-0-ex.erf | bin | 0 -> 6160 bytes | |||
-rw-r--r-- | src/gtest/trex_stateless_gtest.cpp | 100 | ||||
-rw-r--r-- | src/stateless/dp/trex_stateless_dp_core.cpp | 3 | ||||
-rw-r--r-- | src/stateless/dp/trex_stream_node.h | 2 |
7 files changed, 108 insertions, 1 deletions
@@ -31,6 +31,10 @@ scripts/exp/stl_bb_start_stop3-0.erf scripts/exp/stl_bb_start_stop_delay1-0.erf scripts/exp/stl_bb_start_stop_delay2-0.erf scripts/exp/stl_basic_pause_resume0-0.erf +scripts/exp/stl_vm_enable0-0.erf +scripts/exp/stl_vm_enable1-0.erf +scripts/exp/stl_vm_enable2-0.erf + diff --git a/scripts/exp/stl_vm_enable0-0-ex.erf b/scripts/exp/stl_vm_enable0-0-ex.erf Binary files differnew file mode 100644 index 00000000..92883717 --- /dev/null +++ b/scripts/exp/stl_vm_enable0-0-ex.erf diff --git a/scripts/exp/stl_vm_enable1-0-ex.erf b/scripts/exp/stl_vm_enable1-0-ex.erf Binary files differnew file mode 100644 index 00000000..41dec175 --- /dev/null +++ b/scripts/exp/stl_vm_enable1-0-ex.erf diff --git a/scripts/exp/stl_vm_enable2-0-ex.erf b/scripts/exp/stl_vm_enable2-0-ex.erf Binary files differnew file mode 100644 index 00000000..41dec175 --- /dev/null +++ b/scripts/exp/stl_vm_enable2-0-ex.erf diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp index e236a63d..ce97fbcb 100644 --- a/src/gtest/trex_stateless_gtest.cpp +++ b/src/gtest/trex_stateless_gtest.cpp @@ -1296,6 +1296,106 @@ TEST_F(basic_stl, vm_enable0) { EXPECT_EQ_UINT32(1, res?1:0)<< "pass"; } +TEST_F(basic_stl, vm_enable1) { + + CBasicStl t1; + CParserOption * po =&CGlobalInfo::m_options; + po->preview.setVMode(7); + po->preview.setFileWrite(true); + po->out_file ="exp/stl_vm_enable1"; + + TrexStreamsCompiler compile; + + uint8_t port_id=0; + + std::vector<TrexStream *> streams; + + TrexStream * stream1 = new TrexStream(TrexStream::stCONTINUOUS,0,0); + stream1->m_has_vm = true; + stream1->m_vm_prefix_size =64; + stream1->set_pps(1.0); + + + stream1->m_enabled = true; + stream1->m_self_start = true; + stream1->m_port_id= port_id; + + + CPcapLoader pcap; + pcap.load_pcap_file("stl/udp_594B_no_crc.pcap",0); + pcap.update_ip_src(0x10000001); + pcap.clone_packet_into_stream(stream1); + + streams.push_back(stream1); + + // stream - clean + + TrexStreamsCompiledObj comp_obj(port_id, 1.0 /*mul*/); + + assert(compile.compile(streams, comp_obj) ); + + TrexStatelessDpStart * lpstart = new TrexStatelessDpStart(port_id, 0, comp_obj.clone(), 10.0 /*sec */ ); + + + t1.m_msg = lpstart; + + bool res=t1.init(); + + delete stream1 ; + + EXPECT_EQ_UINT32(1, res?1:0)<< "pass"; +} + +TEST_F(basic_stl, vm_enable2) { + + CBasicStl t1; + CParserOption * po =&CGlobalInfo::m_options; + po->preview.setVMode(7); + po->preview.setFileWrite(true); + po->out_file ="exp/stl_vm_enable2"; + + TrexStreamsCompiler compile; + + uint8_t port_id=0; + + std::vector<TrexStream *> streams; + + TrexStream * stream1 = new TrexStream(TrexStream::stCONTINUOUS,0,0); + stream1->m_has_vm = true; + stream1->m_vm_prefix_size = 256; + stream1->set_pps(1.0); + + + stream1->m_enabled = true; + stream1->m_self_start = true; + stream1->m_port_id= port_id; + + + CPcapLoader pcap; + pcap.load_pcap_file("stl/udp_594B_no_crc.pcap",0); + pcap.update_ip_src(0x10000001); + pcap.clone_packet_into_stream(stream1); + + streams.push_back(stream1); + + // stream - clean + + TrexStreamsCompiledObj comp_obj(port_id, 1.0 /*mul*/); + + assert(compile.compile(streams, comp_obj) ); + + TrexStatelessDpStart * lpstart = new TrexStatelessDpStart(port_id, 0, comp_obj.clone(), 10.0 /*sec */ ); + + + t1.m_msg = lpstart; + + bool res=t1.init(); + + delete stream1 ; + + EXPECT_EQ_UINT32(1, res?1:0)<< "pass"; +} + diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp index c7bb7636..8c0f03c8 100644 --- a/src/stateless/dp/trex_stateless_dp_core.cpp +++ b/src/stateless/dp/trex_stateless_dp_core.cpp @@ -455,6 +455,7 @@ TrexStatelessDpCore::add_stream(TrexStatelessDpPerPort * lp_port, CGenNodeStateless *node = m_core->create_node_sl(); /* add periodic */ + node->m_cache_mbuf=0; node->m_type = CGenNode::STATELESS_PKT; node->m_ref_stream_info = stream->clone_as_dp(); @@ -541,6 +542,8 @@ TrexStatelessDpCore::add_stream(TrexStatelessDpPerPort * lp_port, /* set the packet as a readonly */ node->set_cache_mbuf(m); + + node->m_original_packet_data_prefix =0; }else{ /* we need to copy the object */ diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h index 1ae8cbbc..fc7d7a44 100644 --- a/src/stateless/dp/trex_stream_node.h +++ b/src/stateless/dp/trex_stream_node.h @@ -289,7 +289,7 @@ public: } /* prefix header exits only in non cache mode size is 64/128/512 other are not possible right now */ - inline void alloc_prefix_header(uint8_t size){ + inline void alloc_prefix_header(uint16_t size){ set_prefix_header_size(size); m_original_packet_data_prefix = (uint8_t *)malloc(size); assert(m_original_packet_data_prefix); |