diff mbox series

[V1] Optimize test scripts

Message ID 20211111173338.19963-1-leweix.yang@intel.com (mailing list archive)
State New
Headers show
Series [V1] Optimize test scripts | expand

Checks

Context Check Description
ci/Intel-dts-suite-test success Testing OK
ci/Intel-dts-doc-test success Testing OK

Commit Message

Lewei Yang Nov. 11, 2021, 5:33 p.m. UTC
From: YangLewei <leweix.yang@intel.com>

Separate the test jumbo frame from other tests

Signed-off-by: YangLewei <leweix.yang@intel.com>
---
 test_plans/pf_smoke_test_plan.rst | 14 ++++++++------
 test_plans/vf_smoke_test_plan.rst | 13 +++++++------
 tests/TestSuite_pf_smoke.py       | 17 ++++++++++-------
 tests/TestSuite_vf_smoke.py       | 19 ++++++++++++-------
 4 files changed, 37 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/test_plans/pf_smoke_test_plan.rst b/test_plans/pf_smoke_test_plan.rst
index 2b6c6128..ffcd2105 100644
--- a/test_plans/pf_smoke_test_plan.rst
+++ b/test_plans/pf_smoke_test_plan.rst
@@ -71,7 +71,7 @@  Prerequisites
 
 8. Launch dpdk on PF::
 
-    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:86:00.0 --file-prefix=pf -- -i --max-pkt-len=9600 --tx-offloads=0x00008000 --rxq=4 --txq=4
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:86:00.0 --file-prefix=pf -- -i --rxq=4 --txq=4
     testpmd> set fwd mac
     testpmd> set verbose 3
     testpmd> start
@@ -79,13 +79,15 @@  Prerequisites
 
 Test Case 1: test enable and disable jumbo frame
 ====================================================
-1. set fwd mode is mac::
+1. when launch dpdk on PF, add  parameter '--max-pkt-len=9600 --tx-offloads=0x00008000'
+
+2. set fwd mode is mac::
 
     testpmd> set fwd mac
     testpmd> set verbose 3
     testpmd> start
 
-2. Send a packet with size 9601 bytes ::
+3. Send a packet with size 9601 bytes ::
 
     testpmd> show port stats 0
 
@@ -96,7 +98,7 @@  Test Case 1: test enable and disable jumbo frame
 
 Verify that TX-bytes on port 0 and RX-bytes on port 0 are 0.
 
-3. Send a packet with size 9600 bytes ::
+4. Send a packet with size 9600 bytes ::
 
     testpmd> show port stats 0
 
@@ -107,11 +109,11 @@  Verify that TX-bytes on port 0 and RX-bytes on port 0 are 0.
 
 Verify that TX-bytes on port 0 and RX-bytes on port 0 are 9600.
 
-4. Set mtu is 1500 ::
+5. Set mtu is 1500 ::
 
     testpmd> port config mtu 1500
 
-5. Send a packet with size 1518 bytes ::
+6. Send a packet with size 1518 bytes ::
 
     testpmd> show port stats 0
 
diff --git a/test_plans/vf_smoke_test_plan.rst b/test_plans/vf_smoke_test_plan.rst
index 650f759c..43330c10 100644
--- a/test_plans/vf_smoke_test_plan.rst
+++ b/test_plans/vf_smoke_test_plan.rst
@@ -82,7 +82,7 @@  Prerequisites
 
 8. Launch dpdk on VF::
 
-    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:86:01.0 --file-prefix=pf -- -i --max-pkt-len=9600 --tx-offloads=0x00008000 --rxq=4 --txq=4
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:86:01.0 --file-prefix=pf -- -i --rxq=4 --txq=4
     testpmd> set fwd mac
     testpmd> set verbose 3
     testpmd> start
@@ -91,14 +91,15 @@  Prerequisites
 
 Test Case 1: test enable and disable jumbo frame
 ====================================================
+1. when launch dpdk on VF, add  parameter '--max-pkt-len=9600 --tx-offloads=0x00008000'
 
-1. set fwd mode is mac::
+2. set fwd mode is mac::
 
     testpmd> set fwd mac
     testpmd> set verbose 3
     testpmd> start
 
-2. Send a packet with size 9601 bytes ::
+3. Send a packet with size 9601 bytes ::
 
     testpmd> show port stats 0
 
@@ -109,7 +110,7 @@  Test Case 1: test enable and disable jumbo frame
 
 Verify that TX-bytes on port 0 and RX-bytes on port 0 are 0.
 
-3. Send a packet with size 9600 bytes ::
+4. Send a packet with size 9600 bytes ::
 
     testpmd> show port stats 0
 
@@ -120,11 +121,11 @@  Verify that TX-bytes on port 0 and RX-bytes on port 0 are 0.
 
 Verify that TX-bytes on port 0 and RX-bytes on port 0 are 9600.
 
-4. Set mtu is 1500 ::
+5. Set mtu is 1500 ::
 
     testpmd> port config mtu 1500
 
-5. Send a packet with size 1518 bytes ::
+6. Send a packet with size 1518 bytes ::
 
     testpmd> show port stats 0
 
