]> git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/scripts/parseautobahn.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / Beast / scripts / parseautobahn.py
1 import os
2 import json
3 import sys
4
5 VARIANT = os.environ.get('VARIANT', 'release')
6 EXPECTED_BEHAVIOR = ('OK', 'UNIMPLEMENTED', 'INFORMATIONAL')
7 EXPECTED_BEHAVIOR_CLOSE = ('OK', 'INFORMATIONAL')
8 WARNINGS = ("peer did not respond (in time) in closing handshake", )
9
10 args = sys.argv[1:]
11 fn = os.path.abspath(args[0])
12 indexPath = os.path.dirname(fn)
13 relativeToIndex = lambda f: os.path.join(indexPath, f)
14 print "index", fn
15
16
17 failures = []
18 warnings = []
19
20 with open(fn, 'r') as fh:
21 index = json.load(fh)
22 for servername, serverResults in index.items():
23 for test in serverResults:
24 result = serverResults[test]
25 if ((result['behavior'] not in EXPECTED_BEHAVIOR) or
26 result['behaviorClose'] not in EXPECTED_BEHAVIOR_CLOSE):
27 with open(relativeToIndex(result['reportfile'])) as rh:
28 report = json.load(rh)
29 if (report.get('wasNotCleanReason', '') in WARNINGS and
30 VARIANT != 'release'):
31 warnings.append(report)
32 else:
33 failures.append(report)
34
35
36 if warnings:
37 print >> sys.stderr, json.dumps(warnings, indent=2)
38 print >> sys.stderr, 'there was %s warnings' % len(warnings)
39
40 if failures:
41 print >> sys.stderr, json.dumps(failures, indent=2)
42 print >> sys.stderr, 'there was %s failures' % len(failures)
43 sys.exit(1)