test suite reviews and discussions
 help / color / mirror / Atom feed
From: Angela Czubak <aczubak@caviumnetworks.com>
To: dts@dpdk.org
Cc: Angela Czubak <aczubak@caviumnetworks.com>
Subject: [dts] [PATCH v2 22/28] tests: short_live - taking into account cavium NICs + fixes
Date: Mon, 10 Apr 2017 19:09:16 +0200	[thread overview]
Message-ID: <1491844162-16300-23-git-send-email-aczubak@caviumnetworks.com> (raw)
In-Reply-To: <1491844162-16300-1-git-send-email-aczubak@caviumnetworks.com>

Testpmd must be run with hardware VLAN filter disabled as thunder
driver does not support this feature - --disable-hw-vlan-filter is
appended if NIC is Cavium device.
Additional fixes done: waiting for DPDK application to be finished by
calling `ps` in a loop and checking whether the process is still alive;
sniffing in background scapy process fails at times, using tcpdump
instead; if start_up_time fails it is checked if the problem was that
time command seem not to be found (informing user about it).

Signed-off-by: Angela Czubak <aczubak at caviumnetworks.com>
---
 tests/TestSuite_short_live.py | 42 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 72745a9..45727a1 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -45,6 +45,7 @@ from test_case import TestCase
 from pmd_output import PmdOutput
 from settings import FOLDERS
 
+from packet import Packet, sniff_packets, load_sniff_packets, strip_pktload
 #
 #
 # Test class.
@@ -95,17 +96,14 @@ class TestShortLiveApp(TestCase):
         dmac = self.dut.get_mac_address(txPort)
         Dut_tx_mac = self.dut.get_mac_address(rxPort)
 
-        self.tester.scapy_background()
         count = 1
         # if only one port rx/tx, we should check count 2 so that both
         # rx and tx packet are list
         if (txPort == rxPort):
             count = 2
 
-        self.tester.scapy_append('p=sniff(iface="%s",count=%d,timeout=5)' % (rxitf, count))
-        self.tester.scapy_append('RESULT=str(p)')
 
-        self.tester.scapy_foreground()
+        inst = sniff_packets(intf=rxitf, count=count)
 
         pktlen = pktSize - 14
         padding = pktlen - 20
@@ -114,7 +112,11 @@ class TestShortLiveApp(TestCase):
         self.tester.scapy_execute()
         time.sleep(3)
 
-        out = self.tester.scapy_get_result()
+	p = load_sniff_packets(inst)
+	nr_packets=len(p)
+	reslist = [p[i].pktgen.pkt for i in range(nr_packets)]
+	out = str(reslist)
+
         if received:
             self.verify(('PPP' in out) and 'src=%s'% Dut_tx_mac in out, "Receive test failed")
         else:
