summaryrefslogtreecommitdiffstats
path: root/src/gtest/trex_stateless_gtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtest/trex_stateless_gtest.cpp')
-rw-r--r--src/gtest/trex_stateless_gtest.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp
index ef7b658d..50f8e5ec 100644
--- a/src/gtest/trex_stateless_gtest.cpp
+++ b/src/gtest/trex_stateless_gtest.cpp
@@ -140,6 +140,28 @@ class basic_vm : public testing::Test {
};
+TEST_F(basic_vm, cache_basic) {
+
+ CGenNodeStateless *node = new CGenNodeStateless();
+
+ node->cache_mbuf_array_init();
+ int i;
+ node->cache_mbuf_array_alloc(10);
+ for (i=0; i<10; i++) {
+ rte_mbuf_t * m =CGlobalInfo::pktmbuf_alloc_small(0);
+ m->data_off=i;
+ node->cache_mbuf_array_set(i,(rte_mbuf_t *) m);
+ }
+
+ for (i=0; i<10; i++) {
+ rte_mbuf_t * m =node->cache_mbuf_array_get_cur();
+ printf(" %d \n",m->data_off);
+ }
+
+ node->cache_mbuf_array_free();
+
+ delete node;
+}
TEST_F(basic_vm, pkt_size) {
@@ -2752,13 +2774,13 @@ TEST_F(basic_stl, multi_pkt1) {
class CEnableVm {
public:
- void run(bool full_packet,double duration );
+ void run(bool full_packet,double duration,uint16_t cache );
public:
std::string m_input_packet; //"cap2/udp_64B.pcap"
std::string m_out_file; //"exp/stl_vm_enable0";
};
-void CEnableVm::run(bool full_packet,double duration=10.0){
+void CEnableVm::run(bool full_packet,double duration=10.0,uint16_t cache=0){
CBasicStl t1;
CParserOption * po =&CGlobalInfo::m_options;
@@ -2774,6 +2796,10 @@ void CEnableVm::run(bool full_packet,double duration=10.0){
TrexStream * stream1 = new TrexStream(TrexStream::stCONTINUOUS,0,0);
+ if ( cache ){
+ stream1->m_cache_size=cache;
+ }
+
stream1->set_rate(TrexStreamRate::RATE_PPS, 1.0);
stream1->m_enabled = true;
@@ -2816,6 +2842,22 @@ void CEnableVm::run(bool full_packet,double duration=10.0){
EXPECT_EQ_UINT32(1, res?1:0)<< "pass";
}
+TEST_F(basic_stl, vm_enable_cache_10) {
+
+ CEnableVm vm_test;
+ vm_test.m_out_file = "exp/stl_vm_enable0_cache_10";
+ vm_test.m_input_packet = "cap2/udp_64B.pcap";
+ vm_test.run(true,10.0,100);
+}
+
+TEST_F(basic_stl, vm_enable_cache_500) {
+ /* multi mbuf cache */
+ CEnableVm vm_test;
+ vm_test.m_out_file = "exp/stl_vm_enable1_cache_500";
+ vm_test.m_input_packet = "stl/yaml/udp_594B_no_crc.pcap";
+ vm_test.run(false,20.0,19);
+}
+
TEST_F(basic_stl, vm_enable0) {
@@ -3649,3 +3691,7 @@ TEST_F(rx_stat_pkt_parse, x710_parser) {
parser.test();
}
+
+
+
+