test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated test_positive() and teardown() functions.
@ 2020-09-25  9:28 usurekha
  0 siblings, 0 replies; 3+ messages in thread
From: usurekha @ 2020-09-25  9:28 UTC (permalink / raw)
  To: dts; +Cc: pvukkisala, zzhou, usurekha

From: usurekha <usurekha@marvell.com>

Added script to get the available max cpu depends on DUT config.
Did modifications in teardown() to close the tester scapy sessions properly.

Signed-off-by: usurekha <usurekha@marvell.com>
---
 tests/TestSuite_multiple_pthread.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/TestSuite_multiple_pthread.py b/tests/TestSuite_multiple_pthread.py
index 5d4a1f6..2af8196 100644
--- a/tests/TestSuite_multiple_pthread.py
+++ b/tests/TestSuite_multiple_pthread.py
@@ -62,7 +62,7 @@ class TestMultiplePthread(TestCase):
         """
         Run before each test case.
         """
-        self.send_sessions = []
+        self.send_sessions = None
 
     def send_packet(self):
         """
@@ -73,8 +73,7 @@ class TestMultiplePthread(TestCase):
             iface = self.tester.get_interface(localPort)
             pcap_str = 'Ether()/IP(src="1.2.3.4", dst="192.168.0.%d")' % (index)
             self.pkt = Packet(pcap_str)
-            intf = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface)
-            self.send_sessions.append(intf)
+            self.send_sessions = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface)
 
     def get_cores_statistic(self, cmdline):
         """
@@ -176,7 +175,14 @@ class TestMultiplePthread(TestCase):
         Test an random parameter from an defined table which has a couple of valid lcore parameters.
         """
         n = self.cores
-        CONFIG_RTE_MAX_LCORE = 128
+        # Get max available core depends on DUT configuration
+        cores = self.dut.get_core_list('all')
+        config_max_lcore = self.dut.get_def_rte_config('CONFIG_RTE_MAX_LCORE')
+        if config_max_lcore:
+            CONFIG_RTE_MAX_LCORE = min(int(config_max_lcore), len(cores) + 1)
+        else:
+            CONFIG_RTE_MAX_LCORE = len(cores) + 1
+
         test_list = [
                      {"lcores": "(%s,%s)@(%s,%s)" % (n[0], CONFIG_RTE_MAX_LCORE-1, n[1], n[2]),
                       "cpu_list":[CONFIG_RTE_MAX_LCORE-1],
@@ -230,8 +236,8 @@ class TestMultiplePthread(TestCase):
         """
         Run after each test case.
         """
-        if len(self.send_sessions) != 0:
-            self.pkt.stop_send_pkt_bg(self.send_sessions)
+        if self.send_sessions:
+                self.pkt.stop_send_pkt_bg(self.send_sessions)
         self.dut.kill_all()
 
     def tear_down_all(self):
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated test_positive() and teardown() functions.
  2020-09-25  9:46 usurekha
@ 2020-09-29  5:07 ` Ma, LihongX
  0 siblings, 0 replies; 3+ messages in thread
From: Ma, LihongX @ 2020-09-29  5:07 UTC (permalink / raw)
  To: usurekha, dts; +Cc: pvukkisala, zzhou


> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of usurekha@marvell.com
> Sent: Friday, September 25, 2020 5:47 PM
> To: dts@dpdk.org
> Cc: pvukkisala@marvell.com; zzhou@marvell.com; usurekha
> <usurekha@marvell.com>
> Subject: [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated
> test_positive() and teardown() functions.
> 
> From: usurekha <usurekha@marvell.com>
> 
> Added script to get the available max cpu depends on DUT config.
> Did modifications in teardown() to close the tester scapy sessions properly.
> 
> Signed-off-by: usurekha <usurekha@marvell.com>
> ---
>  tests/TestSuite_multiple_pthread.py | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/TestSuite_multiple_pthread.py
> b/tests/TestSuite_multiple_pthread.py
> index 5d4a1f6..2af8196 100644
> --- a/tests/TestSuite_multiple_pthread.py
> +++ b/tests/TestSuite_multiple_pthread.py
> @@ -62,7 +62,7 @@ class TestMultiplePthread(TestCase):
>          """
>          Run before each test case.
>          """
> -        self.send_sessions = []
> +        self.send_sessions = None
> 

If there are multiple ports on dut, it will create multiple session to send the pkg,
So it should create a list to store all the session info on the suite, otherwise maybe some sessions will lost control.


Regards,
Ma,lihong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated test_positive() and teardown() functions.
@ 2020-09-25  9:46 usurekha
  2020-09-29  5:07 ` Ma, LihongX
  0 siblings, 1 reply; 3+ messages in thread
From: usurekha @ 2020-09-25  9:46 UTC (permalink / raw)
  To: dts; +Cc: pvukkisala, zzhou, usurekha

From: usurekha <usurekha@marvell.com>

Added script to get the available max cpu depends on DUT config.
Did modifications in teardown() to close the tester scapy
sessions properly.

Signed-off-by: usurekha <usurekha@marvell.com>
---
 tests/TestSuite_multiple_pthread.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/TestSuite_multiple_pthread.py b/tests/TestSuite_multiple_pthread.py
index 5d4a1f6..2af8196 100644
--- a/tests/TestSuite_multiple_pthread.py
+++ b/tests/TestSuite_multiple_pthread.py
@@ -62,7 +62,7 @@ class TestMultiplePthread(TestCase):
         """
         Run before each test case.
         """
-        self.send_sessions = []
+        self.send_sessions = None
 
     def send_packet(self):
         """
@@ -73,8 +73,7 @@ class TestMultiplePthread(TestCase):
             iface = self.tester.get_interface(localPort)
             pcap_str = 'Ether()/IP(src="1.2.3.4", dst="192.168.0.%d")' % (index)
             self.pkt = Packet(pcap_str)
-            intf = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface)
-            self.send_sessions.append(intf)
+            self.send_sessions = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface)
 
     def get_cores_statistic(self, cmdline):
         """
@@ -176,7 +175,14 @@ class TestMultiplePthread(TestCase):
         Test an random parameter from an defined table which has a couple of valid lcore parameters.
         """
         n = self.cores
-        CONFIG_RTE_MAX_LCORE = 128
+        # Get max available core depends on DUT configuration
+        cores = self.dut.get_core_list('all')
+        config_max_lcore = self.dut.get_def_rte_config('CONFIG_RTE_MAX_LCORE')
+        if config_max_lcore:
+            CONFIG_RTE_MAX_LCORE = min(int(config_max_lcore), len(cores) + 1)
+        else:
+            CONFIG_RTE_MAX_LCORE = len(cores) + 1
+
         test_list = [
                      {"lcores": "(%s,%s)@(%s,%s)" % (n[0], CONFIG_RTE_MAX_LCORE-1, n[1], n[2]),
                       "cpu_list":[CONFIG_RTE_MAX_LCORE-1],
@@ -230,8 +236,8 @@ class TestMultiplePthread(TestCase):
         """
         Run after each test case.
         """
-        if len(self.send_sessions) != 0:
-            self.pkt.stop_send_pkt_bg(self.send_sessions)
+        if self.send_sessions:
+                self.pkt.stop_send_pkt_bg(self.send_sessions)
         self.dut.kill_all()
 
     def tear_down_all(self):
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-29  5:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25  9:28 [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated test_positive() and teardown() functions usurekha
2020-09-25  9:46 usurekha
2020-09-29  5:07 ` Ma, LihongX

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).