2010-12-01 21:27:52 +01:00
|
|
|
#!/usr/bin/env bash
|
2010-06-10 08:48:00 +02:00
|
|
|
|
2013-09-08 17:53:30 +02:00
|
|
|
set -eu
|
|
|
|
|
2010-06-10 08:48:00 +02:00
|
|
|
fixed=0
|
|
|
|
success=0
|
|
|
|
failed=0
|
|
|
|
broken=0
|
|
|
|
total=0
|
|
|
|
|
|
|
|
for file
|
|
|
|
do
|
|
|
|
while read type value
|
|
|
|
do
|
|
|
|
case $type in
|
|
|
|
fixed)
|
2019-06-10 20:39:23 +02:00
|
|
|
fixed=$((fixed + value)) ;;
|
2010-06-10 08:48:00 +02:00
|
|
|
success)
|
2019-06-10 20:39:23 +02:00
|
|
|
success=$((success + value)) ;;
|
2010-06-10 08:48:00 +02:00
|
|
|
failed)
|
2019-06-10 20:39:23 +02:00
|
|
|
failed=$((failed + value)) ;;
|
2010-06-10 08:48:00 +02:00
|
|
|
broken)
|
2019-06-10 20:39:23 +02:00
|
|
|
broken=$((broken + value)) ;;
|
2010-06-10 08:48:00 +02:00
|
|
|
total)
|
2019-06-10 20:39:23 +02:00
|
|
|
total=$((total + value)) ;;
|
2010-06-10 08:48:00 +02:00
|
|
|
esac
|
|
|
|
done <"$file"
|
|
|
|
done
|
|
|
|
|
2019-06-10 20:39:23 +02:00
|
|
|
pluralize_s () { [ "$1" -eq 1 ] && s='' || s='s'; }
|
2010-09-17 22:53:47 +02:00
|
|
|
|
|
|
|
echo "Notmuch test suite complete."
|
2019-06-10 20:39:23 +02:00
|
|
|
|
|
|
|
if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]; then
|
|
|
|
pluralize_s "$total"
|
|
|
|
printf "All $total test$s "
|
|
|
|
if [ "$broken" -eq 0 ]; then
|
|
|
|
echo "passed."
|
|
|
|
else
|
|
|
|
pluralize_s "$broken"
|
|
|
|
echo "behaved as expected ($broken expected failure$s)."
|
|
|
|
fi
|
2010-09-17 22:53:47 +02:00
|
|
|
else
|
2019-06-10 20:39:23 +02:00
|
|
|
echo "$success/$total tests passed."
|
|
|
|
if [ "$broken" -ne 0 ]; then
|
|
|
|
pluralize_s "$broken"
|
|
|
|
echo "$broken broken test$s failed as expected."
|
|
|
|
fi
|
|
|
|
if [ "$fixed" -ne 0 ]; then
|
|
|
|
pluralize_s "$fixed"
|
|
|
|
echo "$fixed broken test$s now fixed."
|
|
|
|
fi
|
|
|
|
if [ "$failed" -ne 0 ]; then
|
|
|
|
pluralize_s "$failed"
|
|
|
|
echo "$failed test$s failed."
|
|
|
|
fi
|
2010-09-17 22:53:47 +02:00
|
|
|
fi
|
|
|
|
|
2019-06-10 20:39:23 +02:00
|
|
|
skipped=$((total - fixed - success - failed - broken))
|
|
|
|
if [ "$skipped" -ne 0 ]; then
|
|
|
|
pluralize_s "$skipped"
|
|
|
|
echo "$skipped test$s skipped."
|
2010-09-17 22:53:47 +02:00
|
|
|
fi
|
2013-09-08 17:53:30 +02:00
|
|
|
|
2015-09-24 13:13:30 +02:00
|
|
|
# Note that we currently do not consider skipped tests as failing the
|
|
|
|
# build.
|
|
|
|
|
2019-06-10 20:39:23 +02:00
|
|
|
if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]
|
2013-09-08 17:53:30 +02:00
|
|
|
then
|
2019-06-10 20:39:23 +02:00
|
|
|
exit 0
|
2013-09-08 17:53:30 +02:00
|
|
|
else
|
2019-06-10 20:39:23 +02:00
|
|
|
exit 1
|
2013-09-08 17:53:30 +02:00
|
|
|
fi
|