1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#!/usr/bin/env bash
set -eo pipefail
borderTop() {
echo
echo "========================================================================================================================="
}
borderBottom() {
echo "========================================================================================================================="
echo
}
testOutputDir="./.testoutput"
testOutputPattern="${testOutputDir}/*/*.output.txt"
panicFailures=()
buildFailures=()
for file in ${testOutputPattern}; do
set +e
if [[ "${file}" == *".windows."* ]]; then
panicMsgs="$(iconv -f utf-16 -t utf-8 "${file}" | grep --fixed-strings 'panic:')"
buildFailureMsgs="$(iconv -f utf-16 -t utf-8 "${file}" | grep --fixed-strings '[build failed]')"
else
panicMsgs="$(grep --fixed-strings 'panic:' "${file}")"
buildFailureMsgs="$(grep --fixed-strings '[build failed]' "${file}")"
fi
set -e
if [ -n "${panicMsgs}" ]; then
panicFailures+=("${file}: ${panicMsgs}")
fi
if [ -n "${buildFailureMsgs}" ]; then
buildFailures+=("${file}: ${buildFailureMsgs}")
fi
done
if [ ${#panicFailures[@]} -gt 0 ] || [ ${#buildFailures[@]} -gt 0 ]; then
borderTop
if [ ${#buildFailures[@]} -gt 0 ]; then
echo "Build failures found:"
for failure in "${buildFailures[@]}"; do
echo " ${failure}"
done
fi
if [ ${#panicFailures[@]} -gt 0 ]; then
echo "Panic failures found:"
for failure in "${panicFailures[@]}"; do
echo " ${failure}"
done
fi
borderBottom
exit 1
fi
borderTop
echo "No unexpected test failures found!"
borderBottom
|