[V2] tests/short_live, kni:remove packet.log and used current timestamp

Message ID 1611281483-18024-1-git-send-email-xix.zhang@intel.com (mailing list archive)
State Accepted
Headers
Series [V2] tests/short_live, kni:remove packet.log and used current timestamp |

Commit Message

Zhang, XiX Jan. 22, 2021, 2:11 a.m. UTC
kni:Delete listening files before use
short_live:Different timestamps are used in the loop

Signed-off-by: xizhan4x <xix.zhang@intel.com>
---
 framework/dut.py              |  1 +
 tests/TestSuite_kni.py        |  9 +++++----
 tests/TestSuite_short_live.py | 10 +++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)
  

Comments

Zhang, XiX Jan. 22, 2021, 2:19 a.m. UTC | #1
Tested-by: xizhan4x <xix.zhang@intel.com>

Regards,
Zhang, Xi
> -----Original Message-----
> From: xizhan4x [mailto:xix.zhang@intel.com]
> Sent: Friday, January 22, 2021 10:11 AM
> To: dts@dpdk.org
> Cc: Zhang, XiX <xix.zhang@intel.com>
> Subject: [PATCH V2] tests/short_live,kni:remove packet.log and used current
> timestamp
  
Tu, Lijuan Feb. 2, 2021, 5:43 a.m. UTC | #2
> kni:Delete listening files before use
> short_live:Different timestamps are used in the loop
> 
> Signed-off-by: xizhan4x <xix.zhang@intel.com>

Applied, thanks
  

Patch

diff --git a/framework/dut.py b/framework/dut.py
index c4301df..13cabfc 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -120,6 +120,7 @@  class Dut(Crb):
         :return: eal_str eg:'-c 0xf -a 0000:88:00.0 -a 0000:88:00.1 --file-prefix=dpdk_1112_20190809143420',
         if dpdk version < 20.11-rc4, eal_str eg: '-c 0xf -w 0000:88:00.0 --file-prefix=dpdk_1112_20190809143420',
         """
+        self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime())
         default_cores = '1S/2C/1T'
         blank = ' '
         os_type = self.get_os_type()
diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py
index 0a30053..3535f52 100644
--- a/tests/TestSuite_kni.py
+++ b/tests/TestSuite_kni.py
@@ -663,8 +663,10 @@  class TestKni(TestCase):
         # Ports and cores configuration set in set_up_all function
         self.dut.kill_all()
         self.start_kni()
-        for port in self.config['ports']:
 
+        file_name='packet.log'
+        for port in self.config['ports']:
+            self.dut.send_expect(f"rm -rf {file_name}","#")
             virtual_interface = self.virtual_interface_name(port)
 
             tx_port = self.tester.get_local_port(port)
@@ -674,12 +676,11 @@  class TestKni(TestCase):
 
             self.dut.send_expect("ifconfig %s up" % virtual_interface, "# ")
             time.sleep(5)
-
             # Start tcpdump with filters for src and dst MAC address, this avoids
             # unwanted broadcast, ICPM6... packets
             out = self.dut.send_expect(
-                'tcpdump -i %s -e -w packet.log "ether src %s and ether dst %s"' %
-                (virtual_interface, tx_mac, rx_mac),
+                'tcpdump -i %s -e -w %s "ether src %s and ether dst %s"' %
+                (virtual_interface,file_name, tx_mac, rx_mac),
                 "listening on %s" % virtual_interface, 30)
 
             packets_to_send = [
diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 525be9d..91deded 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -67,7 +67,7 @@  class TestShortLiveApp(TestCase):
         self.app_l2fwd_path = self.dut.apps_name['l2fwd']
         self.app_l3fwd_path = self.dut.apps_name['l3fwd']
         self.app_testpmd = self.dut.apps_name['test-pmd']
-        self.eal_para = self.dut.create_eal_parameters()
+        self.eal_para = self.dut.create_eal_parameters
 
     def set_up(self):
         """
@@ -142,7 +142,7 @@  class TestShortLiveApp(TestCase):
         Basic rx/tx forwarding test
         """
         #dpdk start
-        self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para), "testpmd>", 120)
+        self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para()), "testpmd>", 120)
         time.sleep(5)
         self.dut.send_expect("set fwd mac", "testpmd>")
         self.dut.send_expect("set promisc all off", "testpmd>")
@@ -175,7 +175,7 @@  class TestShortLiveApp(TestCase):
         for i in range(repeat_time):
             #dpdk start
             print("clean_up_with_signal_testpmd round %d" % (i + 1))
-            self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para), "testpmd>", 120)
+            self.dut.send_expect("./%s %s -- -i --portmask=0x3" % (self.app_testpmd, self.eal_para()), "testpmd>", 120)
             self.dut.send_expect("set fwd mac", "testpmd>")
             self.dut.send_expect("set promisc all off", "testpmd>")
             self.dut.send_expect("start", "testpmd>")
@@ -200,7 +200,7 @@  class TestShortLiveApp(TestCase):
         for i in range(repeat_time):
             #dpdk start
             print("clean_up_with_signal_l2fwd round %d" % (i + 1))
-            self.dut.send_expect("%s %s -- -p 0x3 &" % (self.app_l2fwd_path, self.eal_para), "L2FWD: entering main loop", 60)
+            self.dut.send_expect("%s %s -- -p 0x3 &" % (self.app_l2fwd_path, self.eal_para()), "L2FWD: entering main loop", 60)
             self.check_forwarding([0, 1], self.nic)
 
             # kill with different Signal
@@ -216,7 +216,7 @@  class TestShortLiveApp(TestCase):
         for i in range(repeat_time):
             #dpdk start
             print("clean_up_with_signal_l3fwd round %d" % (i + 1))
-            self.dut.send_expect("%s %s -- -p 0x3 --config='(0,0,1),(1,0,2)' &" % (self.app_l3fwd_path, self.eal_para), "L3FWD: entering main loop", 120)
+            self.dut.send_expect("%s %s -- -p 0x3 --config='(0,0,1),(1,0,2)' &" % (self.app_l3fwd_path, self.eal_para()), "L3FWD: entering main loop", 120)
             self.check_forwarding([0, 0], self.nic)
 
             # kill with different Signal