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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
|
#!/bin/sh
#
# ci-qa-summary [platform ...]
#
# Used in concert with CI daily QA runs and data stashed at
# https://github.com/performancecopilot/qa-reports
#
# Based on qa-summary that processes the logs from pcp-daily rather than CI.
#
_usage()
{
echo "Usage: $0 [options] [platform ...]"
echo 'Options:'
echo ' -a report all tests, not just failing ones (implies -n)'
echo ' -c report counts not percentages'
echo ' -d debug'
echo ' -f sort failure map on %fail [default sort on Test #]'
echo ' -m N minimum number of tests run to be reported [default 60]'
echo ' -n report skipped and not run tests (reported as "S" and "N")'
exit 1
}
# must have tried to run at least this number to qualify
# 40 = > -g sanity circa PCP 2.7.8 [minus a few not runs]
#
minrun=40
base=$HOME/src/qa-reports
debug=false
aflag=false
cflag=false
nflag=false
failsort=false
while getopts 'acdfm:n?' p
do
case "$p"
in
a) aflag=true
nflag=true
;;
c) cflag=true
;;
d) debug=true
;;
f) failsort=true
;;
m) minrun=$OPTARG
;;
n) nflag=true
;;
?) _usage
# NOTREACHED
esac
done
shift `expr $OPTIND - 1`
sts=0
if $debug
then
tmp=`pwd`/tmp-summary
trap "exit \$sts" 0 1 2 3 15
else
tmp=/var/tmp/$$
trap "rm -f $tmp.*; exit \$sts" 0 1 2 3 15
fi
rm -f $tmp.*
if [ $# -eq 0 ]
then
set -- `[ -d $base ] && cd $base && echo test-*`
fi
_what()
{
cat
}
echo "==== QA Summary ===="
echo
echo " Run Pass Fail Nrun Host"
numqahosts=0
for vm
do
cd $base
if [ -d "$vm" ]
then
cd "$vm"
vmdir="$vm"
else
vmdir=`echo ${vm}*`
if [ -d "$vmdir" ]
then
cd "$vmdir"
else
echo "$vm: arrrgggh no $base/${vm}* directory"
continue
fi
fi
basevmname=$vmdir
rm -f $tmp.seen $tmp.found
log=test.log
if [ -f $log ]
then
touch $tmp.seen
$debug && echo "Debug: == $vmdir log=$log =="
# Looking for
# Not run: 008 009 022 096 114 117 130 148 164 212 223 233 284 290 307 311 329 330 331 332 333 348 361 370 377 390 420 441 442 476 477 478 480 506 512 545 570 584 640 652 654 712 713 714
# Failures: 062 169 244
# Failed 3 of 516 tests
# Passed all 67 tests
#
rm -f $tmp.dbg
if grep -E '^((Not run:)|Failures:|(Failed [0-9][0-9]* of [0-9][0-9]* tests)|(Passed all [0-9][0-9]* tests)|Info:|===)' <$log >/dev/null
then
awk <$log >$tmp.out '
/^Not run:/ { notrun = NF - 2
nrlist = $3
for (i = 4; i <= NF; i++) nrlist = nrlist " " $i
state = 1
print NR,": Not run: start: notrun=" notrun >"'$tmp.dbg'"
next
}
/^Failures:/ { nfail = NF - 1
flist = $2
for (i = 3; i <= NF; i++) flist = flist " " $i
print NR,": Failures: start: nfail=" nfail >"'$tmp.dbg'"
state = 2
next
}
/^Failed [0-9][0-9]* of [0-9][0-9]* tests/ {
failed = $2
run = $4
state = 3
}
/^Passed all [0-9][0-9]* tests/ {
failed = 0
run = $3
print NR,": Passed all: " run >"'$tmp.dbg'"
state = 3
}
state == 3 { if (run >= '$minrun') printf "%4d %4d %4d %4d|%s|%s+%s\n",run,run-failed,failed,notrun,"'$basevmname'",flist,nrlist
state = 0
notrun = 0
nfail = 0
}
/^Info:/ {
state = 0
notrun = 0
nfail = 0
next
}
/^===/ {
state = 0
notrun = 0
nfail = 0
next
}
state == 1 { # Not run: list broken over multiple lines
notrun += NF
for (i = 1; i <= NF; i++) nrlist = nrlist " " $i
print NR,": Not run: add",NF," notrun=" notrun >"'$tmp.dbg'"
next
}
state == 2 { # Failures: list broken over multiple lines
nfail += NF
for (i = 1; i <= NF; i++) flist = flist " " $i
print NR,": Failures: add",NF," nfail=" nfail >"'$tmp.dbg'"
next
}
END { print NR,": END state=" state >"'$tmp.dbg'"
}'
$debug && sed -e 's/^/Debug: line:/' <$tmp.dbg
mv $tmp.out $tmp.tmp
# $tmp.tmp line is ...
# <#run> <#passed> <#failed> <#notrun>|<hostname>|<failed list...>+<passed list>
if [ -s $tmp.tmp ]
then
if $debug
then
echo "Debug: summary lines ..."
sed -e 's/^/Debug: /' <$tmp.out
fi
sed -e 's/|[^|]*$//' <$tmp.tmp | _what >>$tmp.found
nfail=`awk <$tmp.tmp '{print $3}'`
if [ $nfail -gt 0 ]
then
sed -e 's/.*|//' -e 's/+.*//' <$tmp.tmp \
| tr ' ' '\012' \
| sed -e "s/\$/ X $basevmname/" >>$tmp.map
fi
nnotrun=0
if $nflag
then
nnotrun=`sed -e 's/|.*//' <$tmp.tmp | awk '{print $4}'`
if [ $nnotrun -gt 0 ]
then
sed -e 's/.*+//' <$tmp.tmp \
| tr ' ' '\012' \
| sed -e "s/\$/ N $basevmname/" >>$tmp.map
fi
fi
if $aflag || [ $nfail -gt 0 -o $nnotrun -gt 0 ]
then
# pass lines look like:
# [97%] 1055 16s ...
# or
# [97%] 1055
# and may contain " [fixup]"
#
sed <$log -n \
-e 's/ \[fixup]//' \
-e '/^[[0-9][0-9]*%] [0-9][0-9]* [0-9][0-9]*s \.\.\./{
s/.*] //
s/ .*//
p
}' \
-e '/^[[0-9][0-9]*%] [0-9][0-9]*$/{
s/.*] //
p
}' \
| sed -e "s/\$/ P $basevmname/" >>$tmp.map
fi
else
$debug && echo "Debug: tag lines, but no QA results found"
fi
else
$debug && echo "Debug: no QA result tag lines found"
fi
fi
if [ -f $tmp.found ]
then
sort $tmp.found
cat $tmp.found >>$tmp.counts
numqahosts=`expr $numqahosts + 1`
else
if [ -f $tmp.seen ]
then
printf "%-30s|%s\n" "Daily runs, but no QA" "$basevmname" | _what
elif [ ! -f $tmp.seen ]
then
printf "%-30s|%s\n" "No daily runs" "$basevmname" | _what
fi
fi
done
if [ -f $tmp.counts ]
then
awk <$tmp.counts '
{ nrun += $1; nfail += $3 }
END { printf "Summary: %d run, %d failed (%.2f%%)\n", nrun, nfail, 100*nfail/nrun }'
fi
if [ -f $tmp.map ]
then
echo
if $nflag
then
echo "==== QA Failure (X), Not Run (N) and Skipped (S) Map ===="
else
echo "==== QA Failure (X) and Not Run or Skipped (-) Map ===="
fi
echo
( ( sed -e 's/.* //' <$tmp.map | sort | uniq ) \
; echo "---" \
; sort -n $tmp.map \
; echo "END" \
) \
| awk '
function heading() {
printf "%4.4s","Host"
printf " %5.5s","" # %fail or nfail (-c)
if (nflag) {
printf " %5.5s","" # %pass or npass (-c)
printf " %5.5s","" # %nrun or nnrun (-c)
}
for (i = 0; i < nh; i++) {
h = host[i]
sub(/^test-/, "", h)
sub(/-container$/, "", h)
sub(/-direct$/, "", h)
if (h ~ /^centos/)
sub(/centos/, "c", h)
else if (h ~ /^debian/)
sub(/debian/, "d", h)
else if (h ~ /^fedora_rawhide/)
h = "frh"
else if (h ~ /^fedora/)
sub(/fedora/, "f", h)
else if (h ~ /^ubuntu/)
h = "u" substr(h, length(h)-3 ,2)
printf " %3.3s",h
}
printf "\n"
printf "%4.4s","Test"
if (cflag)
printf " %5.5s"," fail"
else
printf " %5.5s","%fail"
if (nflag) {
if (cflag) {
printf " %5.5s"," pass"
printf " %5.5s"," nrun"
}
else {
printf " %5.5s","%pass"
printf " %5.5s","%nrun"
}
}
for (i = 0; i < nh; i++) printf " %3.3s"," "
printf " %4.4s QA groups\n","Test"
}
BEGIN { nh = 0
state = 0
aflag = 0
if ("'"$aflag"'" == "true") aflag = 1
cflag = 0
if ("'"$cflag"'" == "true") cflag = 1
nflag = 0
if ("'"$nflag"'" == "true") nflag = 1
}
$1 == "---" { heading()
state = 1
last = $1
next
}
state == 0 { host[nh] = $1; nh++; next }
$1 != last { if (last != "---") {
skip = nrun = bad = pass = 0
for (i = 0; i < nh; i++) {
if (fail[i] == "X") bad++
if (fail[i] == "P") {
pass++
fail[i] = " "
}
if (fail[i] == "N") {
nrun++
if (nflag == 0) fail[i] = "-"
}
if (fail[i] == "S") {
skip++
if (nflag == 0) fail[i] = "-"
}
}
if (bad > 0 || aflag) {
printf "%04d",last
if (nflag && nrun == nh) {
printf " NOT RUN AT ALL "
}
else {
if (cflag)
printf " %4d",bad
else
printf " %3d%%",int(0.5+100*bad/'$numqahosts')
if (nflag) {
if (cflag) {
printf " %4d",pass
printf " %4d",nrun+skip
}
else {
if (pass > 0)
printf " %3d%%",int(0.5+100*pass/'$numqahosts')
else
printf " %3d%%",0
if (nrun > 0)
printf " %3d%%",int(0.5+100*(nrun+skip)/'$numqahosts')
else
printf " %3d%%",0
}
}
}
for (i = 0; i < nh; i++) {
printf " %3.3s",fail[i]
}
printf " %4.4s ",last
cmd = "( grep \"^" last " \" $HOME/src/pcp/qa/group || echo \"??? missing in QA group file\" ) | sed -e \"s/^[0-9]* //\""
system(cmd)
}
}
for (i = 0; i < nh; i++) fail[i] = "S"
last = $1
}
$1 == last { for (i = 0; i < nh; i++) {
if (host[i] == $3) {
fail[i] = $2
break
}
}
}' \
| sed \
-e 's/ remote//' \
-e 's/ sanity//' \
-e 's/ ostest//' \
-e 's/ local//' \
-e 's/ oss//' \
-e 's/ #[0-9][0-9]*//g' >$tmp.mapout
num=0
if $failsort
then
sed -e 2q <$tmp.mapout
sed -e 1,2d <$tmp.mapout \
| sort --key=2,2nr --key=1,1n
else
cat $tmp.mapout
fi \
| while read line
do
if [ "$num" -eq 20 ]
then
sed -e 2q <$tmp.mapout
num=0
else
num=`expr $num + 1`
fi
echo "$line"
done \
| sed -e 's/^0/ /'
sed -n -e 2p -e 2q <$tmp.mapout
sed -n -e 1p -e 1q <$tmp.mapout
fi
|