[v2,3/3] test/cryptodev: fix handling for config parameters

Message ID 20210202165816.3767724-4-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series Update crypto perf script and doc |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing warning Testing issues
ci/intel-Testing success Testing PASS

Commit Message

Power, Ciara Feb. 2, 2021, 4:58 p.m. UTC
  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(-)
  

Comments

Dybkowski, AdamX Feb. 3, 2021, 10:31 a.m. UTC | #1
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Tuesday, 2 February, 2021 17:58
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Doherty, Declan <declan.doherty@intel.com>;
> Dybkowski, AdamX <adamx.dybkowski@intel.com>; Power, Ciara
> <ciara.power@intel.com>
> Subject: [PATCH v2 3/3] test/cryptodev: fix handling for config parameters
> 
> 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>

Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
  

Patch

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)