From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91345A052A; Tue, 2 Feb 2021 17:59:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE4C0240375; Tue, 2 Feb 2021 17:58:55 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id BC6F724034B for ; Tue, 2 Feb 2021 17:58:51 +0100 (CET) IronPort-SDR: uPJCldJ2T5DwrcOAF1GYUfJhJEaBKmVIjF4ulOy7RvYY6tGJiZHF44Cmhr0yoRgbvbG+k0/RWN q7YFmSRcW2aw== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="199815014" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="199815014" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 08:58:49 -0800 IronPort-SDR: 8KrrqbCb5Wh31cvWJR3n6bngie1bY/9NEm9tknJKmWO6VCCq1ukLA96V+wSdHg7tNeyRYWmgv+ +7N9AHE4RF1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="433003929" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.223.148]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2021 08:58:46 -0800 From: Ciara Power To: dev@dpdk.org Cc: akhil.goyal@nxp.com, declan.doherty@intel.com, adamx.dybkowski@intel.com, Ciara Power Date: Tue, 2 Feb 2021 16:58:16 +0000 Message-Id: <20210202165816.3767724-4-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202165816.3767724-1-ciara.power@intel.com> References: <20210202114847.3724834-1-ciara.power@intel.com> <20210202165816.3767724-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/3] test/cryptodev: fix handling for config parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The crypto perf graphing script did not handle parsing parameters from the JSON config files correctly. A common parsing function is used for both EAL and app parameters, to ensure they are handled the same way and to reduce code duplication. Short parameters are now passed with the value being a second argument, rather than as one argument with dividing space. Long parameters with no expected value are supported for EAL now also. e.g. "--no-huge" can be added to config as "no-huge": true Fixes: f400e0b82bf1 ("app/crypto-perf: add script to graph perf results") Signed-off-by: Ciara Power --- .../dpdk-graph-crypto-perf.py | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/app/test-crypto-perf/dpdk-graph-crypto-perf.py b/app/test-crypto-perf/dpdk-graph-crypto-perf.py index f4341ee718..02322d2d7e 100755 --- a/app/test-crypto-perf/dpdk-graph-crypto-perf.py +++ b/app/test-crypto-perf/dpdk-graph-crypto-perf.py @@ -192,10 +192,23 @@ def run_test(test_cmd, test, grapher, params, verbose): return +def parse_parameters(config_parameters): + """Convert the JSON config to list of strings.""" + params = [] + for (key, val) in config_parameters: + if isinstance(val, bool): + params.append("--" + key if val is True else "") + elif len(key) == 1: + params.append("-" + key) + params.append(val) + else: + params.append("--" + key + "=" + val) + return params + + def run_test_suite(test_cmd, suite_config, verbose): """Parse test cases for the test suite and run each test.""" print("\nRunning Test Suite: " + suite_config['suite']) - default_params = [] graph_path = os.path.join(suite_config['output_path'], GRAPH_DIR, suite_config['suite'], "") grapher = Grapher(suite_config['config_name'], suite_config['suite'], @@ -204,18 +217,10 @@ def run_test_suite(test_cmd, suite_config, verbose): if 'default' not in test_cases: print("Test Suite must contain default case, skipping") return - for (key, val) in test_cases['default']['eal'].items(): - if len(key) == 1: - default_params.append("-" + key + " " + val) - else: - default_params.append("--" + key + "=" + val) + default_params = parse_parameters(test_cases['default']['eal'].items()) default_params.append("--") - for (key, val) in test_cases['default']['app'].items(): - if isinstance(val, bool): - default_params.append("--" + key if val is True else "") - else: - default_params.append("--" + key + "=" + val) + default_params += parse_parameters(test_cases['default']['app'].items()) if 'ptest' not in test_cases['default']['app']: print("Test Suite must contain default ptest value, skipping") @@ -224,13 +229,7 @@ def run_test_suite(test_cmd, suite_config, verbose): for (test, params) in {k: v for (k, v) in test_cases.items() if k != "default"}.items(): - extra_params = [] - for (key, val) in params.items(): - if isinstance(val, bool): - extra_params.append("--" + key if val is True else "") - else: - extra_params.append("--" + key + "=" + val) - + extra_params = parse_parameters(params.items()) run_test(test_cmd, test, grapher, default_params + extra_params, verbose) -- 2.25.1