From: Patrick MacArthur <pmacarth@iol.unh.edu>
To: dts@dpdk.org
Cc: pmacarth@iol.unh.edu, dpdklab@iol.unh.edu
Subject: [dts] [PATCH for-next 3/6] tests/TestSuite_nic_single_core_perf: Fix config parsing
Date: Tue, 20 Feb 2018 12:26:09 -0500 [thread overview]
Message-ID: <20180220172612.11973-4-pmacarth@iol.unh.edu> (raw)
In-Reply-To: <20180220172612.11973-1-pmacarth@iol.unh.edu>
The configuration values in test suite configuration are already
eval()'d as of commit 081fbf69fe20 ("framework/config: utilize eval to
parse configurations") so we don't need to do any special parsing here.
This also changes the expected_throughput dictionary keys and values
from strings to floats, which is more convenient.
Tested-by: Ali Alnubani <alialnu@mellanox.com>
Signed-off-by: Patrick MacArthur <pmacarth@iol.unh.edu>
---
tests/TestSuite_nic_single_core_perf.py | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py
index 3411a31b7532..21de93624cb4 100644
--- a/tests/TestSuite_nic_single_core_perf.py
+++ b/tests/TestSuite_nic_single_core_perf.py
@@ -59,8 +59,8 @@ class TestNicSingleCorePerf(TestCase):
self.trafficDuration = 60
#load the expected throughput for required nic
- self.expected_throughput_nnt = self.parse_string(self.get_suite_cfg()["throughput_nnt"])
- self.expected_throughput_fvl25g = self.parse_string(self.get_suite_cfg()["throughput_fvl25g"])
+ self.expected_throughput_nnt = self.get_suite_cfg()["throughput_nnt"]
+ self.expected_throughput_fvl25g = self.get_suite_cfg()["throughput_fvl25g"]
# The acdepted gap between expected throughput and actual throughput, 1 Mpps
self.gap = 1
@@ -169,9 +169,9 @@ class TestNicSingleCorePerf(TestCase):
ret_data[header[2]] = str(float("%.3f" % throughput)) + " Mpps"
ret_data[header[3]] = str(float("%.3f" % (throughput * 100 / wirespeed))) + "%"
if self.nic == "niantic":
- ret_data[header[4]] = self.expected_throughput_nnt[str(frame_size)][str(descriptor)] + " Mpps"
+ ret_data[header[4]] = str(self.expected_throughput_nnt[frame_size][descriptor]) + " Mpps"
elif self.nic == "fortville_25g":
- ret_data[header[4]] = self.expected_throughput_fvl25g[str(frame_size)][str(descriptor)] + " Mpps"
+ ret_data[header[4]] = str(self.expected_throughput_fvl25g[frame_size][descriptor]) + " Mpps"
ret_datas[descriptor] = deepcopy(ret_data)
self.test_result[frame_size] = deepcopy(ret_datas)
@@ -248,25 +248,6 @@ class TestNicSingleCorePerf(TestCase):
file_to_save.write(str(table))
file_to_save.close()
- def parse_string(self, string):
- '''
- Parse a string in the formate of a dictionary and convert it into a real dictionary.
- '''
- element_pattern = re.compile(".\d+:.*?}")
- string_elements = element_pattern.findall(string)
- ret = {}
- for element in string_elements:
- ex_pattern = re.compile("(\d+): *{(.*)}")
- ex_ret = ex_pattern.search(element)
- ret[ex_ret.groups()[0]] = ex_ret.groups()[1]
- inner_datas = ex_ret.groups()[1].split(",")
- ret_inner = {}
- for data in inner_datas:
- match_inner = data.split(":")
- ret_inner[match_inner[0].strip()] = match_inner[1].strip()
- ret[ex_ret.groups()[0]] = deepcopy(ret_inner)
- return ret
-
def tear_down(self):
"""
Run after each test case.
--
2.14.1
next prev parent reply other threads:[~2018-02-20 17:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 17:26 [dts] [PATCH for-next 0/6] Fixes and modifications for T-Rex integration and nic_single_core_perf Patrick MacArthur
2018-02-20 17:26 ` [dts] [PATCH for-next 1/6] framework/texttable: Update to latest upstream version Patrick MacArthur
2018-02-20 17:26 ` [dts] [PATCH for-next 2/6] framework: Do not attempt ping6 on T-Rex ports Patrick MacArthur
2018-02-20 17:26 ` Patrick MacArthur [this message]
2018-02-20 17:26 ` [dts] [PATCH for-next 4/6] tests/TestSuite_nic_single_core_perf: Use user-specified output dir Patrick MacArthur
2018-02-20 17:26 ` [dts] [PATCH for-next 5/6] framework/pktgen: Start T-Rex during prepare_generator() Patrick MacArthur
2018-03-02 1:51 ` Liu, Yong
2018-02-20 17:26 ` [dts] [PATCH for-next 6/6] tests/TestSuite_nic_single_core_perf: Fix test case name Patrick MacArthur
[not found] ` <188971FCDA171749BED5DA74ABF3E6F03C123A39@SHSMSX104.ccr.corp.intel.com>
2018-03-05 9:25 ` Wang, FeiX Y
[not found] ` <188971FCDA171749BED5DA74ABF3E6F03C1239F0@SHSMSX104.ccr.corp.intel.com>
2018-03-05 9:16 ` [dts] [PATCH for-next 0/6] Fixes and modifications for T-Rex integration and nic_single_core_perf Wang, FeiX Y
2018-03-20 22:25 ` Patrick MacArthur
2018-03-21 7:28 ` Wang, FeiX Y
2018-03-23 9:03 ` Wang, FeiX Y
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=20180220172612.11973-4-pmacarth@iol.unh.edu \
--to=pmacarth@iol.unh.edu \
--cc=dpdklab@iol.unh.edu \
--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).