Skip to content

Commit 976a4ff

Browse files
committed
Add table generator
1 parent c52f4a8 commit 976a4ff

File tree

2 files changed

+102
-7
lines changed

2 files changed

+102
-7
lines changed

.gitignore

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
tools/xtensa-esp32-elf
2-
tools/dist
3-
tools/esptool
4-
tools/esptool.exe
5-
tools/mkspiffs/mkspiffs
6-
tools/mkspiffs/mkspiffs.exe
1+
tools/
2+
.vale/
3+
docs/
4+
tests/
5+
76
.DS_Store
8-
97
#Ignore files built by Visual Studio/Visual Micro
108
[Dd]ebug*/
119
[Rr]elease*/
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import json
2+
import sys
3+
import os
4+
from datetime import datetime
5+
6+
SUCCESS_SYMBOL = ":white_check_mark:"
7+
FAILURE_SYMBOL = ":x:"
8+
9+
# Load the JSON file passed as argument to the script
10+
with open(sys.argv[1], "r") as f:
11+
data = json.load(f)
12+
tests = sorted(data["stats"]["suite_details"], key=lambda x: x["name"])
13+
14+
# Generate the table
15+
16+
print("## Runtime Tests Report")
17+
print("")
18+
19+
try:
20+
if os.environ["IS_FAILING"] == "true":
21+
print(f"{FAILURE_SYMBOL} **The test workflows are failing. Please check the run logs.** {FAILURE_SYMBOL}")
22+
print("")
23+
else:
24+
print(f"{SUCCESS_SYMBOL} **The test workflows are passing.** {SUCCESS_SYMBOL}")
25+
print("")
26+
except KeyError:
27+
pass
28+
29+
print("### Validation Tests")
30+
print("")
31+
32+
proc_test_data = {}
33+
target_list = []
34+
35+
for test in tests:
36+
if test["name"].startswith("performance_"):
37+
continue
38+
39+
_, platform, target, test_name = test["name"].split("_", 3)
40+
test_name = test_name[:-1]
41+
42+
if target not in target_list:
43+
target_list.append(target)
44+
45+
if platform not in proc_test_data:
46+
proc_test_data[platform] = {}
47+
48+
if test_name not in proc_test_data[platform]:
49+
proc_test_data[platform][test_name] = {}
50+
51+
if target not in proc_test_data[platform][test_name]:
52+
proc_test_data[platform][test_name][target] = {
53+
"failures": 0,
54+
"total": 0
55+
}
56+
57+
proc_test_data[platform][test_name][target]["total"] += test["tests"]
58+
proc_test_data[platform][test_name][target]["failures"] += test["failures"]
59+
60+
target_list = sorted(target_list)
61+
62+
for platform in proc_test_data:
63+
print(f"#### {platform.capitalize()}")
64+
print("")
65+
print("Test", end="")
66+
67+
for target in target_list:
68+
# Make target name uppercase and add hyfen if not esp32
69+
if target != "esp32":
70+
target = target.replace("esp32", "esp32-")
71+
72+
print(f"|{target.upper()}", end="")
73+
74+
print("")
75+
print("-" + "|:-:" * len(target_list))
76+
77+
for test_name, targets in proc_test_data[platform].items():
78+
print(f"{test_name}", end="")
79+
for target in target_list:
80+
if target in targets:
81+
test_data = targets[target]
82+
print(f"|{test_data['total']-test_data['failures']}/{test_data['total']}", end="")
83+
if test_data["failures"] > 0:
84+
print(f" {FAILURE_SYMBOL}", end="")
85+
else:
86+
print(f" {SUCCESS_SYMBOL}", end="")
87+
else:
88+
print("|-", end="")
89+
print("")
90+
91+
print("\n")
92+
print(f"Generated on: {datetime.now().strftime('%Y/%m/%d %H:%M:%S')}")
93+
94+
try:
95+
print(f"[Build, Hardware and QEMU run](https://github.com/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['BUILD_RUN_ID']}) / [Wokwi run](https://github.com/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['WOKWI_RUN_ID']})")
96+
except KeyError:
97+
pass

0 commit comments

Comments
 (0)