]> granicus.if.org Git - pdns/commitdiff
add bulktest reporting snippets
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Tue, 3 Sep 2013 07:50:18 +0000 (09:50 +0200)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Tue, 3 Sep 2013 07:50:37 +0000 (09:50 +0200)
regression-tests/bulktest-report.py [new file with mode: 0755]
regression-tests/bulktest-to-json.py [new file with mode: 0755]

diff --git a/regression-tests/bulktest-report.py b/regression-tests/bulktest-report.py
new file mode 100755 (executable)
index 0000000..af2bf7a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+import json, sys
+
+runs = json.load(sys.stdin)
+
+selecters = dict(s.split('=',1) for s in sys.argv[1:])
+
+selected=list()
+
+names=set()
+
+for run in runs:
+       match = True
+       for k,v in selecters.iteritems():
+               # print k, v, run[k]
+               if run[k] != v:
+                       match = False
+                       break
+
+       if match:
+               selected.append((run['tag'], run))
+               names.update(run)
+
+selected.sort()
+
+names.discard('tag')
+
+fmt=''.join('%%%ds' % (i+4) for i in [3]+map(len, sorted(names)))
+print fmt % tuple(['tag']+sorted(names))
+for tag, stats in selected:
+       print fmt % tuple(['tag'] + [stats.get(s) for s in sorted(names)])
diff --git a/regression-tests/bulktest-to-json.py b/regression-tests/bulktest-to-json.py
new file mode 100755 (executable)
index 0000000..af33c51
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import glob, json
+
+varnames = set()
+statnames = set()
+runs = list()
+
+for fname in glob.glob('testresults-*.xml'):
+       info = fname[12:-4].split('.')
+       tag = info.pop(0)
+       vars = dict(s.split(':') for s in info)
+       vars['tag'] = tag
+       varnames.update(vars.keys())
+       stats=dict()
+       for line in open(fname):
+               if line.startswith('&lt;'):
+                       sname = line.split(';')[4][:-3]
+                       sval = line.split(';')[8][:-3]
+                       stats[sname]=sval
+                       statnames.add(sname)
+       # print fname, vars, stats
+       runs.append(dict(vars.items()+stats.items()))
+
+# print varnames
+# print statnames
+
+print json.dumps(runs)