Files
openthread/tools/harness-automation/gencsv.py
T
Buke PoandJonathan Hui 82ab677049 Support GRL harness release v27 (#871)
* support ser2net and add some non-core feature test cases

* add missing non-core feature test cases
2016-10-24 17:46:49 -07:00

22 lines
595 B
Python
Executable File

#!/usr/bin/env python
import json
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = './result.json'
def get_key(item):
ds = item[0].split('_')
no = int(ds[1]) * 10000 + int(ds[2]) * 100 + int(ds[3])
ro = ds[0]
return '%d-%s' % (no, ro)
result = json.load(open(filename, 'r'))
o = open('./result.csv', 'w')
o.write('Case,Status,Started,Stopped,Reason\n')
for k, v in sorted(result.items(), key=get_key):
o.write('%s,%s,%s,%s,%s\n' % (k, (v['passed'] and 'Pass') or 'Fail', v['started'], v['stopped'], (v['error'] or '').replace('\n', ' ')))