@@ -125,7 +127,10 @@ class TestShortLiveApp(TestCase):
         Basic rx/tx forwarding test
         """
         #dpdk start
-        self.dut.send_expect("./%s/app/testpmd -c 0xf -n 4 -- -i --portmask=0x3" % self.target, "testpmd>", 120)
+	cmd = "./%s/app/testpmd -c 0xf -n 4 -- -i --portmask=0x3"
+	if "cavium" in self.dut.nic_type:
+		cmd += " --disable-hw-vlan-filter"
+        self.dut.send_expect(cmd % self.target, "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>")
@@ -144,23 +149,33 @@ class TestShortLiveApp(TestCase):
             print "start time: %s s"%time[0]
         else:
             self.verify(0, "start_up_time failed")
+	    if "time: command not found" in out:
+		print "Command time is not installed or is a shell keyword" 
 
     def test_clean_up_with_signal_testpmd(self):
         repeat_time = 5
+	cmd = "./%s/app/testpmd -c 0xf -n 4 -- -i --portmask=0x3"
+	if "cavium" in self.dut.nic_type:
+		cmd += " --disable-hw-vlan-filter"
         for i in range(repeat_time):
             #dpdk start
             print "clean_up_with_signal_testpmd round %d" % (i + 1)
-            self.dut.send_expect("./%s/app/testpmd -c 0xf -n 4 -- -i --portmask=0x3" % self.target, "testpmd>", 120)
+            self.dut.send_expect(cmd % self.target, "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>")
             self.check_forwarding([0, 1], self.nic)
 
+	    pid = self.dut.send_expect("ps -o pid -C testpmd | tail -n +2", "#", 60, True)
             # kill with differen Signal
             if i%2 == 0:
                 self.dut.send_expect("pkill -2 testpmd", "#", 60, True)
             else:
                 self.dut.send_expect("pkill -15 testpmd", "#", 60, True)
+	    # waiting for the process to truly finish
+	    while True:
+	    	no_lines = int(self.dut.send_expect("ps -p %d | wc -l" % int(pid), "#", 60, True))
+	    	if 1 == no_lines: break # only header is printed out
 
     def test_clean_up_with_signal_l2fwd(self):
         repeat_time = 5
@@ -172,10 +187,16 @@ class TestShortLiveApp(TestCase):
             self.check_forwarding([0, 1], self.nic)
 
             # kill with differen Signal
+	    pid = self.dut.send_expect("ps -o pid -C l2fwd | tail -n +2", "#", 60, True)
             if i%2 == 0:
                 self.dut.send_expect("pkill -2 l2fwd", "#", 60, True)
             else:
                 self.dut.send_expect("pkill -15 l2fwd", "#", 60, True)
+	
+	    while True:
+	    	no_lines = int(self.dut.send_expect("ps -p %d | wc -l" % int(pid), "#", 60, True))
+	    	if 1 == no_lines: break
+	    
 
     def test_clean_up_with_signal_l3fwd(self):
         repeat_time = 5
@@ -186,12 +207,17 @@ class TestShortLiveApp(TestCase):
             self.dut.send_expect("./examples/l3fwd/build/app/l3fwd -n 4 -c 0xf -- -p 0x3 --config='(0,0,1),(1,0,2)' &", "L3FWD:", 120)
             self.check_forwarding([0, 0], self.nic)
 
+	    pid = self.dut.send_expect("ps -o pid -C l3fwd | tail -n +2", "#", 60, True)
             # kill with differen Signal
             if i%2 == 0:
                 self.dut.send_expect("pkill -2 l3fwd", "#", 60, True)
             else:
                 self.dut.send_expect("pkill -15 l3fwd", "#", 60, True)
-
+	
+	    while True:
+	    	no_lines = int(self.dut.send_expect("ps -p %d | wc -l" % int(pid), "#", 60, True))
+	    	if 1 == no_lines: break
+	    
     def tear_down(self):
         """
         Run after each test case.
-- 
2.7.4

  parent reply	other threads:[~2017-04-10 17:10 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 17:51 [dts] [PATCH 00/26] DTS support for Cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 01/26] framework settings: Adding cavium PCI IDs and drivers Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 02/26] framework dut and project_dpdk: using correct available binding scripts Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 03/26] framework dut and project_dpdk: binding smaller number of hugepages for arm64 Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 04/26] framework crb: Appending only 10G devices for cavium Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 05/26] framework project_dpdk: asserting loading vfio-pci by using DPDK binding script Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 06/26] framework: checking link with IPv4 ping Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 07/26] tests: ipv4_reassembly - added splitting result in tcpdump_command Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 08/26] framework: getting DPDK binding script moved to a method in dut Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 09/26] tests: Modified tests to take cavium nics into account Angela Czubak
