1 |
548 |
jeremybenn |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
# Copyright (C) 2010 Embecosm Limited
|
4 |
|
|
|
5 |
|
|
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
6 |
|
|
|
7 |
|
|
# This file is a script to count the results from a set of test directories.
|
8 |
|
|
|
9 |
|
|
# This program is free software; you can redistribute it and/or modify it
|
10 |
|
|
# under the terms of the GNU General Public License as published by the Free
|
11 |
|
|
# Software Foundation; either version 3 of the License, or (at your option)
|
12 |
|
|
# any later version.
|
13 |
|
|
|
14 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
17 |
|
|
# more details.
|
18 |
|
|
|
19 |
|
|
# You should have received a copy of the GNU General Public License along
|
20 |
|
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
21 |
|
|
|
22 |
|
|
# ------------------------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
# Look for the different GNU results in different directories. We put the
|
25 |
|
|
# results to a temporary file, to allow us to suck out the summary as well.
|
26 |
|
|
|
27 |
|
|
# The argument is the list of log files to process.
|
28 |
|
|
|
29 |
|
|
tmpf=/tmp/check-results-$$
|
30 |
|
|
|
31 |
|
|
# Get the individual results if we have any. Note that we don't check for the
|
32 |
553 |
jeremybenn |
# strings at start of line, since they may have FTP prompts showing. Don't
|
33 |
|
|
# print out lines which have no tests at all.
|
34 |
548 |
jeremybenn |
echo " PASS FAIL XPASS XFAIL UNRES UNSUP UNTES TOTAL"
|
35 |
|
|
|
36 |
|
|
if ls $* > /dev/null 2>&1
|
37 |
|
|
then
|
38 |
|
|
for logfile in $*
|
39 |
|
|
do
|
40 |
|
|
logfile_base=`basename ${logfile}`
|
41 |
|
|
tname=`echo ${logfile_base} | sed -e 's/\.log//'`
|
42 |
|
|
p=`grep 'PASS:' ${logfile} | grep -v 'XPASS' | wc -l`
|
43 |
|
|
f=`grep 'FAIL:' ${logfile} | grep -v 'XFAIL' | wc -l`
|
44 |
|
|
xp=`grep 'XPASS:' ${logfile} | wc -l`
|
45 |
|
|
xf=`grep 'XFAIL:' ${logfile} | wc -l`
|
46 |
|
|
ur=`grep 'UNRESOLVED:' ${logfile} | wc -l`
|
47 |
|
|
us=`grep 'UNSUPPORTED:' ${logfile} | wc -l`
|
48 |
|
|
ut=`grep 'UNTESTED:' ${logfile} | wc -l`
|
49 |
|
|
tot=`echo "${p} ${f} + ${xp} + ${xf} + ${ur} + ${us} + ${ut} + p" | dc`
|
50 |
553 |
jeremybenn |
|
51 |
|
|
if [ "x${tot}" != "x0" ]
|
52 |
|
|
then
|
53 |
|
|
printf "%-25s %5d %5d %5d %5d %5d %5d %5d %5d\n" \
|
54 |
|
|
${tname} ${p} ${f} ${xp} ${xf} ${ur} ${us} ${ut} ${tot} | \
|
55 |
|
|
tee -a ${tmpf}
|
56 |
|
|
fi
|
57 |
548 |
jeremybenn |
done
|
58 |
|
|
fi
|
59 |
|
|
|
60 |
|
|
# Total each column, if we have any results
|
61 |
|
|
if ls $* > /dev/null 2>&1
|
62 |
|
|
then
|
63 |
|
|
pt=`cut -c 27-31 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
64 |
|
|
ft=`cut -c 33-37 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
65 |
|
|
xpt=`cut -c 39-43 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
66 |
|
|
xft=`cut -c 45-49 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
67 |
|
|
urt=`cut -c 51-55 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
68 |
|
|
ust=`cut -c 57-61 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
69 |
|
|
utt=`cut -c 63-67 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
70 |
|
|
tott=`cut -c 69-73 ${tmpf} | sed -e '2,$s/$/ +/' -e '$s/$/ p/' | dc`
|
71 |
|
|
else
|
72 |
|
|
pt=0
|
73 |
|
|
ft=0
|
74 |
|
|
xpt=0
|
75 |
|
|
xft=0
|
76 |
|
|
urt=0
|
77 |
|
|
ust=0
|
78 |
|
|
utt=0
|
79 |
|
|
tott=0
|
80 |
|
|
fi
|
81 |
|
|
|
82 |
|
|
rm -f ${tmpf}
|
83 |
|
|
|
84 |
|
|
echo "----- ----- ----- ----- ----- ----- ----- ----- -----"
|
85 |
|
|
printf "TOTAL %5d %5d %5d %5d %5d %5d %5d %5d\n" \
|
86 |
|
|
${pt} ${ft} ${xpt} ${xft} ${urt} ${ust} ${utt} ${tott}
|
87 |
|
|
|