v / vlib / net / websocket / tests / autobahn / fuzzing_server / check_results.py
46 lines · 36 sloc · 1.23 KB · ec973f5c6e32a8871a71a1fb9924bb8b3670967c
Raw
1import json
2
3nr_of_client_errs = 0
4nr_of_client_tests = 0
5
6nr_of_server_errs = 0
7nr_of_server_tests = 0
8
9with open("/reports/clients/index.json") as f:
10 data = json.load(f)
11
12 for i in data["v-client"]:
13 # Count errors
14 if (
15 data["v-client"][i]["behavior"] == "FAILED"
16 or data["v-client"][i]["behaviorClose"] == "FAILED"
17 ):
18 nr_of_client_errs = nr_of_client_errs + 1
19
20 nr_of_client_tests = nr_of_client_tests + 1
21
22with open("/reports/servers/index.json") as f:
23 data = json.load(f)
24
25 for i in data["AutobahnServer"]:
26 if (
27 data["AutobahnServer"][i]["behavior"] == "FAILED"
28 or data["AutobahnServer"][i]["behaviorClose"] == "FAILED"
29 ):
30 nr_of_server_errs = nr_of_server_errs + 1
31
32 nr_of_server_tests = nr_of_server_tests + 1
33
34if nr_of_client_errs > 0 or nr_of_server_errs > 0:
35 print(
36 "FAILED AUTOBAHN TESTS, CLIENT ERRORS {0}(of {1}), SERVER ERRORS {2}(of {3})".format(
37 nr_of_client_errs, nr_of_client_tests, nr_of_server_errs, nr_of_server_tests
38 )
39 )
40 exit(1)
41
42print(
43 "TEST SUCCESS!, CLIENT TESTS({0}), SERVER TESTS ({1})".format(
44 nr_of_client_tests, nr_of_server_tests
45 )
46)
47