From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f227.google.com (mail-qt0-f227.google.com [209.85.216.227]) by dpdk.org (Postfix) with ESMTP id 473691B040 for ; Tue, 20 Feb 2018 18:26:18 +0100 (CET) Received: by mail-qt0-f227.google.com with SMTP id g14so17344417qti.2 for ; Tue, 20 Feb 2018 09:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OdrlyxVehvZf+B5VgLprEMK6pHRWoEUCX/XUjF1M/7s=; b=Q0NujUqPKpMCNLH4jqy9/uFK4133CbBLVb4M9SCnClsyRpOe3TCY/She9ctAj0d4UU Lqvpcu+w6MrDuulEpDuCdo1t81omvf5JNhm4OtkMPruzF3M8CnzhPZOU6MHeDBjvJ1Fm nCSR1Km9AvLjtcUhPFpHrfuSYeZh9lZzxzTYs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OdrlyxVehvZf+B5VgLprEMK6pHRWoEUCX/XUjF1M/7s=; b=P8oEA+/GeOdckokLoZSNSI9jnwcZqqzrjCQYgZCmaq0MB4C28ydKuDdkoAIGMBKnWr Kz5n7AJyPhqJXcpiph2IjN/pWl5/AdMuisDcDPdXb31gzyWknNmCfAcW4WtsJqMZ0aw+ 8Y9xHYtSm1AJ4fdl1mIxmWDBw2dSzn4c8ZYzP2nke3NEEFnyPFOO6a/fHI86MrrZNfN0 twYHdqZf7sblZ5siQA1xsNg0b4hfPsP0ZrXkxp2UOSyWZ4T1ZBGWWtAOGf4vdbO6APQ1 TvA22ls35OnJmWeFTyBxOlakgTYQDGEiprsPlgBQvm1ECpn/mcYhS5nGUWuSh98f5dcH y56Q== X-Gm-Message-State: APf1xPCLUmorUiLpgkkiE1p2y+Kf8pW8A7yVMvuCiqO0VoJud99WzVTo ENZEOP029tVtFFNgDqx501hjfStw3KU372tFknnF4qahJozPi+H0AYgEguC2uKorMN/G1ImeY/q 4TdFzifw38sKBiF80aaerEpNYckcxQFe3aiJFgkPmoSK4Tpee/exxvrZUwEEZgdSoMqEShGdq6i UKpEfDTUh2qX0hyg== X-Google-Smtp-Source: AH8x227kn8F14saqAzO7wYaLb20HhlU0vk2xIQYtjOfsiHoMX+OoQfZ8272GCiXmemQvayc/bD5wT1L4dgK0 X-Received: by 10.237.57.133 with SMTP id m5mr575687qte.258.1519147577645; Tue, 20 Feb 2018 09:26:17 -0800 (PST) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id t123sm79329qkh.8.2018.02.20.09.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 09:26:17 -0800 (PST) X-Relaying-Domain: iol.unh.edu Received: from groose.iol.unh.edu (unknown [IPv6:2606:4100:3880:1240:948e:929b:6d8b:f08a]) by postal.iol.unh.edu (Postfix) with ESMTP id 150B660E805C; Tue, 20 Feb 2018 12:26:17 -0500 (EST) From: Patrick MacArthur To: dts@dpdk.org Cc: pmacarth@iol.unh.edu, dpdklab@iol.unh.edu Date: Tue, 20 Feb 2018 12:26:09 -0500 Message-Id: <20180220172612.11973-4-pmacarth@iol.unh.edu> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180220172612.11973-1-pmacarth@iol.unh.edu> References: <20180220172612.11973-1-pmacarth@iol.unh.edu> Subject: [dts] [PATCH for-next 3/6] tests/TestSuite_nic_single_core_perf: Fix config parsing 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: Tue, 20 Feb 2018 17:26:18 -0000 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 Signed-off-by: Patrick MacArthur --- 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