Skip to content

Commit 4ed8aff

Browse files
committed
Fixed latest.json result files for the new format (#3348)
1 parent 60e827a commit 4ed8aff

File tree

11 files changed

+462
-155
lines changed

11 files changed

+462
-155
lines changed

dev/bench/index.html

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="UTF-8" />
@@ -8,9 +8,20 @@
88
/>
99
<style>
1010
html {
11-
font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto,
12-
Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
13-
Helvetica, Arial, sans-serif;
11+
font-family:
12+
BlinkMacSystemFont,
13+
-apple-system,
14+
"Segoe UI",
15+
Roboto,
16+
Oxygen,
17+
Ubuntu,
18+
Cantarell,
19+
"Fira Sans",
20+
"Droid Sans",
21+
"Helvetica Neue",
22+
Helvetica,
23+
Arial,
24+
sans-serif;
1425
-webkit-font-smoothing: antialiased;
1526
font-size: 16px;
1627
}
@@ -286,7 +297,7 @@
286297
.sort(
287298
(a, b) =>
288299
arr.filter((v) => v === a).length -
289-
arr.filter((v) => v === b).length
300+
arr.filter((v) => v === b).length,
290301
)
291302
.pop();
292303
}
@@ -335,7 +346,7 @@
335346

336347
// Render header
337348
document.getElementById("last-update").textContent = new Date(
338-
data.lastUpdate
349+
data.lastUpdate,
339350
).toString();
340351
const repoLink = document.getElementById("repository-link");
341352
repoLink.href = data.repoUrl;
@@ -470,7 +481,7 @@
470481
for (const [benchName, benches] of benchSet.entries()) {
471482
const benchUnit = unit.get(benchName);
472483
charts.push(
473-
renderGraph(graphsElem, benchName, benchUnit, benches)
484+
renderGraph(graphsElem, benchName, benchUnit, benches),
474485
);
475486
}
476487
return charts;
@@ -483,10 +494,10 @@
483494
}
484495

