This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack
executable file
·221 lines (189 loc) · 3.98 KB
/
pack
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#!/bin/sh
tmp=/var/tmp/$$
sts=1
trap "rm -f summary $tmp.*; exit \$sts" 0 1 2 3 15
_usage()
{
echo "Usage: $0 [-n] [-p pct]"
sts=1
exit
}
nflag=false
threshold=5 # include tests with >= $threshold % failures in tarball
while getopts np:? c
do
case $c
in
n) # dry run
nflag=true
;;
p)
threshold=$OPTARG
;;
?)
_usage
# NOTREACHED
;;
esac
done
shift `expr $OPTIND - 1`
if [ $# -gt 0 ]
then
_usage
# NOTREACHED
fi
# make sure whatami.out is up to date
#
update-whatami.out
rm -rf summary [0-9]*
pcp-qa-summary -fr >summary
$nflag && echo "Created summary"
BASE=$HOME/Logs/by-vm
sed <summary \
-e 's/\([0-9]\) *\([0-9][0-9]*\)%/\1 \2/' \
-e 's/ / ./g' \
| awk '
NF == 0 { next }
$1 == "Host" { want = 1
for (i = 4; i <= NF; i++) host[i-4] = $i
nhost = NF - 4
next
}
$1 == "Test" { next }
want == 1 && $2 >= '$threshold' {
for (i = 3; i <= nhost+3; i++) {
if ($i == "X")
print $1,host[i-3]
}
}
want == 1 && $2 < '$threshold' { exit }' \
| while read seq host
do
case "$host"
in
bo)
host=bozo
;;
bv)
host=bozo-vm
;;
bl)
host=bozo-laptop
;;
gr)
host=grundy.sgi.com
;;
fu)
host=fuji
;;
[0-9][0-9])
host=vm$host
;;
*)
echo "Botch: don't know what to do with host $host"
exit
;;
esac
echo "$seq" >>$tmp.tmp
if [ ! -d $BASE/$host ]
then
echo "Botch: missing dir $BASE/$host"
exit
fi
if [ ! -d $BASE/$host/qa ]
then
echo "Botch: missing dir $BASE/$host/qa"
exit
fi
if [ -f $BASE/$host/qa/$seq.out.bad ]
then
echo "$seq `sum <$BASE/$host/qa/$seq.out.bad`" >>$tmp.sum
else
echo "Warning: missing file $BASE/$host/qa/$seq.out.bad"
fi
[ -d $seq ] || mkdir $seq
for file in $seq.out $seq.out.bad $seq.full
do
if [ -f $BASE/$host/qa/$file ]
then
cp $BASE/$host/qa/$file "$seq/$host:$file"
fi
done
done
tar czf files.tgz summary [0-9]*[0-9]
if $nflag
then
echo "Created files.tgz"
else
:
fi
rm -f README
cat <<End-of-File >README
QA Status from Ken McDonell's QA Farm in Melbourne
Last updated: `date`
End-of-File
grep "^Summary:" summary >>README
cat <<End-of-File >>README
QA Test Fail Failure Signatures (number of different failure patterns)
End-of-File
export LC_COLLATE=C
sort $tmp.tmp \
| uniq -c \
| while read count seq
do
signatures=`grep "^$seq " $tmp.sum \
| sort \
| uniq -c \
| sed -e 's/^ *//' -e 's/ .*//' \
| sort -nr \
| tr '[\012]' '[ ]'`
if [ "$seq" -lt 1000 ]
then
printf ' %3s' $seq
else
printf ' %4s' $seq
fi
printf ' %4d %s\n' $count "$signatures"
done \
| sort -nr -k 2,2 -k 1,1 >>README
cat <<End-of-File >>README
^ ^
| |
| +-- A B C ... means one failure signature occurred A times,
| another occurred B times, a third occurred C times, ...
+-- total number of failures for this test, equals A+B+C+...
The tarball in this directory (files.tgz) contains .out, .out.bad and
possibly .full files for all failing test cases where a test failed
on at least ${threshold}% of the QA hosts. The files are gathered into
one directory per test, with the files renamed to include a hostname:
prefix to disambiguate similar files from different QA hosts.
End-of-File
cat summary >>README
if $nflag
then
echo "Created README"
else
:
fi
$nflag || rm -rf [0-9]*
rm -f /tmp/msg
cat <<End-of-File >/tmp/msg
Details for the most commonly failing tests are available from
https://github.com/performancecopilot/qa-status
=== Synopsis ===
End-of-File
awk <README >>/tmp/msg '
BEGIN { want = 1 }
want == 0 && $1 == "Summary:" { want = 1 }
$3 == "Failures" { print "Tests that failed on at least '${threshold}'% of the QA hosts ..."; print "" }
want == 1 { print }
NR == 2 { want = 0 }'
if $nflag
then
echo "Created /tmp/msg"
else
echo "Remember ... "
echo "\$ git commit -a -m 'QA Status as of `date +%Y%m%d`'; git push; sendcommitmail"
fi
sts=0
exit