diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-12-13 16:22:17 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-12-13 16:22:17 +0200 |
commit | 6a38f90c1bc6ac63897356c60ad29a7e513e8ad2 (patch) | |
tree | 04b3fcd278fc55d22586511e1aa9c260dd7bd5ab /src | |
parent | c4e0ae9af9d6c3c94f4784aad39bc0f2746d1223 (diff) |
minor
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest/trex_stateless_gtest.cpp | 19 | ||||
-rw-r--r-- | src/stateless/cp/trex_stream_vm.cpp | 5 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp index 9e15cb46..1ad03c63 100644 --- a/src/gtest/trex_stateless_gtest.cpp +++ b/src/gtest/trex_stateless_gtest.cpp @@ -59,6 +59,25 @@ TEST_F(basic_vm, vm0) { } +TEST_F(basic_vm, vm1) { + + StreamVm vm; + + vm.set_packet_size(512); + + vm.add_instruction( new StreamVmInstructionFixChecksumIpv4(20) ); + vm.add_instruction( new StreamVmInstructionFlowMan( "var1",1, + StreamVmInstructionFlowMan::FLOW_VAR_OP_INC,0,1,7 ) + ); + vm.add_instruction( new StreamVmInstructionWriteToPkt( "var1",14, 0,true) + ); + + vm.Dump(stdout); + + vm.compile_next(); + +} + ////////////////////////////////////////////////////// diff --git a/src/stateless/cp/trex_stream_vm.cpp b/src/stateless/cp/trex_stream_vm.cpp index d8d0dd2e..09a49111 100644 --- a/src/stateless/cp/trex_stream_vm.cpp +++ b/src/stateless/cp/trex_stream_vm.cpp @@ -106,7 +106,7 @@ void StreamVmInstructionFlowMan::Dump(FILE *fd){ void StreamVmInstructionWriteToPkt::Dump(FILE *fd){ - fprintf(fd," write_pkt , %s ,%lu, add, %ld, big, %lu",m_flow_var_name.c_str(),(ulong)m_pkt_offset,(long)m_add_value,(ulong)(m_is_big_endian?1:0)); + fprintf(fd," write_pkt , %s ,%lu, add, %ld, big, %lu \n",m_flow_var_name.c_str(),(ulong)m_pkt_offset,(long)m_add_value,(ulong)(m_is_big_endian?1:0)); } @@ -279,7 +279,8 @@ bool StreamVm::compile() { StreamVm::~StreamVm() { for (auto inst : m_inst_list) { delete inst; - } + } + free_bss(); } |