unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 6322854675fdae93cabbf55ac9a7cb531513b00d 1699 bytes (raw)
name: test/aggregate-results.sh 	 # note: path name is non-authoritative(*)

 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
#!/usr/bin/env bash

set -eu

fixed=0
success=0
failed=0
broken=0
total=0

for file
do
	while read type value
	do
		case $type in
		'')
			continue ;;
		fixed)
			fixed=$(($fixed + $value)) ;;
		success)
			success=$(($success + $value)) ;;
		failed)
			failed=$(($failed + $value)) ;;
		broken)
			broken=$(($broken + $value)) ;;
		total)
			total=$(($total + $value)) ;;
		esac
	done <"$file"
done

pluralize () {
    case $2 in
	1)
	    case $1 in
		test)
		    echo test ;;
		failure)
		    echo failure ;;
	    esac
	    ;;
	*)
	    case $1 in
		test)
		    echo tests ;;
		failure)
		    echo failures ;;
	    esac
	    ;;
    esac
}

echo "Notmuch test suite complete."
if [ "$fixed" = "0" ] && [ "$failed" = "0" ]; then
    tests=$(pluralize "test" $total)
    printf "All $total $tests "
    if [ "$broken" = "0" ]; then
	echo "passed."
    else
	failures=$(pluralize "failure" $broken)
	echo "behaved as expected ($broken expected $failures)."
    fi;
else
    echo "$success/$total tests passed."
    if [ "$broken" != "0" ]; then
	tests=$(pluralize "test" $broken)
	echo "$broken broken $tests failed as expected."
    fi
    if [ "$fixed" != "0" ]; then
	tests=$(pluralize "test" $fixed)
	echo "$fixed broken $tests now fixed."
    fi
    if [ "$failed" != "0" ]; then
	tests=$(pluralize "test" $failed)
	echo "$failed $tests failed."
    fi
fi

skipped=$(($total - $fixed - $success - $failed - $broken))
if [ "$skipped" != "0" ]; then
    tests=$(pluralize "test" $skipped)
    echo "$skipped $tests skipped."
fi

# Note that we currently do not consider skipped tests as failing the
# build.

if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 ]
then
    exit 0
else
    exit 1
fi

debug log:

solving 63228546 ...
found 63228546 in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).