Home | History | Annotate | Line # | Download | only in contrib
dg-extract-results.sh revision 1.1.1.2
      1      1.1  mrg #! /bin/sh
      2      1.1  mrg 
      3      1.1  mrg # For a specified tool and optional list of test variants, extract
      4      1.1  mrg # test results from one or more test summary (.sum) files and combine
      5      1.1  mrg # the results into a new test summary file, sent to the standard output.
      6      1.1  mrg # The resulting file can be used with test result comparison scripts for
      7      1.1  mrg # results from tests that were run in parallel.  See usage() below.
      8      1.1  mrg 
      9  1.1.1.2  mrg # Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation
     10      1.1  mrg # Contributed by Janis Johnson <janis187 (at] us.ibm.com>
     11      1.1  mrg #
     12      1.1  mrg # This file is part of GCC.
     13      1.1  mrg #
     14      1.1  mrg # GCC is free software; you can redistribute it and/or modify
     15      1.1  mrg # it under the terms of the GNU General Public License as published by
     16      1.1  mrg # the Free Software Foundation; either version 3, or (at your option)
     17      1.1  mrg # any later version.
     18      1.1  mrg #
     19      1.1  mrg # GCC is distributed in the hope that it will be useful,
     20      1.1  mrg # but WITHOUT ANY WARRANTY; without even the implied warranty of
     21      1.1  mrg # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     22      1.1  mrg # GNU General Public License for more details.
     23      1.1  mrg #
     24      1.1  mrg # You should have received a copy of the GNU General Public License
     25      1.1  mrg # along with GCC; see the file COPYING.  If not, write to
     26      1.1  mrg # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
     27      1.1  mrg # Boston, MA 02110-1301, USA.
     28      1.1  mrg 
     29      1.1  mrg PROGNAME=dg-extract-results.sh
     30      1.1  mrg 
     31      1.1  mrg usage() {
     32      1.1  mrg   cat <<EOF >&2
     33      1.1  mrg Usage: $PROGNAME [-t tool] [-l variant-list] [-L] sum-file ...
     34      1.1  mrg 
     35      1.1  mrg     tool           The tool (e.g. g++, libffi) for which to create a
     36      1.1  mrg                    new test summary file.  If not specified then all
     37      1.1  mrg                    specified sum files must be for the same tool.
     38      1.1  mrg     variant-list   One or more test variant names.  If the list is
     39      1.1  mrg                    not specified then one is constructed from all
     40      1.1  mrg                    variants in the files for <tool>.
     41      1.1  mrg     sum-file       A test summary file with the format of those
     42      1.1  mrg                    created by runtest from DejaGnu.
     43      1.1  mrg     If -L is used, merge *.log files instead of *.sum.  In this
     44      1.1  mrg     mode the exact order of lines may not be preserved, just different
     45      1.1  mrg     Running *.exp chunks should be in correct order.
     46      1.1  mrg EOF
     47      1.1  mrg }
     48      1.1  mrg 
     49      1.1  mrg # Write a message to the standard error.
     50      1.1  mrg 
     51      1.1  mrg msg() {
     52      1.1  mrg   echo "$@" >&2
     53      1.1  mrg }
     54      1.1  mrg 
     55      1.1  mrg # Parse the command-line options.
     56      1.1  mrg 
     57      1.1  mrg VARIANTS=""
     58      1.1  mrg TOOL=""
     59      1.1  mrg MODE="sum"
     60      1.1  mrg 
     61      1.1  mrg while getopts "l:t:L" ARG; do
     62      1.1  mrg   case $ARG in
     63      1.1  mrg   l)  VARIANTS="${VARIANTS} ${OPTARG}";;
     64      1.1  mrg   t)  test -z "$TOOL" || (msg "${PROGNAME}: only one tool can be specified"; exit 1);
     65      1.1  mrg       TOOL="${OPTARG}";;
     66      1.1  mrg   L)  MODE="log";;
     67      1.1  mrg   \?) usage; exit 0;;
     68      1.1  mrg   esac
     69      1.1  mrg done
     70      1.1  mrg shift `expr ${OPTIND} - 1`
     71      1.1  mrg 
     72      1.1  mrg if test $# -lt 1 ; then
     73      1.1  mrg   usage
     74      1.1  mrg   exit 1
     75      1.1  mrg fi
     76      1.1  mrg 
     77      1.1  mrg TMPDIR=${TMPDIR-/tmp}
     78      1.1  mrg SUM_FILES="$@"
     79      1.1  mrg FIRST_SUM=$1
     80      1.1  mrg TMP=
     81      1.1  mrg trap 'EXIT_STATUS=$?; rm -rf $TMP && exit $EXIT_STATUS' 0
     82      1.1  mrg # Create a (secure) tmp directory for tmp files.
     83      1.1  mrg {
     84      1.1  mrg   TMP=`(umask 077 && mktemp -d -q "${TMPDIR}/dg-combine-results-$$-XXXXXX") 2>/dev/null` &&
     85      1.1  mrg   test -n "$TMP" && test -d "$TMP"
     86      1.1  mrg } ||
     87      1.1  mrg {
     88      1.1  mrg   TMP=${TMPDIR}/dg-combine-results-$$-$RANDOM
     89      1.1  mrg   (umask 077 && mkdir $TMP)
     90      1.1  mrg } ||
     91      1.1  mrg {
     92      1.1  mrg   msg "${PROGNAME}: cannot create a temporary directory"
     93      1.1  mrg   { (exit 1); exit 1; }
     94      1.1  mrg }
     95      1.1  mrg 
     96      1.1  mrg # Find a good awk.
     97      1.1  mrg 
     98      1.1  mrg if test -z "$AWK" ; then
     99      1.1  mrg   for AWK in gawk nawk awk
    100      1.1  mrg   do
    101      1.1  mrg     if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
    102      1.1  mrg       :
    103      1.1  mrg     else
    104      1.1  mrg       break
    105      1.1  mrg     fi
    106      1.1  mrg   done
    107      1.1  mrg fi
    108      1.1  mrg 
    109      1.1  mrg # Verify that the specified summary files exist.
    110      1.1  mrg 
    111      1.1  mrg ERROR=0
    112      1.1  mrg for FILE in $SUM_FILES
    113      1.1  mrg do
    114      1.1  mrg   if ! test -f $FILE ; then
    115      1.1  mrg     msg "${PROGNAME}: file $FILE does not exist."
    116      1.1  mrg     ERROR=1
    117      1.1  mrg   fi
    118      1.1  mrg done
    119      1.1  mrg test $ERROR -eq 0 || exit 1
    120      1.1  mrg 
    121      1.1  mrg if [ -z "$TOOL" ]; then
    122      1.1  mrg   # If no tool was specified, all specified summary files must be for
    123      1.1  mrg   # the same tool.
    124      1.1  mrg 
    125      1.1  mrg   CNT=`grep '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l`
    126      1.1  mrg   if [ $CNT -eq 1 ]; then
    127      1.1  mrg     TOOL=`grep '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'`
    128      1.1  mrg   else
    129      1.1  mrg     msg "${PROGNAME}: sum files are for multiple tools, specify a tool"
    130      1.1  mrg     msg ""
    131      1.1  mrg     usage
    132      1.1  mrg     exit 1
    133      1.1  mrg   fi
    134      1.1  mrg else
    135      1.1  mrg   # Ignore the specified summary files that are not for this tool.  This
    136      1.1  mrg   # should keep the relevant files in the same order.
    137      1.1  mrg 
    138      1.1  mrg   SUM_FILES=`grep -l "=== $TOOL" $SUM_FILES`
    139      1.1  mrg   if test -z "$SUM_FILES" ; then
    140      1.1  mrg     msg "${PROGNAME}: none of the specified files are results for $TOOL"
    141      1.1  mrg     exit 1
    142      1.1  mrg   fi
    143      1.1  mrg fi
    144      1.1  mrg 
    145      1.1  mrg if [ "$TOOL" = acats ]; then
    146      1.1  mrg   # Acats *.sum or *.log files aren't dejagnu generated, and they have
    147      1.1  mrg   # somewhat different format.
    148      1.1  mrg   ACATS_AWK=${TMP}/acats.awk
    149      1.1  mrg   cat <<EOF > $ACATS_AWK
    150      1.1  mrg BEGIN {
    151      1.1  mrg   print_prologue=1; curfile=""; insummary=0
    152      1.1  mrg   passcnt=0; failcnt=0; unsupcnt=0; failures=""
    153      1.1  mrg }
    154      1.1  mrg /^[ \t]*=== acats configuration ===/ {
    155      1.1  mrg   insummary=0
    156      1.1  mrg   if (print_prologue) print
    157      1.1  mrg   next
    158      1.1  mrg }
    159      1.1  mrg /^[ \t]*=== acats tests ===/ {
    160      1.1  mrg   if (print_prologue) print
    161      1.1  mrg   print_prologue=0
    162      1.1  mrg   next
    163      1.1  mrg }
    164      1.1  mrg /^Running chapter / {
    165      1.1  mrg   if (curfile) close (curfile)
    166      1.1  mrg   curfile="${TMP}/chapter-"\$3
    167      1.1  mrg   print >> curfile
    168      1.1  mrg   next
    169      1.1  mrg }
    170      1.1  mrg /^[ \t]*=== acats Summary ===/ {
    171      1.1  mrg   if (curfile) close (curfile)
    172      1.1  mrg   curfile=""
    173      1.1  mrg   insummary=1
    174      1.1  mrg   next
    175      1.1  mrg }
    176      1.1  mrg /^# of expected passes/		{ if (insummary == 1) passcnt += \$5; next; }
    177      1.1  mrg /^# of unexpected failures/	{ if (insummary == 1) failcnt += \$5; next; }
    178      1.1  mrg /^# of unsupported tests/	{ if (insummary == 1) unsupcnt += \$5; next; }
    179      1.1  mrg /^\*\*\* FAILURES: / {
    180      1.1  mrg   if (insummary == 1) {
    181      1.1  mrg     if (failures) sub(/^\*\*\* FAILURES:/,"")
    182      1.1  mrg     failures=failures""\$0
    183      1.1  mrg   }
    184      1.1  mrg }
    185      1.1  mrg {
    186      1.1  mrg   if (print_prologue) { print; next }
    187      1.1  mrg   if (curfile) print >> curfile
    188      1.1  mrg }
    189      1.1  mrg END {
    190      1.1  mrg   system ("cat ${TMP}/chapter-*")
    191      1.1  mrg   print "		=== acats Summary ==="
    192      1.1  mrg   print "# of expected passes		" passcnt
    193      1.1  mrg   print "# of unexpected failures	" failcnt
    194      1.1  mrg   if (unsupcnt) print "# of unsupported tests		" unsupcnt
    195      1.1  mrg   if (failures) print failures
    196      1.1  mrg }
    197      1.1  mrg EOF
    198      1.1  mrg 
    199      1.1  mrg   rm -f ${TMP}/chapter-*
    200      1.1  mrg   $AWK -f $ACATS_AWK $SUM_FILES
    201      1.1  mrg   exit 0
    202      1.1  mrg fi
    203      1.1  mrg 
    204      1.1  mrg # If no variants were specified, find all variants in the remaining
    205      1.1  mrg # summary files.  Otherwise, ignore specified variants that aren't in
    206      1.1  mrg # any of those summary files.
    207      1.1  mrg 
    208      1.1  mrg if test -z "$VARIANTS" ; then
    209      1.1  mrg   VAR_AWK=${TMP}/variants.awk
    210      1.1  mrg   cat <<EOF > $VAR_AWK
    211      1.1  mrg /^Schedule of variations:/      { in_vars=1; next }
    212      1.1  mrg /^$/                            { in_vars=0 }
    213      1.1  mrg /^Running target/               { exit }
    214      1.1  mrg { if (in_vars==1) print \$1; else next }
    215      1.1  mrg EOF
    216      1.1  mrg 
    217      1.1  mrg   touch ${TMP}/varlist
    218      1.1  mrg   for FILE in $SUM_FILES; do
    219      1.1  mrg     $AWK -f $VAR_AWK $FILE >> ${TMP}/varlist
    220      1.1  mrg   done
    221      1.1  mrg   VARIANTS="`sort -u ${TMP}/varlist`"
    222      1.1  mrg else
    223      1.1  mrg   VARS="$VARIANTS"
    224      1.1  mrg   VARIANTS=""
    225      1.1  mrg   for VAR in $VARS
    226      1.1  mrg   do
    227      1.1  mrg     grep "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR"
    228      1.1  mrg   done
    229      1.1  mrg fi
    230      1.1  mrg 
    231      1.1  mrg # Find out if we have more than one variant, or any at all.
    232      1.1  mrg 
    233      1.1  mrg VARIANT_COUNT=0
    234      1.1  mrg for VAR in $VARIANTS
    235      1.1  mrg do
    236      1.1  mrg   VARIANT_COUNT=`expr $VARIANT_COUNT + 1`
    237      1.1  mrg done
    238      1.1  mrg 
    239      1.1  mrg if test $VARIANT_COUNT -eq 0 ; then
    240      1.1  mrg   msg "${PROGNAME}: no file for $TOOL has results for the specified variants"
    241      1.1  mrg   exit 1
    242      1.1  mrg fi
    243      1.1  mrg 
    244      1.1  mrg cat $SUM_FILES \
    245      1.1  mrg   | $AWK '/^Running/ { if ($2 != "target" && $3 == "...") print "EXPFILE: "$2 } ' \
    246      1.1  mrg   | sort -u > ${TMP}/expfiles
    247      1.1  mrg 
    248      1.1  mrg # Write the begining of the combined summary file.
    249      1.1  mrg 
    250      1.1  mrg head -n 2 $FIRST_SUM
    251      1.1  mrg echo
    252      1.1  mrg echo "		=== $TOOL tests ==="
    253      1.1  mrg echo
    254      1.1  mrg echo "Schedule of variations:"
    255      1.1  mrg for VAR in $VARIANTS
    256      1.1  mrg do
    257      1.1  mrg   echo "    $VAR"
    258      1.1  mrg done
    259      1.1  mrg echo
    260      1.1  mrg 
    261      1.1  mrg # For each test variant for the tool, copy test reports from each of the
    262      1.1  mrg # summary files.  Set up two awk scripts from within the loop to
    263      1.1  mrg # initialize VAR and TOOL with the script, rather than assuming that the
    264      1.1  mrg # available version of awk can pass variables from the command line.
    265      1.1  mrg 
    266      1.1  mrg for VAR in $VARIANTS
    267      1.1  mrg do
    268      1.1  mrg   GUTS_AWK=${TMP}/guts.awk
    269      1.1  mrg   cat << EOF > $GUTS_AWK
    270      1.1  mrg BEGIN {
    271      1.1  mrg   variant="$VAR"
    272      1.1  mrg   firstvar=1
    273      1.1  mrg   expfileno=1
    274      1.1  mrg   cnt=0
    275      1.1  mrg   print_using=0
    276      1.1  mrg   need_close=0
    277      1.1  mrg }
    278      1.1  mrg /^EXPFILE: / {
    279      1.1  mrg   expfiles[expfileno] = \$2
    280      1.1  mrg   expfilesr[\$2] = expfileno
    281      1.1  mrg   expfileno = expfileno + 1
    282      1.1  mrg }
    283      1.1  mrg /^Running target / {
    284      1.1  mrg   curvar = \$3
    285      1.1  mrg   if (variant == curvar && firstvar == 1) { print; print_using=1; firstvar = 0 }
    286      1.1  mrg   next
    287      1.1  mrg }
    288      1.1  mrg /^Using / {
    289      1.1  mrg   if (variant == curvar && print_using) { print; next }
    290      1.1  mrg }
    291  1.1.1.2  mrg /^Running .*\\.exp \\.\\.\\./ {
    292      1.1  mrg   print_using=0
    293      1.1  mrg   if (variant == curvar) {
    294      1.1  mrg     if (need_close) close(curfile)
    295      1.1  mrg     curfile="${TMP}/list"expfilesr[\$2]
    296      1.1  mrg     expfileseen[\$2]=expfileseen[\$2] + 1
    297      1.1  mrg     need_close=0
    298      1.1  mrg     testname="00"
    299      1.1  mrg     next
    300      1.1  mrg   }
    301      1.1  mrg }
    302      1.1  mrg /^\t\t=== .* ===$/ { curvar = ""; next }
    303      1.1  mrg /^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|WARNING|ERROR|UNSUPPORTED|UNTESTED|KFAIL):/ {
    304      1.1  mrg   testname=\$2
    305      1.1  mrg   # Ugly hack for gfortran.dg/dg.exp
    306      1.1  mrg   if ("$TOOL" == "gfortran" && testname ~ /^gfortran.dg\/g77\//)
    307      1.1  mrg     testname="h"testname
    308      1.1  mrg }
    309      1.1  mrg /^$/ { if ("$MODE" == "sum") next }
    310      1.1  mrg { if (variant == curvar && curfile) {
    311      1.1  mrg     if ("$MODE" == "sum") {
    312      1.1  mrg       printf "%s %08d|", testname, cnt >> curfile
    313      1.1  mrg       cnt = cnt + 1
    314      1.1  mrg     }
    315      1.1  mrg     filewritten[curfile]=1
    316      1.1  mrg     need_close=1
    317      1.1  mrg     print >> curfile
    318      1.1  mrg   } else
    319      1.1  mrg     next
    320      1.1  mrg }
    321      1.1  mrg END {
    322      1.1  mrg   n=1
    323      1.1  mrg   while (n < expfileno) {
    324      1.1  mrg     if (expfileseen[expfiles[n]]) {
    325      1.1  mrg       print "Running "expfiles[n]" ..."
    326      1.1  mrg       if (filewritten["${TMP}/list"n]) {
    327      1.1  mrg 	if (expfileseen[expfiles[n]] == 1)
    328      1.1  mrg 	  cmd="cat"
    329      1.1  mrg 	else
    330      1.1  mrg 	  cmd="LC_ALL=C sort"
    331      1.1  mrg 	if ("$MODE" == "sum")
    332      1.1  mrg 	  system (cmd" ${TMP}/list"n" | sed -n 's/^[^ ]* [^ |]*|//p'")
    333      1.1  mrg 	else
    334      1.1  mrg 	  system ("cat ${TMP}/list"n)
    335      1.1  mrg       }
    336      1.1  mrg     }
    337      1.1  mrg     n = n + 1
    338      1.1  mrg   }
    339      1.1  mrg }
    340      1.1  mrg EOF
    341      1.1  mrg 
    342      1.1  mrg   SUMS_AWK=${TMP}/sums.awk
    343      1.1  mrg   rm -f $SUMS_AWK
    344      1.1  mrg   cat << EOF > $SUMS_AWK
    345      1.1  mrg BEGIN {
    346      1.1  mrg   variant="$VAR"
    347      1.1  mrg   tool="$TOOL"
    348  1.1.1.2  mrg   passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kpasscnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0;
    349      1.1  mrg   curvar=""; insummary=0
    350      1.1  mrg }
    351      1.1  mrg /^Running target /		{ curvar = \$3; next }
    352      1.1  mrg /^# of /			{ if (variant == curvar) insummary = 1 }
    353      1.1  mrg /^# of expected passes/		{ if (insummary == 1) passcnt += \$5; next; }
    354      1.1  mrg /^# of unexpected successes/	{ if (insummary == 1) xpasscnt += \$5; next; }
    355      1.1  mrg /^# of unexpected failures/	{ if (insummary == 1) failcnt += \$5; next; }
    356      1.1  mrg /^# of expected failures/	{ if (insummary == 1) xfailcnt += \$5; next; }
    357  1.1.1.2  mrg /^# of unknown successes/	{ if (insummary == 1) kpasscnt += \$5; next; }
    358  1.1.1.2  mrg /^# of known failures/		{ if (insummary == 1) kfailcnt += \$5; next; }
    359      1.1  mrg /^# of untested testcases/	{ if (insummary == 1) untstcnt += \$5; next; }
    360      1.1  mrg /^# of unresolved testcases/	{ if (insummary == 1) unrescnt += \$5; next; }
    361      1.1  mrg /^# of unsupported tests/	{ if (insummary == 1) unsupcnt += \$5; next; }
    362      1.1  mrg /^$/				{ if (insummary == 1)
    363      1.1  mrg 				    { insummary = 0; curvar = "" }
    364      1.1  mrg 				  next
    365      1.1  mrg 				}
    366      1.1  mrg { next }
    367      1.1  mrg END {
    368      1.1  mrg   printf ("\t\t=== %s Summary for %s ===\n\n", tool, variant)
    369      1.1  mrg   if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt)
    370      1.1  mrg   if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt)
    371      1.1  mrg   if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt)
    372      1.1  mrg   if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt)
    373  1.1.1.2  mrg   if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt)
    374  1.1.1.2  mrg   if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt)
    375      1.1  mrg   if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt)
    376      1.1  mrg   if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt)
    377      1.1  mrg   if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt)
    378      1.1  mrg }
    379      1.1  mrg EOF
    380      1.1  mrg 
    381      1.1  mrg   PVAR=`echo $VAR | sed 's,/,.,g'`
    382      1.1  mrg   TMPFILE=${TMP}/var-$PVAR
    383      1.1  mrg   rm -f $TMPFILE
    384      1.1  mrg   rm -f ${TMP}/list*
    385      1.1  mrg   cat ${TMP}/expfiles $SUM_FILES | $AWK -f $GUTS_AWK
    386      1.1  mrg   cat $SUM_FILES | $AWK -f $SUMS_AWK > $TMPFILE
    387      1.1  mrg   # If there are multiple variants, output the counts for this one;
    388      1.1  mrg   # otherwise there will just be the final counts at the end.
    389      1.1  mrg   test $VARIANT_COUNT -eq 1 || cat $TMPFILE
    390      1.1  mrg done
    391      1.1  mrg 
    392      1.1  mrg # Set up an awk script to get the combined summary counts for the tool.
    393      1.1  mrg 
    394      1.1  mrg TOTAL_AWK=${TMP}/total.awk
    395      1.1  mrg cat << EOF > $TOTAL_AWK
    396      1.1  mrg BEGIN {
    397      1.1  mrg   tool="$TOOL"
    398  1.1.1.2  mrg   passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0
    399      1.1  mrg }
    400      1.1  mrg /^# of expected passes/		{ passcnt += \$5 }
    401      1.1  mrg /^# of unexpected failures/	{ failcnt += \$5 }
    402      1.1  mrg /^# of unexpected successes/	{ xpasscnt += \$5 }
    403      1.1  mrg /^# of expected failures/	{ xfailcnt += \$5 }
    404  1.1.1.2  mrg /^# of unknown successes/	{ kpasscnt += \$5 }
    405  1.1.1.2  mrg /^# of known failures/		{ kfailcnt += \$5 }
    406      1.1  mrg /^# of untested testcases/	{ untstcnt += \$5 }
    407      1.1  mrg /^# of unresolved testcases/	{ unrescnt += \$5 }
    408      1.1  mrg /^# of unsupported tests/	{ unsupcnt += \$5 }
    409      1.1  mrg END {
    410      1.1  mrg   printf ("\n\t\t=== %s Summary ===\n\n", tool)
    411      1.1  mrg   if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt)
    412      1.1  mrg   if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt)
    413      1.1  mrg   if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt)
    414      1.1  mrg   if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt)
    415  1.1.1.2  mrg   if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt)
    416  1.1.1.2  mrg   if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt)
    417      1.1  mrg   if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt)
    418      1.1  mrg   if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt)
    419      1.1  mrg   if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt)
    420      1.1  mrg }
    421      1.1  mrg EOF
    422      1.1  mrg 
    423      1.1  mrg # Find the total summaries for the tool and add to the end of the output.
    424      1.1  mrg cat ${TMP}/var-* | $AWK -f $TOTAL_AWK
    425      1.1  mrg 
    426      1.1  mrg # This is ugly, but if there's version output from the compiler under test
    427      1.1  mrg # at the end of the file, we want it.  The other thing that might be there
    428      1.1  mrg # is the final summary counts.
    429      1.1  mrg tail -2 $FIRST_SUM | grep '^#' > /dev/null || tail -2 $FIRST_SUM
    430      1.1  mrg 
    431      1.1  mrg exit 0
    432