From 6a38f90c1bc6ac63897356c60ad29a7e513e8ad2 Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Sun, 13 Dec 2015 16:22:17 +0200 Subject: minor --- src/gtest/trex_stateless_gtest.cpp | 19 +++++++++++++++++++ src/stateless/cp/trex_stream_vm.cpp | 5 +++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src') 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(); } -- cgit 1.2.3-korg