test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Li, WeiyuanX" <weiyuanx.li@intel.com>
To: dts@dpdk.org, yuan.peng@intel.com
Cc: Weiyuan Li <weiyuanx.li@intel.com>
Subject: [dts][PATCH V1 1/2] tests/kernelpf_iavf: modify script VLAN filter enable requires a port VLAN is assigned
Date: Wed,  1 Jun 2022 14:22:10 +0800	[thread overview]
Message-ID: <20220601062211.646-1-weiyuanx.li@intel.com> (raw)

From: Weiyuan Li <weiyuanx.li@intel.com>

1. Modify script VLAN filter enable requires a port VLAN is assigned.
2. tcpdump timeout, increase the '-nn' to skip the DNS reverse domain name resolution operation.
3. Add failure processing repair sometimes failed to execute command 'ip link set'.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_kernelpf_iavf.py | 41 ++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index bb20e687..9391b4b0 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019 Intel Corporation
+# Copyright(c) 2022 Intel Corporation
 #
 
 """
@@ -206,13 +206,24 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("stop")
         self.vm_testpmd.execute_cmd("set fwd txonly")
         self.tester.send_expect("rm -f tcpdump.pcap", "#")
-        self.tester.send_expect("tcpdump -i %s 2>tcpdump.out &" % self.tester_intf, "#")
+        self.tester.send_expect(
+            "tcpdump -nn -i %s 2>tcpdump.out &" % self.tester_intf, "#"
+        )
         self.vm_testpmd.execute_cmd("start")
         time.sleep(1)
         self.vm_testpmd.execute_cmd("stop")
         self.tester.send_expect("killall tcpdump", "#")
         time.sleep(1)
-        cap_packet = self.tester.send_expect("cat tcpdump.out", "#", 30)
+        retry_times = 10
+        while retry_times:
+            with open("/root/tcpdump.out", "r") as files:
+                for fl in files:
+                    if "packet" in fl:
+                        break
+            retry_times -= 1
+        cap_packet = self.tester.send_expect(
+            "cat tcpdump.out | grep 'packet'", "# ", 30
+        )
         stats = self.vm_testpmd.get_pmd_stats(0)
         cap_tcp_num = re.findall("(\d+) packets", cap_packet)
         nums = sum(map(int, cap_tcp_num))
@@ -355,9 +366,13 @@ class TestKernelpfIavf(TestCase):
         vf can receive packet with right vlan id, can't receive wrong vlan id packet
         """
         random_vlan = random.randint(1, MAX_VLAN)
-        self.dut.send_expect(
+        out = self.dut.send_expect(
             "ip link set %s vf 0 vlan %s" % (self.host_intf, random_vlan), "# "
         )
+        if "Resource temporarily unavailable" in out:
+            self.dut.send_expect(
+                "ip link set %s vf 0 vlan %s" % (self.host_intf, random_vlan), "# "
+            )
         out = self.dut.send_expect("ip link show %s" % self.host_intf, "# ")
         self.verify("vlan %d" % random_vlan in out, "Failed to add pvid on VF0")
 
@@ -380,14 +395,17 @@ class TestKernelpfIavf(TestCase):
         self.verify(len(receive_pkt) == 1, "tester received wrong vlan packet!!!")
 
         # remove vlan
-        self.vm_testpmd.execute_cmd("stop")
-        self.vm_testpmd.execute_cmd("port stop all")
+        self.vm_testpmd.quit()
         self.dut.send_expect("ip link set %s vf 0 vlan 0" % self.host_intf, "# ")
         out = self.dut.send_expect("ip link show %s" % self.host_intf, "# ")
         self.verify("vlan %d" % random_vlan not in out, "Failed to remove pvid on VF0")
         # send packet without vlan
-        self.vm_testpmd.execute_cmd("port reset 0")
-        self.vm_testpmd.execute_cmd("port start all")
+        self.vm_testpmd.start_testpmd("all")
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("set verbose 1")
+        self.vm_testpmd.execute_cmd("vlan set filter on 0")
+        self.vm_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
         out = self.send_and_getout(vlan=0, pkt_type="UDP")
         self.verify(self.vf_mac in out, "Not received packet without vlan!!!")
@@ -429,6 +447,7 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("vlan set filter on 0")
         self.vm_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
         # send packet without vlan, vf can receive packet
         out = self.send_and_getout(pkt_type="UDP")
@@ -543,6 +562,7 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("port start all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set verbose 1")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
 
         # error vlan id
@@ -1050,10 +1070,7 @@ class TestKernelpfIavf(TestCase):
         self.scapy_send_packet(self.vf_mac, self.tester_intf, vlan_flags=True, count=10)
         out = self.vm_dut.get_session_output()
         packets = len(re.findall("received 1 packets", out))
-        if self.kdriver == "i40e" and self.driver_version < "2.13.10":
-            self.verify(packets == 10, "Not receive expected packet")
-        else:
-            self.verify(packets == 0, "Receive expected packet")
+        self.verify(packets == 10, "Receive expected packet")
 
         # send 10 untagged packets, and check 10 untagged packets received
         self.scapy_send_packet(self.vf_mac, self.tester_intf, count=10)
-- 
2.17.1


             reply	other threads:[~2022-06-01  6:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  6:22 Li, WeiyuanX [this message]
2022-06-01  6:22 ` [dts][PATCH V1 2/2] tests/vf_vlan: " Li, WeiyuanX
2022-06-01 10:03 [dts][PATCH V1 1/2] tests/kernelpf_iavf: " Li, WeiyuanX

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=20220601062211.646-1-weiyuanx.li@intel.com \
    --to=weiyuanx.li@intel.com \
    --cc=dts@dpdk.org \
    --cc=yuan.peng@intel.com \
    /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).