485496
const darkModeCheckbox = document.querySelector(
486-
".dark-mode-toggle input[type=checkbox]"
497+
".dark-mode-toggle input[type=checkbox]",
487498
);
488499
const darkModeHandle = document.querySelector(
489-
".dark-mode-toggle .handle"
500+
".dark-mode-toggle .handle",
490501
);
491502
darkModeCheckbox.addEventListener("change", async (e) => {
492503
document.body.classList.toggle("dark");

playground/index.html

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
<!doctype html><html><head><meta charset="utf-8"/><title>Boa Playground</title><link href="assets/bootstrap.min.css" rel="stylesheet"/><meta name="viewport" content="width=device-width,initial-scale=1"/><script defer="defer" src="app.js"></script></head><style>header {
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Boa Playground</title>
6+
<link href="assets/bootstrap.min.css" rel="stylesheet" />
7+
<meta name="viewport" content="width=device-width,initial-scale=1" />
8+
<script defer="defer" src="app.js"></script></head
9+
><style>
10+
header {
211
display: flex;
312
align-items: center;
413
}
@@ -50,4 +59,18 @@
5059
.output {
5160
min-height: 100px;
5261
}
53-
}</style><body><div class="container"><header><img class="demo__img" src="./assets/logo.svg"/><h1>Boa Playground</h1></header><div class="demo__repl"><div class="textbox"></div><p data-testid="output" class="output"></p></div></div></body></html>
62+
}
63+
</style>
64+
<body>
65+
<div class="container">
66+
<header>
67+
<img class="demo__img" src="./assets/logo.svg" />
68+
<h1>Boa Playground</h1>
69+
</header>
70+
<div class="demo__repl">
71+
<div class="textbox"></div>
72+
<p data-testid="output" class="output"></p>
73+
</div>
74+
</div>
75+
</body>
76+
</html>

test262/fix.py

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
import json
2+
import os
3+
4+
5+
def suite_conformance(suite):
6+
global function_suite
7+
res = {
8+
"t": 0,
9+
"o": 0,
10+
"i": 0,
11+
"p": 0
12+
}
13+
14+
if "s" in suite.keys():
15+
for subSuite in suite["s"].values():
16+
conformance = suite_conformance(subSuite)
17+
res["t"] += conformance["t"]
18+
res["o"] += conformance["o"]
19+
res["i"] += conformance["i"]
20+
res["p"] += conformance["p"]
21+
22+
if "t" in suite.keys():
23+
for testName in suite["t"].keys():
24+
test = suite["t"][testName]
25+
26+
res["t"] += 1
27+
if "s" in test.keys() and "r" in test.keys():
28+
if test["s"] == "O" and test["r"] == "O":
29+
res["o"] += 1
30+
elif test["s"] == "I" and test["r"] == "I":
31+
res["i"] += 1
32+
elif test["s"] == "P" or test["r"] == "P":
33+
res["p"] += 1
34+
elif "s" in test.keys():
35+
if test["s"] == "O":
36+
res["o"] += 1
37+
elif test["s"] == "I":
38+
res["i"] += 1
39+
elif test["s"] == "P":
40+
res["p"] += 1
41+
else:
42+
if test["r"] == "O":
43+
res["o"] += 1
44+
elif test["r"] == "I":
45+
res["i"] += 1
46+
elif test["r"] == "P":
47+
res["p"] += 1
48+
49+
return res
50+
51+
52+
def version_conformance(suite):
53+
res = {}
54+
55+
if "s" in suite.keys():
56+
for subSuite in suite["s"].values():
57+
versions = version_conformance(subSuite)
58+
for key in versions.keys():
59+
if key not in res.keys():
60+
res[key] = {
61+
"t": 0,
62+
"o": 0,
63+
"i": 0,
64+
"p": 0
65+
}
66+
67+
res[key]["t"] += versions[key]["t"]
68+
res[key]["o"] += versions[key]["o"]
69+
res[key]["i"] += versions[key]["i"]
70+
res[key]["p"] += versions[key]["p"]
71+
72+
if "t" in suite.keys():
73+
for testName in suite["t"].keys():
74+
test = suite["t"][testName]
75+
76+
if "v" in test.keys():
77+
version = test["v"]
78+
if version != 255:
79+
key = str(version)
80+
if key not in res.keys():
81+
res[key] = {
82+
"t": 0,
83+
"o": 0,
84+
"i": 0,
85+
"p": 0
86+
}
87+
88+
res[key]["t"] += 1
89+
if "s" in test.keys() and "r" in test.keys():
90+
if test["s"] == "O" and test["r"] == "O":
91+
res[key]["o"] += 1
92+
elif test["s"] == "I" and test["r"] == "I":
93+
res[key]["i"] += 1
94+
elif test["s"] == "P" or test["r"] == "P":
95+
res[key]["p"] += 1
96+
elif "s" in test.keys():
97+
if test["s"] == "O":
98+
res[key]["o"] += 1
99+
elif test["s"] == "I":
100+
res[key]["i"] += 1
101+
elif test["s"] == "P":
102+
res[key]["p"] += 1
103+
else:
104+
if test["r"] == "O":
105+
res[key]["o"] += 1
106+
elif test["r"] == "I":
107+
res[key]["i"] += 1
108+
elif test["r"] == "P":
109+
res[key]["p"] += 1
110+
111+
return res
112+
113+
114+
def fix_tests(tests):
115+
fixed = {}
116+
117+
for test in tests:
118+
name = test["n"]
119+
if test["n"] in fixed:
120+
if test["s"]:
121+
fixed[name]["s"] = test["r"]
122+
else:
123+
fixed[name]["r"] = test["r"]
124+
else:
125+
fixed[name] = {}
126+
127+
if "v" in test.keys():
128+
fixed[name]["v"] = test["v"]
129+
130+
if "s" in test.keys():
131+
if test["s"]:
132+
fixed[name]["s"] = test["r"]
133+
else:
134+
fixed[name]["r"] = test["r"]
135+
else:
136+
fixed[name]["r"] = test["r"]
137+
138+
return fixed
139+
140+
141+
def fix_suite(suites):
142+
fixed = {}
143+
for suite in suites:
144+
name = suite["n"]
145+
fixed[name] = {}
146+
147+
if "s" in suite.keys():
148+
fixed[name]["s"] = fix_suite(suite["s"])
149+
150+
if "t" in suite.keys():
151+
fixed[name]["t"] = fix_tests(suite["t"])
152+
153+
fixed[name]["a"] = suite_conformance(fixed[name])
154+
fixed[name]["v"] = version_conformance(fixed[name])
155+
156+
return fixed
157+
158+
159+
def fix_all(latest):
160+
fixed = {
161+
"c": latest["c"],
162+
"u": latest["u"],
163+
"r": fix_suite(latest["r"]["s"]),
164+
"a": {
165+
"t": 0,
166+
"o": 0,
167+
"i": 0,
168+
"p": 0
169+
},
170+
"v": {},
171+
}
172+
173+
for suite in fixed["r"].values():
174+
fixed["a"]["t"] += suite["a"]["t"]
175+
fixed["a"]["o"] += suite["a"]["o"]
176+
fixed["a"]["i"] += suite["a"]["i"]
177+
fixed["a"]["p"] += suite["a"]["p"]
178+
179+
for key in suite["v"].keys():
180+
if key not in fixed["v"].keys():
181+
fixed["v"][key] = {
182+
"t": 0,
183+
"o": 0,
184+
"i": 0,
185+
"p": 0
186+
}
187+
188+
fixed["v"][key]["t"] += suite["v"][key]["t"]
189+
fixed["v"][key]["o"] += suite["v"][key]["o"]
190+
fixed["v"][key]["i"] += suite["v"][key]["i"]
191+
fixed["v"][key]["p"] += suite["v"][key]["p"]
192+
193+
return fixed
194+
195+
196+
def fix_file(file_name):
197+
with open(file_name) as latest_f:
198+
latest = json.load(latest_f)
199+
fixed_latest = fix_all(latest)
200+
201+
with open(file_name, 'w') as latest_of:
202+
json.dump(fixed_latest, latest_of, separators=(
203+
',', ':'), ensure_ascii=False)
204+
205+
return fixed_latest
206+
207+
208+
def clean_main(latest):
209+
with open("./refs/heads/main/results.json") as results_f:
210+
results = json.load(results_f)
211+
fixed_results = []
212+
for result in results:
213+
fixed_results.append({
214+
"c": result["c"],
215+
"u": result["u"],
216+
"a": result["a"],
217+
})
218+
219+
fixed_results[-1] = {
220+
"c": latest["c"],
221+
"u": latest["u"],
222+
"a": latest["a"],
223+
}
224+
225+
with open("./refs/heads/main/results.json", 'w') as results_of:
226+
json.dump(fixed_results, results_of, separators=(
227+
',', ':'), ensure_ascii=False)
228+
229+
230+
def clean_old(file_name, results):
231+
fixed_results = [{
232+
"c": results["c"],
233+
"u": results["u"],
234+
"a": results["a"],
235+
}]
236+
237+
with open(file_name, 'w') as results_of:
238+
json.dump(fixed_results, results_of, separators=(
239+
',', ':'), ensure_ascii=False)
240+
241+
242+
for top, dirs, files in os.walk("./refs/tags"):
243+
for dir in dirs:
244+
print("Fixing " + dir)
245+
results = fix_file("./refs/tags/" + dir + "/latest.json")
246+
clean_old("./refs/tags/" + dir + "/results.json", results)
247+
248+
if os.path.exists("./refs/tags/" + dir + "/features.json"):
249+
os.remove("./refs/tags/" + dir + "/features.json")
250+
251+
print("Fixing main branch")
252+
results = fix_file("./refs/heads/main/latest.json")
253+
clean_main(results)
254+
if os.path.exists("./refs/heads/main/features.json"):
255+
os.remove("./refs/heads/main/features.json")

0 commit comments

Comments
 (0)