From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 7B1EC4C99 for ; Fri, 1 Jun 2018 05:02:05 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5A44715AD; Thu, 31 May 2018 20:02:04 -0700 (PDT) Received: from net-x86-lenovo_01.shanghai.arm.com (lenovo-a010984.shanghai.arm.com [10.169.40.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A3EAB3F557; Thu, 31 May 2018 20:02:03 -0700 (PDT) From: Joyce Kong To: dts@dpdk.org Cc: nd@arm.com, Joyce Kong Date: Fri, 1 Jun 2018 11:01:28 +0800 Message-Id: <1527822088-19017-1-git-send-email-joyce.kong@arm.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH] tests/coremask: fix error when config RTE_MAX_LCORE X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 03:02:05 -0000 Add check for available max lcore according to whether configure RTE_MAX_LCORE. Signed-off-by: Joyce Kong --- tests/TestSuite_coremask.py | 52 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/tests/TestSuite_coremask.py b/tests/TestSuite_coremask.py index bad97a2..5447d71 100644 --- a/tests/TestSuite_coremask.py +++ b/tests/TestSuite_coremask.py @@ -46,12 +46,31 @@ class TestCoremask(TestCase): """ pass + def get_available_max_lcore(self): + """ + Check available max lcore according to configuration. + """ + available_max_lcore = len(self.all_cores)+1 + + out = self.dut.send_expect("cat config/defconfig_%s" % self.target, "]# ", 10) + start_position = out.find('CONFIG_RTE_MAX_LCORE=') + + if start_position > -1: + if out.find('\n', start_position) > -1: + end_position = out.find('\n', start_position) + else: + end_position = len(out) + available_max_lcore = int(out[start_position + 21:end_position]) + + return available_max_lcore + def test_individual_coremask(self): """ Check coremask parsing for all the available cores one by one. """ + max_lcore_configed = self.get_available_max_lcore() - for core in self.all_cores: + for core in self.all_cores[:max_lcore_configed-1]: core_mask = utils.create_mask([core]) @@ -71,8 +90,8 @@ class TestCoremask(TestCase): """ Check coremask parsing for all the cores at once. """ - - core_mask = utils.create_mask(self.all_cores) + max_lcore_configed = self.get_available_max_lcore() + core_mask = utils.create_mask(self.all_cores[:max_lcore_configed-1]) command = command_line % (self.target, core_mask, self.mem_channel) @@ -83,7 +102,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:max_lcore_configed-1]: self.verify("EAL: lcore %s is ready" % core in out, "Core %s not ready" % core) @@ -99,38 +118,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