test suite reviews and discussions
 help / color / mirror / Atom feed
From: Joyce Kong <joyce.kong@arm.com>
To: dts@dpdk.org
Cc: phil.yang@arm.com, Joyce Kong <joyce.kong@arm.com>
Subject: [dts] [PATCH 3/3] tests/coremask: fix invalid coremask when config RTE_MAX_LCORE
Date: Tue, 19 Jun 2018 19:03:58 +0800	[thread overview]
Message-ID: <1529406238-13393-3-git-send-email-joyce.kong@arm.com> (raw)
In-Reply-To: <1529406238-13393-1-git-send-email-joyce.kong@arm.com>

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

  parent reply	other threads:[~2018-06-19 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-06-20  8:02 ` [dts] [PATCH 1/3] framework/project_dpdk: add API to get def_rte_config value 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=1529406238-13393-3-git-send-email-joyce.kong@arm.com \
    --to=joyce.kong@arm.com \
    --cc=dts@dpdk.org \
    --cc=phil.yang@arm.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).