Have sanity build output a Bazel test summary XML file.
This should avoid needing to download the full log file to find out which check failed, hopefully preventing inadvertent force submits. PiperOrigin-RevId: 312587296 Change-Id: I788b2bddecbbdf5203c55e28b07c306a0e228fcf
This commit is contained in:
parent
92d97dfc59
commit
d53c999feb
@ -702,23 +702,37 @@ done
|
|||||||
# Print summary of build results
|
# Print summary of build results
|
||||||
COUNTER=0
|
COUNTER=0
|
||||||
echo "==== Summary of sanity check results ===="
|
echo "==== Summary of sanity check results ===="
|
||||||
|
TESTCASE_XML=''
|
||||||
while [[ ${COUNTER} -lt "${#SANITY_STEPS[@]}" ]]; do
|
while [[ ${COUNTER} -lt "${#SANITY_STEPS[@]}" ]]; do
|
||||||
INDEX=COUNTER
|
INDEX=COUNTER
|
||||||
((INDEX++))
|
((INDEX++))
|
||||||
|
|
||||||
echo "${INDEX}. ${SANITY_STEPS[COUNTER]}: ${SANITY_STEPS_DESC[COUNTER]}"
|
echo "${INDEX}. ${SANITY_STEPS[COUNTER]}: ${SANITY_STEPS_DESC[COUNTER]}"
|
||||||
|
TESTCASE_XML="${TESTCASE_XML} <testcase name=\"${SANITY_STEPS_DESC[COUNTER]}\" status=\"run\" classname=\"\" time=\"0\">"
|
||||||
|
|
||||||
if [[ ${STEP_EXIT_CODES[COUNTER]} == "0" ]]; then
|
if [[ ${STEP_EXIT_CODES[COUNTER]} == "0" ]]; then
|
||||||
printf " ${COLOR_GREEN}PASS${COLOR_NC}\n"
|
printf " ${COLOR_GREEN}PASS${COLOR_NC}\n"
|
||||||
else
|
else
|
||||||
printf " ${COLOR_RED}FAIL${COLOR_NC}\n"
|
printf " ${COLOR_RED}FAIL${COLOR_NC}\n"
|
||||||
|
TESTCASE_XML="${TESTCASE_XML} <failure message=\"\" type=\"\"/>"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TESTCASE_XML="${TESTCASE_XML} </testcase>"
|
||||||
|
|
||||||
((COUNTER++))
|
((COUNTER++))
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "${FAIL_COUNTER} failed; ${PASS_COUNTER} passed."
|
echo "${FAIL_COUNTER} failed; ${PASS_COUNTER} passed."
|
||||||
|
|
||||||
|
mkdir -p "${KOKORO_ARTIFACTS_DIR}/${KOKORO_JOB_NAME}/summary"
|
||||||
|
echo '<?xml version="1.0" encoding="UTF-8"?>'\
|
||||||
|
'<testsuites name="1" tests="1" failures="0" errors="0" time="0">'\
|
||||||
|
'<testsuite name="Kokoro Summary" tests="'"$((FAIL_COUNTER + PASS_COUNTER))"\
|
||||||
|
'" failures="'"${FAIL_COUNTER}"'" errors="0" time="0">'\
|
||||||
|
"${TESTCASE_XML}"'</testsuite></testsuites>'\
|
||||||
|
> "${KOKORO_ARTIFACTS_DIR}/${KOKORO_JOB_NAME}/summary/sponge_log.xml"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [[ ${FAIL_COUNTER} == "0" ]]; then
|
if [[ ${FAIL_COUNTER} == "0" ]]; then
|
||||||
printf "Sanity checks ${COLOR_GREEN}PASSED${COLOR_NC}\n"
|
printf "Sanity checks ${COLOR_GREEN}PASSED${COLOR_NC}\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user