test suite reviews and discussions
 help / color / mirror / Atom feed
From: "zhang,yan" <yanx.a.zhang@intel.com>
To: dts@dpdk.org
Cc: "zhang,yan" <yanx.a.zhang@intel.com>
Subject: [dts] [PATCH V1] tests/TestSuite_metering_and_policing:Modify scripts to run less time
Date: Fri, 23 Aug 2019 17:06:57 +0800	[thread overview]
Message-ID: <1566551217-44175-1-git-send-email-yanx.a.zhang@intel.com> (raw)

Optimize scapy open and close mode.

Signed-off-by: zhang,yan <yanx.a.zhang@intel.com>
---
 tests/TestSuite_metering_and_policing.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/tests/TestSuite_metering_and_policing.py b/tests/TestSuite_metering_and_policing.py
index c4c83d6..77da805 100644
--- a/tests/TestSuite_metering_and_policing.py
+++ b/tests/TestSuite_metering_and_policing.py
@@ -45,6 +45,22 @@ from dut import Dut
 
 
 class TestMeteringAndPolicing(TestCase):
+    scapyCmds = []
+
+    def start_scapy(self):
+        self.tester.scapy_foreground()
+        self.tester.send_expect('scapy', '>>> ', 10)
+        self.scapy_status = True
+
+    def end_scapy(self):
+        self.tester.send_expect("exit()", "#")
+        self.scapy_status = False
+
+    def scapy_execute(self, timeout=60):
+        for cmd in self.scapyCmds:
+            self.tester.send_expect(cmd, ">>> ", timeout)
+
+        self.scapyCmds = []
 
     def copy_config_files_to_dut(self):
         """
@@ -219,10 +235,10 @@ class TestMeteringAndPolicing(TestCase):
             if protocol == "UDP":
                 proto_str = "nh=17"
 
-        self.tester.scapy_append(
+        self.scapyCmds.append(
             'sendp([Ether(dst="%s")/%s(src="%s",dst="%s",%s)/%s(sport=%d,dport=%d)/Raw(load="P"*%d)], iface="%s")'
             % (self.dut_p0_mac, tag, src_ip, dst_ip, proto_str, protocol, fwd_port, fwd_port, pktsize, source_port))
-        self.tester.scapy_execute()
+        self.scapy_execute()
 
     def send_packet_and_check(self, ip_ver, protocol, fwd_port, pktsize, expect_port):
         """
@@ -296,6 +312,7 @@ class TestMeteringAndPolicing(TestCase):
         self.dut_p0_mac = self.dut.get_mac_address(self.dut_ports[0])
         self.port_id = len(self.dut_ports)
         self.copy_config_files_to_dut()
+        self.start_scapy()
 
     def set_up(self):
         """
@@ -653,4 +670,5 @@ class TestMeteringAndPolicing(TestCase):
         """
         Run after each test suite.
         """
-        pass
+        if self.scapy_status:
+            self.end_scapy()
-- 
2.17.2


             reply	other threads:[~2019-08-23  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  9:06 zhang,yan [this message]
2019-08-23  9:04 ` Zhu, WenhuiX
2019-09-04  5:00 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1566551217-44175-1-git-send-email-yanx.a.zhang@intel.com \
    --to=yanx.a.zhang@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).