To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / SCRIPTS / summarise.sh

History | View | Annotate | Download (3.9 KB)

1
#!/bin/bash
2

    
3
mydir=$(dirname "$0")
4
case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
5

    
6
. "$mydir"/include.sh
7

    
8
plugindirs="$@"
9
if [ -z "$plugindirs" ]; then
10
    plugindirs=$(cat METADATA/repos.txt | grep -v vamp-plugin-sdk | grep -v vamp-plugin-tester | awk '{ print $1; }')
11
else 
12
    for dir in $plugindirs ; do
13
	if [ ! -d "$dir" ]; then
14
	    echo "ERROR: Directory $dir not found"
15
	    usage
16
	fi
17
    done
18
fi
19

    
20
platforms=$(echo REPORTS/[a-z]* | sed 's/REPORTS\///g')
21

    
22
cat <<EOF
23
<head>
24
<style type="text/css">
25
.good { color: blue; }
26
.dl { color: green; }
27
.bad { color: red; }
28
table { border: 1px solid black; }
29
tr { padding: 0px; background-color: #f0f0f0; }
30
tr.odd { background-color: #fafafa; }
31
td, th { text-align: center; min-width: 4em; margin: 0px; padding: 0.4em; }
32
td.pluginname { text-align: right; }
33
td.build, th.build { border-left: 1px solid black; }
34
th { border-bottom: 1px solid black; }
35
a, a:link, a:visited, a:hover, a:active { text-decoration: none; }
36
</style>
37
</head>
38
<body>
39
<table cellspacing=0>
40
<tr><th></th>
41
EOF
42

    
43
for p in $platforms ; do
44
    echo "<th colspan=4 class=build>$p</th>"
45
done
46

    
47
echo "</tr>"
48
echo "<tr><td></td>"
49

    
50
for p in $platforms ; do
51
    echo "<th class=build>Build</th>"
52
    echo "<th>Test</th>"
53
    echo "<th>Check</th>"
54
    echo "<th>Package</th>"
55
done
56

    
57
echo "</tr>"
58

    
59
yes="<span class=good>&#x2714;</span>"
60
no="<span class=bad>&#x2718;</span>"
61
unknown="<span class=unknown>?</span>"
62
missing=""
63
dl="<span class=dl>&#x21a7;</span>"
64

    
65
# The possible outcomes are:
66
#
67
# OK - built, passed tests, passed env checks
68
# BUILD_FAILED - build failed so unable to test
69
# TEST_FAILED - build succeeded, tests failed, env checks passed
70
# ENV_FAILED - build succeeded, tests passed, env checks failed
71
# TEST_FAILED ENV_FAILED - build succeeded, tests and env checks failed
72

    
73
emit_build() {
74
    reportdir="$1"
75
    dir="$2"
76
    outcome="$3"
77
    echo "<a href='$reportdir/$dir.build.txt'>"
78
    case "$outcome" in
79
	BUILD_FAILED) echo "$no";;
80
	*_FAILED*) echo "$yes";;
81
	OK) echo "$yes";;
82
	*) echo "$unknown";;
83
    esac
84
    echo "</a>"
85
}
86

    
87
emit_test() {
88
    reportdir="$1"
89
    dir="$2"
90
    outcome="$3"
91
    case "$outcome" in
92
	BUILD_FAILED) echo "$missing";;
93
	*)
94
	    echo "<a href='$reportdir/$dir.test.txt'>"
95
	    case "$outcome" in
96
		*TEST_FAILED*) echo "$no";;
97
		*_FAILED*) echo "$yes";;
98
		OK) echo "$yes";;
99
		*) echo "$unknown";;
100
	    esac
101
	    echo "</a>" ;;
102
    esac
103
}
104

    
105
emit_env() {
106
    reportdir="$1"
107
    dir="$2"
108
    outcome="$3"
109
    echo "<a href='$reportdir/$dir.envtest.txt'>"
110
    case "$outcome" in
111
	BUILD_FAILED) echo "$missing";;
112
	*)
113
	    echo "<a href='$reportdir/$dir.envtest.txt'>"
114
	    case "$outcome" in
115
		*ENV_FAILED*) echo "$no";;
116
		*FAILED*) echo "$yes";;
117
		OK) echo "$yes";;
118
		*) echo "$unknown";;
119
	    esac
120
	    echo "</a>" ;;
121
    esac
122
}
123

    
124
emit_package() {
125
    platform="$1"
126
    dir="$2"
127
    outcome="$3"
128
    case "$outcome" in
129
	OK)
130
	    id=$(vcs_id "$dir")
131
	    package=$(echo "PACKAGES/$platform/$dir-$platform-$id".*)
132
	    echo "package is $package" 1>&2
133
	    if [ -f "$package" ]; then
134
		echo "<a href='$package'>$dl</a>"
135
	    fi
136
	    ;;
137
	*) ;;
138
    esac
139
}
140

    
141
oddeven=odd
142

    
143
for dir in $plugindirs ; do
144
    dir=${dir%/*}
145
    echo "<tr class=$oddeven><td class=pluginname>$dir</td>"
146
    for p in $platforms ; do
147
	reportdir="REPORTS/$p"
148
	summary="$reportdir/$dir.summary.txt"
149
	if [ -f "$summary" ]; then
150
	    outcome=$(cat "$summary" | awk -F: '{ print $2; }' | sed 's/^ *//' | fmt -100)
151
	    echo "<td class=build>"
152
	    emit_build "$reportdir" "$dir" "$outcome"
153
	    echo "</td><td>"
154
	    emit_test "$reportdir" "$dir" "$outcome"
155
	    echo "</td><td>"
156
	    emit_env "$reportdir" "$dir" "$outcome"
157
	    echo "</td><td>"
158
	    emit_package "$p" "$dir" "$outcome"
159
	    echo "</td>"
160
	else
161
	    echo "<td class=build>$missing</td>"
162
	    echo "<td>$missing</td>"
163
	    echo "<td>$missing</td>"
164
	    echo "<td>$missing</td>"
165
	fi
166
    done
167
    echo "</tr>"
168
    if [ "$oddeven" = odd ]; then
169
	oddeven=even
170
    else
171
	oddeven=odd
172
    fi
173
done
174

    
175
echo "</table></body>"