Skip to content

Commit

Permalink
app/crypto-perf: fix handling of config parameters
Browse files Browse the repository at this point in the history
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: f400e0b ("app/crypto-perf: add script to graph perf results")

Signed-off-by: Ciara Power <[email protected]>
Acked-by: Adam Dybkowski <[email protected]>
  • Loading branch information
ciarapow authored and akhilnxp committed Feb 4, 2021
1 parent 96b32dc commit 5ba31a4
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions app/test-crypto-perf/dpdk-graph-crypto-perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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")
Expand All @@ -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)

Expand Down

0 comments on commit 5ba31a4

Please sign in to comment.