DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Power <ciara.power@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, declan.doherty@intel.com,
	adamx.dybkowski@intel.com, Ciara Power <ciara.power@intel.com>
Subject: [dpdk-dev] [PATCH v2 3/3] test/cryptodev: fix handling for config parameters
Date: Tue,  2 Feb 2021 16:58:16 +0000	[thread overview]
Message-ID: <20210202165816.3767724-4-ciara.power@intel.com> (raw)
In-Reply-To: <20210202165816.3767724-1-ciara.power@intel.com>

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 <ciara.power@intel.com>
---
 .../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


  parent reply	other threads:[~2021-02-02 16:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 11:48 [dpdk-dev] [PATCH 0/2] Update doc for crypto perf script Ciara Power
2021-02-02 11:48 ` [dpdk-dev] [PATCH 1/2] doc: update release notes " Ciara Power
2021-02-02 11:48 ` [dpdk-dev] [PATCH 2/2] doc: fix crypto perf script guide Ciara Power
2021-02-02 16:58 ` [dpdk-dev] [PATCH v2 0/3] Update crypto perf script and doc Ciara Power
2021-02-02 16:58   ` [dpdk-dev] [PATCH v2 1/3] doc: update release notes for crypto perf script Ciara Power
2021-02-03 10:30     ` Dybkowski, AdamX
2021-02-02 16:58   ` [dpdk-dev] [PATCH v2 2/3] doc: fix crypto perf script guide Ciara Power
2021-02-03 10:30     ` Dybkowski, AdamX
2021-02-02 16:58   ` Ciara Power [this message]
2021-02-03 10:31     ` [dpdk-dev] [PATCH v2 3/3] test/cryptodev: fix handling for config parameters Dybkowski, AdamX
2021-02-04 18:27   ` [dpdk-dev] [PATCH v2 0/3] Update crypto perf script and doc Akhil Goyal

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=20210202165816.3767724-4-ciara.power@intel.com \
    --to=ciara.power@intel.com \
    --cc=adamx.dybkowski@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@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).