test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value
@ 2018-06-19 11:03 Joyce Kong
  2018-06-19 11:03 ` [dts] [PATCH 2/3] tests/hello_world: fix invalid coremask when config RTE_MAX_LCORE Joyce Kong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Joyce Kong @ 2018-06-19 11:03 UTC (permalink / raw)
  To: dts; +Cc: phil.yang, Joyce Kong

Add get_def_rte_config API to get RTE configuration from config/defconfig_*.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
 framework/project_dpdk.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index f87fd13..1006d4f 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -430,6 +430,21 @@ class DPDKdut(Dut):
         # No blacklist option in FreeBSD
         return blacklist
 
+    def get_def_rte_config(self, config):
+        """
+        Get RTE configuration from config/defconfig_*.
+        """
+        out = self.send_expect("cat config/defconfig_%s" % self.target, "]# ", 10)
+
+        def_rte_config = re.findall(config+'=(\S+)', out)
+        if def_rte_config:
+            if re.match(r'\d+', def_rte_config[0]):
+                return int(def_rte_config[0])
+            else:
+                return def_rte_config[0]
+
+        return None
+
     def set_driver_specific_configurations(self, drivername):
         """
         Set configurations required for specific drivers before compilation.
-- 
1.8.3.1

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

* [dts] [PATCH 2/3] tests/hello_world: fix invalid coremask when config RTE_MAX_LCORE
  2018-06-19 11:03 [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Joyce Kong
@ 2018-06-19 11:03 ` Joyce Kong
  2018-06-19 11:03 ` [dts] [PATCH 3/3] tests/coremask: " Joyce Kong
  2018-06-20  8:02 ` [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Liu, Yong
  2 siblings, 0 replies; 4+ messages in thread
From: Joyce Kong @ 2018-06-19 11:03 UTC (permalink / raw)
  To: dts; +Cc: phil.yang, Joyce Kong

Add check for CONFIG_RTE_MAX_LCORE when getting maximum logical core
numbers.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
 tests/TestSuite_hello_world.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_hello_world.py b/tests/TestSuite_hello_world.py
index 1c5934c..a81b82e 100644
--- a/tests/TestSuite_hello_world.py
+++ b/tests/TestSuite_hello_world.py
@@ -78,11 +78,18 @@ class TestHelloWorld(TestCase):
 
         # get the maximun logical core number
         cores = self.dut.get_core_list('all')
-        coreMask = utils.create_mask(cores)
+
+        config_max_lcore = self.dut.get_def_rte_config('CONFIG_RTE_MAX_LCORE')
+        if config_max_lcore:
+            available_max_lcore = config_max_lcore
+        else:
+            available_max_lcore = len(cores) + 1
+
+        coreMask = utils.create_mask(cores[:available_max_lcore - 1])
 
         cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask
         out = self.dut.send_expect(cmdline, "# ", 50)
-        for i in range(len(cores)):
+        for i in range(available_max_lcore - 1):
             self.verify("hello from core %s" % cores[i] in out, "EAL not started on core%s" % cores[i])
 
     def tear_down(self):
-- 
1.8.3.1

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

* [dts] [PATCH 3/3] tests/coremask: fix invalid coremask when config RTE_MAX_LCORE
  2018-06-19 11:03 [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Joyce Kong
  2018-06-19 11:03 ` [dts] [PATCH 2/3] tests/hello_world: fix invalid coremask when config RTE_MAX_LCORE Joyce Kong
@ 2018-06-19 11:03 ` Joyce Kong
  2018-06-20  8:02 ` [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Liu, Yong
  2 siblings, 0 replies; 4+ messages in thread
From: Joyce Kong @ 2018-06-19 11:03 UTC (permalink / raw)
  To: dts; +Cc: phil.yang, Joyce Kong

Add check for available max lcore according to whether config RTE_MAX_LCORE.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
 tests/TestSuite_coremask.py | 49 ++++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/tests/TestSuite_coremask.py b/tests/TestSuite_coremask.py
index bad97a2..4ba18c7 100644
--- a/tests/TestSuite_coremask.py
+++ b/tests/TestSuite_coremask.py
@@ -46,12 +46,28 @@ class TestCoremask(TestCase):
         """
         pass
 
+    def get_available_max_lcore(self):
+        """
+        Check available max lcore according to configuration.
+        """
+
+        config_max_lcore = self.dut.get_def_rte_config('CONFIG_RTE_MAX_LCORE')
+
+        if config_max_lcore:
+            available_max_lcore = config_max_lcore
+        else:
+            available_max_lcore = len(self.all_cores) + 1
+
+        return available_max_lcore
+
     def test_individual_coremask(self):
         """
         Check coremask parsing for all the available cores one by one.
         """
 
-        for core in self.all_cores:
+        available_max_lcore = self.get_available_max_lcore()
+
+        for core in self.all_cores[:available_max_lcore - 1]:
 
             core_mask = utils.create_mask([core])
 
@@ -72,7 +88,9 @@ class TestCoremask(TestCase):
         Check coremask parsing for all the cores at once.
         """
 
-        core_mask = utils.create_mask(self.all_cores)
+        available_max_lcore = self.get_available_max_lcore()
+
+        core_mask = utils.create_mask(self.all_cores[:available_max_lcore - 1])
 
         command = command_line % (self.target, core_mask, self.mem_channel)
 
@@ -83,7 +101,7 @@ class TestCoremask(TestCase):
         self.verify("EAL: Detected lcore 1 as core" in out,
                     "Core 1 not detected")
 
-        for core in self.all_cores[1:]:
+        for core in self.all_cores[1:available_max_lcore - 1]:
             self.verify("EAL: lcore %s is ready" % core in out,
                         "Core %s not ready" % core)
 
@@ -99,38 +117,23 @@ class TestCoremask(TestCase):
 
         command_line = """./%s/app/test -c %s -n %d --log-level="lib.eal,8" 2>&1 |tee out"""
 
-        # Default big coremask value 128
-        big_coremask_size = 128
-
-        try:
-            out = self.dut.send_expect("cat config/defconfig_%s" % self.target, "]# ", 10)
-            start_position = out.find('CONFIG_RTE_MAX_LCORE=')
-
-            if start_position > -1:
-                end_position = out.find('\n', start_position)
-                big_coremask_size = int(out[start_position + 21:end_position])
-
-                print "Detected CONFIG_RTE_MAX_LCORE=%d" % big_coremask_size
-        except:
-            print "Using default big coremask %d" % big_coremask_size
-
         # Create a extremely big coremask
+        big_coremask_size = self.get_available_max_lcore()
         big_coremask = "0x"
         for _ in range(0, big_coremask_size, 4):
-            big_coremask += "F"
+            big_coremask += "f"
 
         command = command_line % (self.target, big_coremask, self.mem_channel)
         try:
-            self.dut.send_expect(command, "RTE>>", 10)
+            out = self.dut.send_expect(command, "RTE>>", 10)
         except:
-            out = self.dut.send_expect("cat out", "# ")
             self.verify("EAL: invalid coremask" in out,
-                    "Small core mask set")
+                        "Small core mask set")
 
         self.verify("EAL: Detected lcore 0 as core" in out,
                     "Core 0 not detected")
 
-        for core in self.all_cores[1:]:
+        for core in self.all_cores[1:big_coremask_size - 1]:
 
             self.verify("EAL: Detected lcore %s as core" % core in out,
                         "Core %s not detected" % core)
-- 
1.8.3.1

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

* Re: [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value
  2018-06-19 11:03 [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Joyce Kong
  2018-06-19 11:03 ` [dts] [PATCH 2/3] tests/hello_world: fix invalid coremask when config RTE_MAX_LCORE Joyce Kong
  2018-06-19 11:03 ` [dts] [PATCH 3/3] tests/coremask: " Joyce Kong
@ 2018-06-20  8:02 ` Liu, Yong
  2 siblings, 0 replies; 4+ messages in thread
From: Liu, Yong @ 2018-06-20  8:02 UTC (permalink / raw)
  To: Joyce Kong, dts; +Cc: phil.yang

Thanks, Joyce. Some comments are inline.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Joyce Kong
> Sent: Tuesday, June 19, 2018 7:04 PM
> To: dts@dpdk.org
> Cc: phil.yang@arm.com; Joyce Kong <joyce.kong@arm.com>
> Subject: [dts] [PATCH 1/3] framework/project_dpdk: add API to get
> def_rte_config value
> 
> Add get_def_rte_config API to get RTE configuration from
> config/defconfig_*.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>
> ---
>  framework/project_dpdk.py | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
> index f87fd13..1006d4f 100644
> --- a/framework/project_dpdk.py
> +++ b/framework/project_dpdk.py
> @@ -430,6 +430,21 @@ class DPDKdut(Dut):
>          # No blacklist option in FreeBSD
>          return blacklist
> 
> +    def get_def_rte_config(self, config):
> +        """
> +        Get RTE configuration from config/defconfig_*.
> +        """
> +        out = self.send_expect("cat config/defconfig_%s" % self.target,
> "]# ", 10)
> +

Please replace send_expect with send_command, as any kind of string may existing in configuration file.
Suggest to add sed filter which can remove commented lines.
"cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"

> +        def_rte_config = re.findall(config+'=(\S+)', out)
> +        if def_rte_config:
> +            if re.match(r'\d+', def_rte_config[0]):
> +                return int(def_rte_config[0])
> +            else:
> +                return def_rte_config[0]

Suggest not handle integer here, can leave it to test case. 

> +
> +        return None
> +
>      def set_driver_specific_configurations(self, drivername):
>          """
>          Set configurations required for specific drivers before
> compilation.
> --
> 1.8.3.1

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

end of thread, other threads:[~2018-06-20  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 11:03 [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Joyce Kong
2018-06-19 11:03 ` [dts] [PATCH 2/3] tests/hello_world: fix invalid coremask when config RTE_MAX_LCORE Joyce Kong
2018-06-19 11:03 ` [dts] [PATCH 3/3] tests/coremask: " Joyce Kong
2018-06-20  8:02 ` [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value Liu, Yong

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