-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import json, os | ||
|
||
def suite_conformance(suites): | ||
res = { | ||
"t": 0, | ||
"o": 0, | ||
"i": 0, | ||
"p": 0 | ||
} | ||
|
||
for suite in suites.values(): | ||
if "s" in suite.keys(): | ||
conformance = suite_conformance(suite["s"]) | ||
res["t"] += conformance["t"] | ||
res["o"] += conformance["o"] | ||
res["i"] += conformance["i"] | ||
res["p"] += conformance["p"] | ||
|
||
if "t" in suite.keys(): | ||
for test in suite["t"].values(): | ||
res["t"] += 1 | ||
if "s" in test.keys() and "r" in test.keys(): | ||
if test["s"] == "O" and test["r"] == "O": | ||
res["o"] += 1 | ||
elif test["s"] == "I" and test["r"] == "I": | ||
res["i"] += 1 | ||
elif test["s"] == "P" or test["r"] == "P": | ||
res["p"] += 1 | ||
elif "s" in test.keys(): | ||
if test["s"] == "O": | ||
res["o"] += 1 | ||
elif test["s"] == "I": | ||
res["i"] += 1 | ||
elif test["s"] == "P": | ||
res["p"] += 1 | ||
else: | ||
if test["r"] == "O": | ||
res["o"] += 1 | ||
elif test["r"] == "I": | ||
res["i"] += 1 | ||
elif test["r"] == "P": | ||
res["p"] += 1 | ||
|
||
return res | ||
|
||
def version_conformance(suites): | ||
res = {} | ||
|
||
for suite in suites.values(): | ||
if "s" in suite.keys(): | ||
versions = version_conformance(suite["s"]) | ||
for key in versions.keys(): | ||
if key not in res.keys(): | ||
res[key] = 0 | ||
|
||
res[key] += versions[key] | ||
|
||
if "t" in suite.keys(): | ||
for test in suite["t"].values(): | ||
if "v" in test.keys(): | ||
version = test["v"] | ||
if version != 255: | ||
key = str(version) | ||
if key not in res.keys(): | ||
res[key] = 0 | ||
|
||
res[key] += 1 | ||
|
||
return res | ||
|
||
def fix_tests(tests): | ||
fixed = {} | ||
|
||
for test in tests: | ||
name = test["n"] | ||
if test["n"] in fixed: | ||
if test["s"]: | ||
fixed[name]["s"] = test["r"] | ||
else: | ||
fixed[name]["r"] = test["r"] | ||
else: | ||
fixed[name] = {} | ||
|
||
if "v" in test.keys(): | ||
fixed[name]["v"] = test["v"] | ||
|
||
if "s" in test.keys(): | ||
if test["s"]: | ||
fixed[name]["s"] = test["r"] | ||
else: | ||
fixed[name]["r"] = test["r"] | ||
else: | ||
fixed[name]["r"] = test["r"] | ||
|
||
return fixed | ||
|
||
def fix_suite(suites): | ||
fixed = {} | ||
for suite in suites: | ||
name = suite["n"] | ||
fixed[name] = {} | ||
|
||
if "s" in suite.keys(): | ||
fixed[name]["s"] = fix_suite(suite["s"]) | ||
fixed[name]["a"] = suite_conformance(fixed[name]["s"]) | ||
fixed[name]["v"] = version_conformance(fixed[name]["s"]) | ||
|
||
if "t" in suite.keys(): | ||
fixed[name]["t"] = fix_tests(suite["t"]) | ||
|
||
return fixed | ||
|
||
def fix_all(latest): | ||
fixed = { | ||
"c": latest["c"], | ||
"u": latest["u"], | ||
"n": latest["r"]["n"], | ||
"r": fix_suite(latest["r"]["s"]), | ||
} | ||
|
||
fixed["a"] = suite_conformance(fixed["r"]) | ||
fixed["v"] = version_conformance(fixed["r"]) | ||
|
||
return fixed | ||
|
||
for top, dirs, files in os.walk("./refs/tags"): | ||
for dir in dirs: | ||
print("Fixing " + dir) | ||
with open("./refs/tags/" + dir + "/latest.json") as latest_f: | ||
latest = json.load(latest_f) | ||
|
||
latest_fixed = fix_all(latest) | ||
|
||
with open("./refs/tags/" + dir + "/latest.json", 'w') as latest_of: | ||
json.dump(latest_fixed, latest_of, separators=(',', ':'), ensure_ascii=False) | ||
|
||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.