[PATCH pynfs 3/3] server: Add test code to JSON and XML output

Petr Vorel
2021-05-24T14:43:02Z

test code is printed when parsed --outfile log with showresults.py.

It's useful to have it in JSON and XML log generated by testserver.py
--json or --xml.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
nfs4.1/testmod.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index 4b4ed24..47016dd 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -481,6 +481,7 @@ def json_printresults(tests, file_name, suite='all'):
data["testcase"] = []
for t in tests:
test = {
+ "code": t.code,
"name": t.name,
"classname": t.suite,
"time": str(t.time_taken),
@@ -520,6 +521,7 @@ def xml_printresults(tests, file_name, suite='all'):
for t in tests:
testcase = doc.createElement("testcase")
testsuite.appendChild(testcase)
+ testcase.setAttribute("code", t.code)
testcase.setAttribute("name", t.name)
testcase.setAttribute("classname", t.suite)
testcase.setAttribute("time", t.time_taken)
--
2.31.1