[dts] [PATCH 4/4] add example for test suite

xu,huilong huilongx.xu at intel.com
Sat Apr 1 09:42:32 CEST 2017


add two example for how to use compile config for tests.
    1. queque start stop: use dpdk patch
    2. core mask: use different compile switch

Signed-off-by: xu,huilong <huilongx.xu at intel.com>
---
 tests/TestSuite_coremask.py         | 12 ++----------
 tests/TestSuite_queue_start_stop.py | 28 +++-------------------------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/tests/TestSuite_coremask.py b/tests/TestSuite_coremask.py
index a28266a..c33a193 100644
--- a/tests/TestSuite_coremask.py
+++ b/tests/TestSuite_coremask.py
@@ -39,11 +39,7 @@ class TestCoremask(TestCase):
         self.mem_channel = self.dut.get_memory_channels()
 
         self.all_cores = self.dut.get_core_list("all")
-        self.dut.send_expect("sed -i -e 's/CONFIG_RTE_LOG_LEVEL=.*$/"
-                          + "CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG/' config/common_base", "# ", 30)
-
-        self.dut.skip_setup = False
-        self.dut.build_install_dpdk(self.target)
+        self.dut.reset_compile_target(self.target + '_log_level')
 
     def set_up(self):
         """
@@ -178,8 +174,4 @@ class TestCoremask(TestCase):
         """
         Run after each test suite.
         """
-        self.dut.send_expect("sed -i -e 's/CONFIG_RTE_LOG_LEVEL=.*$/"
-                          + "CONFIG_RTE_LOG_LEVEL=RTE_LOG_INFO/' config/common_base", "# ", 30)
-
-        #self.dut.skip_setup = False
-        self.dut.build_install_dpdk(self.target)
+        self.dut.reset_compile_target()
diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py
index d1df66b..b24f47b 100644
--- a/tests/TestSuite_queue_start_stop.py
+++ b/tests/TestSuite_queue_start_stop.py
@@ -70,22 +70,7 @@ class TestQueueStartStop(TestCase):
         """
         Run before each test case.
         """
-        try:
-            patch_file = FOLDERS["Depends"] + r'/macfwd_log.patch'
-        except:
-            self.logger.warning(str(FOLDERS))
-            patch_file = r'dep/macfwd_log.patch'
-            FOLDERS["Depends"] = 'dep'
-        patch_dst = "/tmp/"
-
-        # dpdk patch and build
-        try:
-            self.dut.session.copy_file_to(patch_file, patch_dst)
-            self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", True)
-            self.dut.build_dpdk_apps('./app/test-pmd')
-        except Exception, e:
-            raise IOError("dpdk setup failure: %s" % e)
-
+        self.dut.reset_compile_target(self.target + '_queue_start_stop')
     def check_forwarding(self, ports, nic, pktSize=64, received=True):
         self.send_packet(ports[0], ports[1], self.nic, pktSize, received)
 
@@ -130,7 +115,7 @@ class TestQueueStartStop(TestCase):
         """
         #dpdk start
         try:
-            self.dut.send_expect("./app/test-pmd/testpmd -c 0xf -n 4 -- -i --portmask=0x1 --port-topology=loop", "testpmd>", 120)
+            self.dut.send_expect("./%s/app/testpmd -c 0xf -n 4 -- -i --portmask=0x1 --port-topology=loop" % self.target, "testpmd>", 120)
             self.dut.send_expect("set fwd mac", "testpmd>")
             self.dut.send_expect("start", "testpmd>")
             self.check_forwarding([0, 0], self.nic)
@@ -182,16 +167,9 @@ class TestQueueStartStop(TestCase):
 
         self.dut.kill_all()
 
-        try:
-            self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", False)
-        except Exception, e:
-            print "patch_hotfix_dpdk remove failure :%s" %e
-
     def tear_down_all(self):
         """
         Run after each test suite.
         """
         self.dut.kill_all()
-        self.dut.send_expect("rm -rf ./app/test-pmd/testpmd", "#")
-        self.dut.send_expect("rm -rf ./app/test-pmd/*.o", "#")
-        self.dut.send_expect("rm -rf ./app/test-pmd/build", "#")
+        self.dut.reset_compile_target()
-- 
1.9.3



More information about the dts mailing list