2017-04-10 17:08   ` Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 10/26] tests: checksum_offload - fixes Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 11/26] tests: dynamic_config - taking into account cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 12/26] tests: fdir - skipping fdir tests for Cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 13/26] tests: ieee1588 - skipping ieee1588_enable test " Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 14/26] tests: jumboframes - skipping jumboframes tests testing bigger than allowed frames " Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 15/26] tests: l2fwd - fixes to run on two cards (same NIC) and expecting "L2FWD: entering main loop" instead of "memory mapped" Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 16/26] tests: link_status_interrupt - skipping test_link_status_interrupt_port_available for Cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 17/26] tests: link_status_interrupt - skipping tests verifying adding MAC addresses " Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 18/26] tests: pmdpcap - modifying the right config file + importing utils after scapy Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 19/26] tests: pmdrssreta - skipping tests for Cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 20/26] tests: queue_start_stop - taking into account cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 21/26] tests: quota_watermark - skipping tests for Cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 22/26] tests: short_live - taking into account cavium NICs + fixes Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 23/26] tests: tso - taking into account cavium NICs Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 24/26] tests: uni_pkt " Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 25/26] tests: unit_tests_dump " Angela Czubak
2017-04-06 17:51 ` [dts] [PATCH 26/26] tests: unit_tests_lpm - asking for lesser amount of hugepages if they are 524288kB Angela Czubak
2017-04-10 17:08 ` [dts] [PATCH v2 00/28] DTS support for Cavium NICs Angela Czubak
2017-04-10 17:08   ` [dts] [PATCH v2 01/28] framework settings: Adding cavium PCI IDs and drivers Angela Czubak
2017-04-10 17:08   ` [dts] [PATCH v2 02/28] framework dut and project_dpdk: using correct available binding scripts Angela Czubak
2017-04-17  6:35     ` Liu, Yong
2017-04-10 17:08   ` [dts] [PATCH v2 03/28] framework dut and project_dpdk: binding smaller number of hugepages for arm64 Angela Czubak
2017-04-10 17:08   ` [dts] [PATCH v2 04/28] framework crb: Appending only 10G devices for cavium Angela Czubak
2017-04-10 17:08   ` [dts] [PATCH v2 05/28] framework project_dpdk: asserting loading vfio-pci by using DPDK binding script Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 06/28] framework: checking link with IPv4 ping Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 07/28] tests: ipv4_reassembly - added splitting result in tcpdump_command Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 08/28] framework: getting DPDK binding script moved to a method in dut Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 09/28] tests: Modified tests to take cavium nics into account Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 10/28] tests: checksum_offload - fixes Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 11/28] tests: dynamic_config - taking into account cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 12/28] tests: fdir - skipping fdir tests for Cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 13/28] tests: ieee1588 - skipping ieee1588_enable test " Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 14/28] tests: jumboframes - skipping jumboframes tests testing bigger than allowed frames " Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 15/28] tests: l2fwd - fixes to run on two cards (same NIC) and expecting "L2FWD: entering main loop" instead of "memory mapped" Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 16/28] tests: link_status_interrupt - skipping test_link_status_interrupt_port_available for Cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 17/28] tests: link_status_interrupt - skipping tests verifying adding MAC addresses " Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 18/28] tests: pmdpcap - modifying the right config file + importing utils after scapy Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 19/28] tests: pmdrssreta - skipping tests for Cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 20/28] tests: queue_start_stop - taking into account cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 21/28] tests: quota_watermark - skipping tests for Cavium NICs Angela Czubak
2017-04-10 17:09   ` Angela Czubak [this message]
2017-04-10 17:09   ` [dts] [PATCH v2 23/28] tests: tso - taking into account cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 24/28] tests: uni_pkt " Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 25/28] tests: unit_tests_dump " Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 26/28] tests: unit_tests_lpm - asking for lesser amount of hugepages if they are 524288kB Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 27/28] framework: Adding linkspeed parameter for Cavium NICs Angela Czubak
2017-04-10 17:09   ` [dts] [PATCH v2 28/28] tests: pmd - Recompiling DPDK only if that is relevant Angela Czubak
2017-04-17  8:02   ` [dts] [PATCH v2 00/28] DTS support for Cavium NICs Liu, Yong
2017-04-19 12:21 ` [dts] [PATCH v3 00/27] " Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 01/27] framework settings: Adding cavium PCI IDs and drivers Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 02/27] framework dut and project_dpdk: using correct available binding scripts Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 03/27] framework dut and project_dpdk: binding smaller number of hugepages for arm64 Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 04/27] framework crb: Appending only 10G devices for cavium Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 05/27] framework project_dpdk: asserting loading vfio-pci by using DPDK binding script Angela Czubak
2017-04-19 12:21   ` [dts] [PATCH v3 06/27] framework: checking link with IPv4 ping Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 07/27] tests: ipv4_reassembly - added splitting result in tcpdump_command Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 08/27] tests: Modified tests to take cavium nics into account Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 09/27] tests: checksum_offload - fixes Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 10/27] tests: dynamic_config - taking into account cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 11/27] tests: fdir - skipping fdir tests for Cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 12/27] tests: ieee1588 - skipping ieee1588_enable test " Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 13/27] tests: jumboframes - skipping jumboframes tests testing bigger than allowed frames " Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 14/27] tests: l2fwd - fixes to run on two cards (same NIC) and expecting "L2FWD: entering main loop" instead of "memory mapped" Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 15/27] tests: link_status_interrupt - skipping test_link_status_interrupt_port_available for Cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 16/27] tests: link_status_interrupt - skipping tests verifying adding MAC addresses " Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 17/27] tests: pmdpcap - modifying the right config file + importing utils after scapy Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 18/27] tests: pmdrssreta - skipping tests for Cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 19/27] tests: queue_start_stop - taking into account cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 20/27] tests: quota_watermark - skipping tests for Cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 21/27] tests: short_live - taking into account cavium NICs + fixes Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 22/27] tests: tso - taking into account cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 23/27] tests: uni_pkt " Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 24/27] tests: unit_tests_dump " Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 25/27] tests: unit_tests_lpm - asking for lesser amount of hugepages if they are 524288kB Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 26/27] framework: Adding linkspeed parameter for Cavium NICs Angela Czubak
2017-04-19 12:22   ` [dts] [PATCH v3 27/27] tests: pmd - Recompiling DPDK only if that is relevant Angela Czubak
2017-04-20  5:55   ` [dts] [PATCH v3 00/27] DTS support for Cavium NICs Liu, Yong

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=1491844162-16300-23-git-send-email-aczubak@caviumnetworks.com \
    --to=aczubak@caviumnetworks.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).