diff --git a/tests/TestSuite_pf_smoke.py b/tests/TestSuite_pf_smoke.py
index 7477f498..4fa5c454 100644
--- a/tests/TestSuite_pf_smoke.py
+++ b/tests/TestSuite_pf_smoke.py
@@ -72,9 +72,6 @@  class TestPfSmoke(TestCase):
         # set default app parameter
         self.pmd_out = PmdOutput(self.dut)
         self.ports = [self.dut.ports_info[self.smoke_dut_ports[0]]['pci']]
-        self.param = '--max-pkt-len={} --tx-offloads=0x8000 --rxq={} --txq={}'.format(JUMBO_FRAME_LENGTH,
-                                                                                      LAUNCH_QUEUE,
-                                                                                      LAUNCH_QUEUE)
         self.test_func = SmokeTest(self)
         self.check_session = self.dut.new_session(suite="pf_smoke_test")
 
@@ -82,15 +79,19 @@  class TestPfSmoke(TestCase):
         """
         Run before each test case.
         """
+        # set tester mtu
+        if self._suite_result.test_case == "test_pf_jumbo_frames":
+            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, JUMBO_FRAME_MTU), '# ')
+            self.param = '--max-pkt-len={} --tx-offloads=0x8000 --rxq={} --txq={}'.format(JUMBO_FRAME_LENGTH,
+                                                                                          LAUNCH_QUEUE,
+                                                                                          LAUNCH_QUEUE)
+        else:
+            self.param = '--rxq={} --txq={}'.format(LAUNCH_QUEUE, LAUNCH_QUEUE)
         # verify app launch state.
         out = self.check_session.send_expect("ls -l /var/run/dpdk |awk '/^d/ {print $NF}'", '# ', 1)
         if out == '' or 'No such file or directory' in out:
             self.pf_launch_dpdk_app()
 
-        # set tester mtu
-        if self._suite_result.test_case == "test_pf_jumbo_frames":
-            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, JUMBO_FRAME_MTU), '# ')
-
     def pf_launch_dpdk_app(self):
         self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports, param=self.param)
 
@@ -146,6 +147,8 @@  class TestPfSmoke(TestCase):
             self.dut.send_expect("port config all rxq {}".format(LAUNCH_QUEUE), "testpmd> ")
             self.dut.send_expect("port config all txq {}".format(LAUNCH_QUEUE), "testpmd> ")
             self.dut.send_expect("port start all", "testpmd> ")
+        self.dut.send_expect("quit", "# ")
+        self.dut.kill_all()
 
     def tear_down_all(self):
         if self.check_session:
diff --git a/tests/TestSuite_vf_smoke.py b/tests/TestSuite_vf_smoke.py
index ab939acc..bc77fa41 100644
--- a/tests/TestSuite_vf_smoke.py
+++ b/tests/TestSuite_vf_smoke.py
@@ -92,9 +92,6 @@  class TestVfSmoke(TestCase):
             self.ports = [self.vf0_prop['opt_host']]
 
         self.pmd_out = PmdOutput(self.dut)
-        self.param = '--max-pkt-len={} --tx-offloads=0x8000 --rxq={} --txq={}'.format(JUMBO_FRAME_LENGTH,
-                                                                                      LAUNCH_QUEUE,
-                                                                                      LAUNCH_QUEUE)
         self.test_func = SmokeTest(self)
         self.check_session = self.dut.new_session(suite="vf_smoke_test")
 
@@ -102,14 +99,20 @@  class TestVfSmoke(TestCase):
         """
         Run before each test case.
         """
+        # set tester mtu
+        if self._suite_result.test_case == "test_vf_jumbo_frames":
+            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, JUMBO_FRAME_MTU), '# ')
+            self.param = '--max-pkt-len={} --tx-offloads=0x8000 --rxq={} --txq={}'.format(JUMBO_FRAME_LENGTH,
+                                                                                          LAUNCH_QUEUE,
+                                                                                          LAUNCH_QUEUE)
+        else:
+            self.param = '--rxq={} --txq={}'.format(LAUNCH_QUEUE, LAUNCH_QUEUE)
+
         # verify app launch state.
         out = self.check_session.send_expect("ls -l /var/run/dpdk |awk '/^d/ {print $NF}'", '# ', 1)
         if out == '' or 'No such file or directory' in out:
             self.vf_launch_dpdk_app()
 
-        if self._suite_result.test_case == "test_vf_jumbo_frames":
-            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, JUMBO_FRAME_MTU), '# ')
-
     def vf_launch_dpdk_app(self):
         self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports, param=self.param)
 
@@ -155,7 +158,7 @@  class TestVfSmoke(TestCase):
         # set tester mtu to default value
         self.pmd_out.execute_cmd("stop")
         if self._suite_result.test_case == "test_vf_jumbo_frames":
-            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, DEFAULT_PKG_LEN), '# ')
+            self.tester.send_expect("ifconfig {} mtu {}".format(self.smoke_tester_nic, DEFAULT_MTU_VALUE), '# ')
 
         # set dpdk queues to launch value
         if self._suite_result.test_case == "test_vf_tx_rx_queue":
@@ -163,6 +166,8 @@  class TestVfSmoke(TestCase):
             self.dut.send_expect("port config all rxq {}".format(LAUNCH_QUEUE), "testpmd> ")
             self.dut.send_expect("port config all txq {}".format(LAUNCH_QUEUE), "testpmd> ")
             self.dut.send_expect("port start all", "testpmd> ")
+        self.dut.send_expect("quit", "# ")
+        self.dut.kill_all()
 
     def tear_down_all(self):
         if self.check_session: