]> git.notmuchmail.org Git - notmuch/blobdiff - test/aggregate-results.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / aggregate-results.sh
index 05fb0a92af89113b08fb86b936c3ba039d460083..6845fcf0b2ae06b55e8a94e926c1f30484e3f14d 100755 (executable)
@@ -7,9 +7,17 @@ success=0
 failed=0
 broken=0
 total=0
+all_skipped=0
+rep_failed=0
 
 for file
 do
+       if [ ! -f "$file" ]; then
+               echo "'$file' does not exist!"
+               rep_failed=$((rep_failed + 1))
+               continue
+       fi
+       has_total=0
        while read type value
        do
                case $type in
@@ -22,16 +30,24 @@ do
                broken)
                        broken=$((broken + value)) ;;
                total)
-                       total=$((total + value)) ;;
+                       total=$((total + value))
+                       has_total=1
+                       if [ "$value" -eq 0 ]; then
+                               all_skipped=$((all_skipped + 1))
+                       fi
                esac
        done <"$file"
+       if [ "$has_total" -eq 0 ]; then
+               echo "'$file' lacks 'total ...'; results may be inconsistent."
+               failed=$((failed + 1))
+       fi
 done
 
 pluralize_s () { [ "$1" -eq 1 ] && s='' || s='s'; }
 
 echo "Notmuch test suite complete."
 
-if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]; then
+if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ]; then
        pluralize_s "$total"
        printf "All $total test$s "
        if [ "$broken" -eq 0 ]; then
@@ -61,11 +77,21 @@ if [ "$skipped" -ne 0 ]; then
        pluralize_s "$skipped"
        echo "$skipped test$s skipped."
 fi
+if [ "$all_skipped" -ne 0 ]; then
+       pluralize_s "$all_skipped"
+       echo "All tests in $all_skipped file$s skipped."
+fi
+
+if [ "$rep_failed" -ne 0 ]; then
+       pluralize_s "$rep_failed"
+       echo "$rep_failed test$s failed to report results."
+fi
 
 # Note that we currently do not consider skipped tests as failing the
 # build.
 
-if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]
+if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] &&
+       [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ]
 then
        exit 0
 else