From ff68c83b203d046364cd9d2a2cb773f44c268549 Mon Sep 17 00:00:00 2001 From: zichguan-amd Date: Wed, 4 Mar 2026 16:23:31 -0500 Subject: [PATCH] Fix test summary output and upload test logs Signed-off-by: zichguan-amd --- .github/build_tools/skip_tests.txt | 0 .../build-rocm-examples-reusable.yml | 29 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) delete mode 100644 .github/build_tools/skip_tests.txt diff --git a/.github/build_tools/skip_tests.txt b/.github/build_tools/skip_tests.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.github/workflows/build-rocm-examples-reusable.yml b/.github/workflows/build-rocm-examples-reusable.yml index b169795c23..47cdfdc8f2 100644 --- a/.github/workflows/build-rocm-examples-reusable.yml +++ b/.github/workflows/build-rocm-examples-reusable.yml @@ -172,7 +172,9 @@ jobs: - name: Test summary if: ${{ !cancelled() }} run: | - if [ ! -f ctest_output.log ]; then + LAST_TEST_LOG="build/Testing/Temporary/LastTest.log" + if [ ! -f ctest_output.log ] || [ ! -f "${LAST_TEST_LOG}" ]; then + echo "No test logs found." >> $GITHUB_STEP_SUMMARY exit 0 fi @@ -182,24 +184,39 @@ jobs: SUMMARY=$(grep "tests passed" ctest_output.log) echo "**${SUMMARY}**" >> $GITHUB_STEP_SUMMARY - FAILED=$(grep -c "Failed" ctest_output.log || true) - - if [ "${FAILED}" -gt 0 ]; then + FAILED_LOG="build/Testing/Temporary/LastTestsFailed.log" + if [ -s "${FAILED_LOG}" ]; then echo "## Failed tests" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - cat build/Testing/Temporary/LastTestsFailed.log >> $GITHUB_STEP_SUMMARY + cat "${FAILED_LOG}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "
Failed tests output" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - awk '/^[[:space:]]*Start[[:space:]]+[0-9]+:/ {found=0; next} /\*\*\*/ && !/Passed/ {found=1} found' ctest_output.log >> $GITHUB_STEP_SUMMARY + + awk ' + /^[0-9]+\/[0-9]+ Testing: / { if (inblock && failed) print block; block = $0; inblock = 1; failed = 0; seen_result = 0; next } + inblock { block = block "\n" $0 } + /^Test Failed\.$/ { failed = 1; seen_result = 1 } + /^Test Passed\.$/ { seen_result = 1 } + /^-+$/ { if (inblock && seen_result) { if (failed) print block; inblock = 0 } } + END { if (inblock && failed) print block } + ' "${LAST_TEST_LOG}" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY echo "
" >> $GITHUB_STEP_SUMMARY fi + - name: Upload test logs + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: ctest-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }} + path: build/Testing/Temporary/ + - name: Clean the workspace if: always() run: find "$GITHUB_WORKSPACE" -mindepth 1 -delete