[dts] [PATCH for-next v3 7/7] tests/TestSuite_nic_single_core_perf: Report the results in JSON format
Patrick MacArthur
pmacarth at iol.unh.edu
Thu Mar 29 21:16:05 CEST 2018
Add a JSON report file in addition to the texttable report file, for
easier consumption by other automated tools. The JSON output produced
will look like:
{
"results": [
{
"parameters": { "frame_size": 64, "txd/rxd": 1024 },
"throughput": { "result": "PASS", "delta": -0.452, "unit": "Mpps" }
},
/* ... */
]
}
Each entry in the results list is essentially a table row. The
parameters "frame_size" and "txd/rxd" are the input parameters for
each given measurement. Each other element in the result dictionary
is an output measurement for the given measurement.
Signed-off-by: Patrick MacArthur <pmacarth at iol.unh.edu>
---
tests/TestSuite_nic_single_core_perf.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py
index 860fc29f607f..d1b88c3d0157 100644
--- a/tests/TestSuite_nic_single_core_perf.py
+++ b/tests/TestSuite_nic_single_core_perf.py
@@ -33,6 +33,7 @@ DPDK Test suite.
"""
import utils
+import json
import os
import re
import time
@@ -251,6 +252,28 @@ class TestNicSingleCorePerf(TestCase):
file_to_save.write(str(table))
file_to_save.close()
+ json_obj = dict()
+ json_obj['nic_type'] = self.nic
+ json_obj['results'] = list()
+ for frame_size in self.frame_sizes:
+ for descriptor in self.descriptors:
+ row_in = self.test_result[frame_size][descriptor]
+ row_dict = dict()
+ row_dict['parameters'] = dict()
+ row_dict['parameters']['frame_size'] = dict(
+ value=row_in['Frame Size'], unit='bytes')
+ row_dict['parameters']['txd/rxd'] = dict(
+ value=row_in['TXD/RXD'], unit='descriptors')
+ delta = (float(row_in['Throughput'].split()[0]) -
+ float(row_in['Expected Throughput'].split()[0]))
+ row_dict['throughput'] = dict(
+ delta=delta, unit=row_in['Throughput'].split()[1])
+ json_obj['results'].append(row_dict)
+ with open(os.path.join(rst.path2Result,
+ '{0:s}_single_core_perf.json'.format(
+ self.nic)), 'w') as fp:
+ json.dump(json_obj, fp)
+
def tear_down(self):
"""
Run after each test case.
--
2.14.1
More information about the dts
mailing list