Skip to content

Commit 15ed51a

Browse files
committed
[run-qemu] consume test_progs json report
This change makes the qemu action consume the report generated by test_progs (introduced in kernel-patches/vmtest#207) and generates github annotations [0] of the summary as well as the failing tests. It also generates a summary of the job [1]. The end goal is to provide an easier way for people to directly access the tests that failed instead of having to scroll through pages of logs. [0] https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message [1] https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary Signed-off-by: Manu Bretelle <[email protected]>
1 parent e87dff7 commit 15ed51a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

run-qemu/run.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,46 @@ fi
104104

105105
foldable end shutdown
106106

107+
# Try to collect json summary from VM
108+
if [[ -n ${KERNEL_TEST} && ${KERNEL_TEST} =~ test_progs* ]]
109+
then
110+
guestfish --ro -a "$IMG" -i download "/${KERNEL_TEST}.json" "${KERNEL_TEST}.json"
111+
if [ $? ]
112+
then
113+
## Job summary
114+
echo "# Tests summary" >> "${GITHUB_STEP_SUMMARY}"
115+
read -r T_SUCCESS T_SUCCESS_SUBTEST T_SKIPPED T_FAILED < \
116+
<(jq -r < "${KERNEL_TEST}.json" '"\(.success) \(.success_subtest) \(.skipped) \(.failed)"')
117+
echo "- :heavy_check_mark: Success: ${T_SUCCESS}/${T_SUCCESS_SUBTEST}
118+
- :next_track_button: Skipped: ${T_SKIPPED}
119+
- :x: Failed: ${T_FAILED}" >> "${GITHUB_STEP_SUMMARY}"
120+
121+
summary_annotation="Success: ${T_SUCCESS}/${T_SUCCESS_SUBTEST}, Skipped: ${T_SKIPPED}, Failed: ${T_FAILED}"
122+
echo "::notice::${summary_annotation}"
123+
124+
# Print failed tests to summary/annotations
125+
if [ "${T_FAILED}" -gt 0 ]
126+
then
127+
echo "# Failed tests" >> "${GITHUB_STEP_SUMMARY}"
128+
jq -r < "${KERNEL_TEST}.json" \
129+
'.results | map([
130+
if .failed then "#\(.number) \(.name)" else empty end,
131+
(
132+
. as {name: $tname, number: $tnum} | .subtests | map(
133+
if .failed then "#\($tnum)/\(.number) \($tname)/\(.name)" else empty end
134+
)
135+
)
136+
]) | flatten | .[]' | \
137+
while read -r line
138+
do
139+
# Job summary
140+
echo "${line}" >> "${GITHUB_STEP_SUMMARY}"
141+
# Annotations
142+
echo "::error::${line}"
143+
done
144+
fi
145+
fi
146+
fi
107147
# Final summary - Don't use a fold, keep it visible
108148
echo -e "\033[1;33mTest Results:\033[0m"
109149
echo -e "$exitfile" | while read result; do

0 commit comments

Comments
 (0)