Skip to content

Commit 4c6fa28

Browse files
committed
step
1 parent 2f77791 commit 4c6fa28

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extra/ci_collect_logs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def artifact_count(count, status, icons):
5050

5151
return f"<code>{count:>3}</code>{icons[status]}"
5252

53-
def example_name(sketch_name):
53+
def test_name(sketch_name):
5454
match = re.search(r'libraries/([^/]+)/(.*)', sketch_name)
5555
if match:
5656
lib = match.group(1)
@@ -62,7 +62,7 @@ def example_name(sketch_name):
6262
TEST_MATRIX = {}
6363
BOARD_SUMMARY = {}
6464

65-
def log_test(name, board, exceptions, status, issues, job_link=None):
65+
def log_test(board, name, exceptions, status, issues, job_link=None):
6666
"""
6767
Logs individual test results into the TEST_MATRIX dictionary.
6868
"""
@@ -140,14 +140,14 @@ def process_build_reports():
140140
# Get raw data from report file
141141
REPORT_FILE = f"arduino-{subarch}-{board}.json"
142142
if not os.path.exists(REPORT_FILE):
143-
log_test('CI test', board, FAILURE, "Report file not found.")
143+
log_test(board, 'CI test', exceptions, FAILURE, "Report file not found.")
144144
continue # Skip to the next board
145145

146146
try:
147147
with open(REPORT_FILE, 'r') as f:
148148
report_data = json.load(f)
149149
except Exception as e:
150-
log_test('CI test', board, FAILURE, f"Error reading report file: {e}")
150+
log_test(board, 'CI test', exceptions, FAILURE, f"Error reading report file: {e}")
151151
continue # Skip to the next board
152152

153153
# Extract data from the report file
@@ -156,7 +156,7 @@ def process_build_reports():
156156

157157
reports = report_data.get('boards', [{}])[0].get('sketches', [])
158158
if not reports:
159-
log_test('CI test', board, FAILURE, "Test report is empty, check CI log.", job_link)
159+
log_test(board, 'CI test', exceptions, FAILURE, "Test report is empty, check CI log.", job_link)
160160
continue # Skip to the next board
161161

162162
# 7. Sketch Loop: Iterate through individual sketch reports
@@ -175,7 +175,7 @@ def process_build_reports():
175175
else:
176176
status = PASS
177177

178-
log_test(SKETCH_NAME, board, status, sketch_issues, job_link)
178+
log_test(board, SKETCH_NAME, exceptions, status, sketch_issues, job_link)
179179

180180
artifacts = set(item['artifact'] for item in ALL_BOARD_DATA)
181181

@@ -231,7 +231,7 @@ def process_build_reports():
231231

232232
# Print the test matrix
233233

234-
header_row = f"<tr><th colspan='2'><code>${artifact}</code></th>"
234+
header_row = f"<tr><th colspan='2'><code>{artifact} tests</code></th>"
235235
for board in artifact_boards:
236236
status = BOARD_SUMMARY[board]['status']
237237
header_col = f"<code>{board}</code>"
@@ -257,7 +257,7 @@ def process_build_reports():
257257

258258
sketch_status = max(sketch_status, status)
259259
row_data += f"<td align='center'>{TEST_STATUS[status]}</td>"
260-
name_link = example_name(sketch_name)
260+
name_link = test_name(sketch_name)
261261
if issues:
262262
sketch_id = sketch_name.replace('/', '_').replace(' ', '_').replace('-', '_')
263263
name_link = f"<a href='#user-content-{artifact}_{sketch_id}'>{name_link}</a>"
@@ -298,7 +298,7 @@ def process_build_reports():
298298
for sketch_status in [ERROR, EXPECTED_ERROR, WARNING]:
299299
for sketch_name, test_log_map in sketch_log_map.get(sketch_status, []):
300300
sketch_id = sketch_name.replace('/', '_').replace(' ', '_').replace('-', '_')
301-
print(f"<a name='{artifact}_{sketch_id}'/><details name='{artifact}'><summary><code>{artifact}</code> logs for {TEST_STATUS[sketch_status]} {example_name(sketch_name)}</summary>\n")
301+
print(f"<a name='{artifact}_{sketch_id}'/><details name='{artifact}'><summary><code>{artifact}</code> logs for {TEST_STATUS[sketch_status]} {test_name(sketch_name)}</summary>\n")
302302
print("<table>")
303303
for test_status in [ERROR, EXPECTED_ERROR, WARNING]:
304304
for text in test_log_map.get(test_status, []):

0 commit comments

Comments
 (0)