Skip to content

Commit ef4ec54

Browse files
committed
Fix test summary output and upload test logs
Signed-off-by: zichguan-amd <zichuan.guan@amd.com>
1 parent ef0afd0 commit ef4ec54

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

.github/build_tools/skip_tests.txt

Whitespace-only changes.

.github/workflows/build-rocm-examples-reusable.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ jobs:
172172
- name: Test summary
173173
if: ${{ !cancelled() }}
174174
run: |
175-
if [ ! -f ctest_output.log ]; then
175+
LAST_TEST_LOG="build/Testing/Temporary/LastTest.log"
176+
if [ ! -f ctest_output.log ] || [ ! -f "${LAST_TEST_LOG}" ]; then
177+
echo "No test logs found." >> $GITHUB_STEP_SUMMARY
176178
exit 0
177179
fi
178180
@@ -182,24 +184,39 @@ jobs:
182184
SUMMARY=$(grep "tests passed" ctest_output.log)
183185
echo "**${SUMMARY}**" >> $GITHUB_STEP_SUMMARY
184186
185-
FAILED=$(grep -c "Failed" ctest_output.log || true)
186-
187-
if [ "${FAILED}" -gt 0 ]; then
187+
FAILED_LOG="build/Testing/Temporary/LastTestsFailed.log"
188+
if [ -s "${FAILED_LOG}" ]; then
188189
echo "## Failed tests" >> $GITHUB_STEP_SUMMARY
189190
echo "" >> $GITHUB_STEP_SUMMARY
190191
echo '```' >> $GITHUB_STEP_SUMMARY
191-
cat build/Testing/Temporary/LastTestsFailed.log >> $GITHUB_STEP_SUMMARY
192+
cat "${FAILED_LOG}" >> $GITHUB_STEP_SUMMARY
192193
echo '```' >> $GITHUB_STEP_SUMMARY
193194
echo "" >> $GITHUB_STEP_SUMMARY
194195
195196
echo "<details><summary>Failed tests output</summary>" >> $GITHUB_STEP_SUMMARY
196197
echo "" >> $GITHUB_STEP_SUMMARY
197198
echo '```' >> $GITHUB_STEP_SUMMARY
198-
awk '/^[[:space:]]*Start[[:space:]]+[0-9]+:/ {found=0; next} /\*\*\*/ && !/Passed/ {found=1} found' ctest_output.log >> $GITHUB_STEP_SUMMARY
199+
200+
awk '
201+
/^[0-9]+\/[0-9]+ Testing: / { if (inblock && failed) print block; block = $0; inblock = 1; failed = 0; seen_result = 0; next }
202+
inblock { block = block "\n" $0 }
203+
/^Test Failed\.$/ { failed = 1; seen_result = 1 }
204+
/^Test Passed\.$/ { seen_result = 1 }
205+
/^-+$/ { if (inblock && seen_result) { if (failed) print block; inblock = 0 } }
206+
END { if (inblock && failed) print block }
207+
' "${LAST_TEST_LOG}" >> $GITHUB_STEP_SUMMARY
208+
199209
echo '```' >> $GITHUB_STEP_SUMMARY
200210
echo "</details>" >> $GITHUB_STEP_SUMMARY
201211
fi
202212
213+
- name: Upload test logs
214+
if: ${{ !cancelled() }}
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: ctest-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}
218+
path: build/Testing/Temporary/**/*
219+
203220
- name: Clean the workspace
204221
if: always()
205222
run: find "$GITHUB_WORKSPACE" -mindepth 1 -delete

0 commit comments

Comments
 (0)