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.8 mrg # Copyright (C) 2008-2024 Free Software Foundation, Inc. 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.1.8 mrg # Try to use the python version if possible, since it tends to be faster and 32 1.1.1.8 mrg # produces more stable results. 33 1.1.1.3 mrg PYTHON_VER=`echo "$0" | sed 's/sh$/py/'` 34 1.1.1.8 mrg for python in python3 python python2 ; do 35 1.1.1.8 mrg if test "$PYTHON_VER" != "$0" && 36 1.1.1.8 mrg test -f "$PYTHON_VER" && 37 1.1.1.8 mrg ${python} -c 'import sys, getopt, re, io, datetime, operator; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \ 38 1.1.1.8 mrg > /dev/null 2> /dev/null; then 39 1.1.1.8 mrg exec ${python} $PYTHON_VER "$@" 40 1.1.1.8 mrg fi 41 1.1.1.8 mrg done 42 1.1.1.3 mrg 43 1.1 mrg usage() { 44 1.1 mrg cat <<EOF >&2 45 1.1 mrg Usage: $PROGNAME [-t tool] [-l variant-list] [-L] sum-file ... 46 1.1 mrg 47 1.1 mrg tool The tool (e.g. g++, libffi) for which to create a 48 1.1 mrg new test summary file. If not specified then all 49 1.1 mrg specified sum files must be for the same tool. 50 1.1 mrg variant-list One or more test variant names. If the list is 51 1.1 mrg not specified then one is constructed from all 52 1.1 mrg variants in the files for <tool>. 53 1.1 mrg sum-file A test summary file with the format of those 54 1.1 mrg created by runtest from DejaGnu. 55 1.1 mrg If -L is used, merge *.log files instead of *.sum. In this 56 1.1 mrg mode the exact order of lines may not be preserved, just different 57 1.1 mrg Running *.exp chunks should be in correct order. 58 1.1 mrg EOF 59 1.1 mrg } 60 1.1 mrg 61 1.1 mrg # Write a message to the standard error. 62 1.1 mrg 63 1.1 mrg msg() { 64 1.1 mrg echo "$@" >&2 65 1.1 mrg } 66 1.1 mrg 67 1.1 mrg # Parse the command-line options. 68 1.1 mrg 69 1.1 mrg VARIANTS="" 70 1.1 mrg TOOL="" 71 1.1 mrg MODE="sum" 72 1.1 mrg 73 1.1 mrg while getopts "l:t:L" ARG; do 74 1.1 mrg case $ARG in 75 1.1 mrg l) VARIANTS="${VARIANTS} ${OPTARG}";; 76 1.1 mrg t) test -z "$TOOL" || (msg "${PROGNAME}: only one tool can be specified"; exit 1); 77 1.1 mrg TOOL="${OPTARG}";; 78 1.1 mrg L) MODE="log";; 79 1.1 mrg \?) usage; exit 0;; 80 1.1 mrg esac 81 1.1 mrg done 82 1.1 mrg shift `expr ${OPTIND} - 1` 83 1.1 mrg 84 1.1 mrg if test $# -lt 1 ; then 85 1.1 mrg usage 86 1.1 mrg exit 1 87 1.1 mrg fi 88 1.1 mrg 89 1.1 mrg TMPDIR=${TMPDIR-/tmp} 90 1.1 mrg SUM_FILES="$@" 91 1.1 mrg FIRST_SUM=$1 92 1.1 mrg TMP= 93 1.1 mrg trap 'EXIT_STATUS=$?; rm -rf $TMP && exit $EXIT_STATUS' 0 94 1.1 mrg # Create a (secure) tmp directory for tmp files. 95 1.1 mrg { 96 1.1 mrg TMP=`(umask 077 && mktemp -d -q "${TMPDIR}/dg-combine-results-$$-XXXXXX") 2>/dev/null` && 97 1.1 mrg test -n "$TMP" && test -d "$TMP" 98 1.1 mrg } || 99 1.1 mrg { 100 1.1 mrg TMP=${TMPDIR}/dg-combine-results-$$-$RANDOM 101 1.1 mrg (umask 077 && mkdir $TMP) 102 1.1 mrg } || 103 1.1 mrg { 104 1.1 mrg msg "${PROGNAME}: cannot create a temporary directory" 105 1.1 mrg { (exit 1); exit 1; } 106 1.1 mrg } 107 1.1 mrg 108 1.1 mrg # Find a good awk. 109 1.1 mrg 110 1.1 mrg if test -z "$AWK" ; then 111 1.1 mrg for AWK in gawk nawk awk 112 1.1 mrg do 113 1.1 mrg if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then 114 1.1 mrg : 115 1.1 mrg else 116 1.1 mrg break 117 1.1 mrg fi 118 1.1 mrg done 119 1.1 mrg fi 120 1.1 mrg 121 1.1 mrg # Verify that the specified summary files exist. 122 1.1 mrg 123 1.1 mrg ERROR=0 124 1.1 mrg for FILE in $SUM_FILES 125 1.1 mrg do 126 1.1 mrg if ! test -f $FILE ; then 127 1.1 mrg msg "${PROGNAME}: file $FILE does not exist." 128 1.1 mrg ERROR=1 129 1.1 mrg fi 130 1.1 mrg done 131 1.1 mrg test $ERROR -eq 0 || exit 1 132 1.1 mrg 133 1.1.1.3 mrg # Test if grep supports the '--text' option 134 1.1.1.3 mrg 135 1.1.1.3 mrg GREP=grep 136 1.1.1.3 mrg 137 1.1.1.3 mrg if echo -e '\x00foo\x00' | $GREP --text foo > /dev/null 2>&1 ; then 138 1.1.1.3 mrg GREP="grep --text" 139 1.1.1.3 mrg else 140 1.1.1.3 mrg # Our grep does not recognize the '--text' option. We have to 141 1.1.1.3 mrg # treat our files in order to remove any non-printable character. 142 1.1.1.3 mrg for file in $SUM_FILES ; do 143 1.1.1.3 mrg mv $file ${file}.orig 144 1.1.1.3 mrg cat -v ${file}.orig > $file 145 1.1.1.3 mrg done 146 1.1.1.3 mrg fi 147 1.1.1.3 mrg 148 1.1 mrg if [ -z "$TOOL" ]; then 149 1.1 mrg # If no tool was specified, all specified summary files must be for 150 1.1 mrg # the same tool. 151 1.1 mrg 152 1.1.1.3 mrg CNT=`$GREP '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l` 153 1.1 mrg if [ $CNT -eq 1 ]; then 154 1.1.1.3 mrg TOOL=`$GREP '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'` 155 1.1 mrg else 156 1.1 mrg msg "${PROGNAME}: sum files are for multiple tools, specify a tool" 157 1.1 mrg msg "" 158 1.1 mrg usage 159 1.1 mrg exit 1 160 1.1 mrg fi 161 1.1 mrg else 162 1.1 mrg # Ignore the specified summary files that are not for this tool. This 163 1.1 mrg # should keep the relevant files in the same order. 164 1.1 mrg 165 1.1.1.3 mrg SUM_FILES=`$GREP -l "=== $TOOL" $SUM_FILES` 166 1.1 mrg if test -z "$SUM_FILES" ; then 167 1.1 mrg msg "${PROGNAME}: none of the specified files are results for $TOOL" 168 1.1 mrg exit 1 169 1.1 mrg fi 170 1.1 mrg fi 171 1.1 mrg 172 1.1 mrg if [ "$TOOL" = acats ]; then 173 1.1 mrg # Acats *.sum or *.log files aren't dejagnu generated, and they have 174 1.1 mrg # somewhat different format. 175 1.1 mrg ACATS_AWK=${TMP}/acats.awk 176 1.1 mrg cat <<EOF > $ACATS_AWK 177 1.1 mrg BEGIN { 178 1.1 mrg print_prologue=1; curfile=""; insummary=0 179 1.1 mrg passcnt=0; failcnt=0; unsupcnt=0; failures="" 180 1.1 mrg } 181 1.1 mrg /^[ \t]*=== acats configuration ===/ { 182 1.1 mrg insummary=0 183 1.1 mrg if (print_prologue) print 184 1.1 mrg next 185 1.1 mrg } 186 1.1 mrg /^[ \t]*=== acats tests ===/ { 187 1.1 mrg if (print_prologue) print 188 1.1 mrg print_prologue=0 189 1.1 mrg next 190 1.1 mrg } 191 1.1 mrg /^Running chapter / { 192 1.1 mrg if (curfile) close (curfile) 193 1.1 mrg curfile="${TMP}/chapter-"\$3 194 1.1 mrg print >> curfile 195 1.1 mrg next 196 1.1 mrg } 197 1.1 mrg /^[ \t]*=== acats Summary ===/ { 198 1.1 mrg if (curfile) close (curfile) 199 1.1 mrg curfile="" 200 1.1 mrg insummary=1 201 1.1 mrg next 202 1.1 mrg } 203 1.1 mrg /^# of expected passes/ { if (insummary == 1) passcnt += \$5; next; } 204 1.1 mrg /^# of unexpected failures/ { if (insummary == 1) failcnt += \$5; next; } 205 1.1 mrg /^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; } 206 1.1 mrg /^\*\*\* FAILURES: / { 207 1.1 mrg if (insummary == 1) { 208 1.1 mrg if (failures) sub(/^\*\*\* FAILURES:/,"") 209 1.1 mrg failures=failures""\$0 210 1.1 mrg } 211 1.1 mrg } 212 1.1 mrg { 213 1.1 mrg if (print_prologue) { print; next } 214 1.1 mrg if (curfile) print >> curfile 215 1.1 mrg } 216 1.1 mrg END { 217 1.1 mrg system ("cat ${TMP}/chapter-*") 218 1.1 mrg print " === acats Summary ===" 219 1.1 mrg print "# of expected passes " passcnt 220 1.1 mrg print "# of unexpected failures " failcnt 221 1.1 mrg if (unsupcnt) print "# of unsupported tests " unsupcnt 222 1.1 mrg if (failures) print failures 223 1.1 mrg } 224 1.1 mrg EOF 225 1.1 mrg 226 1.1 mrg rm -f ${TMP}/chapter-* 227 1.1 mrg $AWK -f $ACATS_AWK $SUM_FILES 228 1.1 mrg exit 0 229 1.1 mrg fi 230 1.1 mrg 231 1.1 mrg # If no variants were specified, find all variants in the remaining 232 1.1 mrg # summary files. Otherwise, ignore specified variants that aren't in 233 1.1 mrg # any of those summary files. 234 1.1 mrg 235 1.1 mrg if test -z "$VARIANTS" ; then 236 1.1 mrg VAR_AWK=${TMP}/variants.awk 237 1.1 mrg cat <<EOF > $VAR_AWK 238 1.1 mrg /^Schedule of variations:/ { in_vars=1; next } 239 1.1 mrg /^$/ { in_vars=0 } 240 1.1 mrg /^Running target/ { exit } 241 1.1 mrg { if (in_vars==1) print \$1; else next } 242 1.1 mrg EOF 243 1.1 mrg 244 1.1 mrg touch ${TMP}/varlist 245 1.1 mrg for FILE in $SUM_FILES; do 246 1.1 mrg $AWK -f $VAR_AWK $FILE >> ${TMP}/varlist 247 1.1 mrg done 248 1.1 mrg VARIANTS="`sort -u ${TMP}/varlist`" 249 1.1 mrg else 250 1.1 mrg VARS="$VARIANTS" 251 1.1 mrg VARIANTS="" 252 1.1 mrg for VAR in $VARS 253 1.1 mrg do 254 1.1.1.3 mrg $GREP "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR" 255 1.1 mrg done 256 1.1 mrg fi 257 1.1 mrg 258 1.1 mrg # Find out if we have more than one variant, or any at all. 259 1.1 mrg 260 1.1 mrg VARIANT_COUNT=0 261 1.1 mrg for VAR in $VARIANTS 262 1.1 mrg do 263 1.1 mrg VARIANT_COUNT=`expr $VARIANT_COUNT + 1` 264 1.1 mrg done 265 1.1 mrg 266 1.1 mrg if test $VARIANT_COUNT -eq 0 ; then 267 1.1 mrg msg "${PROGNAME}: no file for $TOOL has results for the specified variants" 268 1.1 mrg exit 1 269 1.1 mrg fi 270 1.1 mrg 271 1.1 mrg cat $SUM_FILES \ 272 1.1 mrg | $AWK '/^Running/ { if ($2 != "target" && $3 == "...") print "EXPFILE: "$2 } ' \ 273 1.1 mrg | sort -u > ${TMP}/expfiles 274 1.1 mrg 275 1.1 mrg # Write the begining of the combined summary file. 276 1.1 mrg 277 1.1.1.8 mrg head -n 3 $FIRST_SUM 278 1.1 mrg echo 279 1.1 mrg echo " === $TOOL tests ===" 280 1.1 mrg echo 281 1.1 mrg echo "Schedule of variations:" 282 1.1 mrg for VAR in $VARIANTS 283 1.1 mrg do 284 1.1 mrg echo " $VAR" 285 1.1 mrg done 286 1.1 mrg echo 287 1.1 mrg 288 1.1 mrg # For each test variant for the tool, copy test reports from each of the 289 1.1 mrg # summary files. Set up two awk scripts from within the loop to 290 1.1 mrg # initialize VAR and TOOL with the script, rather than assuming that the 291 1.1 mrg # available version of awk can pass variables from the command line. 292 1.1 mrg 293 1.1 mrg for VAR in $VARIANTS 294 1.1 mrg do 295 1.1 mrg GUTS_AWK=${TMP}/guts.awk 296 1.1 mrg cat << EOF > $GUTS_AWK 297 1.1 mrg BEGIN { 298 1.1 mrg variant="$VAR" 299 1.1 mrg firstvar=1 300 1.1 mrg expfileno=1 301 1.1 mrg cnt=0 302 1.1 mrg print_using=0 303 1.1 mrg need_close=0 304 1.1.1.5 mrg has_timeout=0 305 1.1.1.5 mrg timeout_cnt=0 306 1.1 mrg } 307 1.1 mrg /^EXPFILE: / { 308 1.1 mrg expfiles[expfileno] = \$2 309 1.1 mrg expfilesr[\$2] = expfileno 310 1.1 mrg expfileno = expfileno + 1 311 1.1 mrg } 312 1.1 mrg /^Running target / { 313 1.1 mrg curvar = \$3 314 1.1 mrg if (variant == curvar && firstvar == 1) { print; print_using=1; firstvar = 0 } 315 1.1 mrg next 316 1.1 mrg } 317 1.1 mrg /^Using / { 318 1.1 mrg if (variant == curvar && print_using) { print; next } 319 1.1 mrg } 320 1.1.1.2 mrg /^Running .*\\.exp \\.\\.\\./ { 321 1.1 mrg print_using=0 322 1.1 mrg if (variant == curvar) { 323 1.1 mrg if (need_close) close(curfile) 324 1.1 mrg curfile="${TMP}/list"expfilesr[\$2] 325 1.1 mrg expfileseen[\$2]=expfileseen[\$2] + 1 326 1.1 mrg need_close=0 327 1.1 mrg testname="00" 328 1.1 mrg next 329 1.1 mrg } 330 1.1 mrg } 331 1.1 mrg /^\t\t=== .* ===$/ { curvar = ""; next } 332 1.1.1.7 mrg /^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|WARNING|ERROR|UNSUPPORTED|UNTESTED|KFAIL|KPASS|PATH|DUPLICATE):/ { 333 1.1 mrg testname=\$2 334 1.1 mrg # Ugly hack for gfortran.dg/dg.exp 335 1.1 mrg if ("$TOOL" == "gfortran" && testname ~ /^gfortran.dg\/g77\//) 336 1.1 mrg testname="h"testname 337 1.1.1.5 mrg if ("$MODE" == "sum") { 338 1.1.1.5 mrg if (\$0 ~ /^WARNING: program timed out/) { 339 1.1.1.5 mrg has_timeout=1 340 1.1.1.5 mrg timeout_cnt=cnt+1 341 1.1.1.5 mrg } else { 342 1.1.1.5 mrg # Prepare timeout replacement message in case it's needed 343 1.1.1.5 mrg timeout_msg=\$0 344 1.1.1.5 mrg sub(\$1, "WARNING:", timeout_msg) 345 1.1.1.5 mrg } 346 1.1.1.5 mrg } 347 1.1 mrg } 348 1.1 mrg /^$/ { if ("$MODE" == "sum") next } 349 1.1 mrg { if (variant == curvar && curfile) { 350 1.1 mrg if ("$MODE" == "sum") { 351 1.1.1.5 mrg # Do not print anything if the current line is a timeout 352 1.1.1.5 mrg if (has_timeout == 0) { 353 1.1.1.5 mrg # If the previous line was a timeout, 354 1.1.1.5 mrg # insert the full current message without keyword 355 1.1.1.5 mrg if (timeout_cnt != 0) { 356 1.1.1.5 mrg printf "%s %08d|%s program timed out.\n", testname, timeout_cnt-1, timeout_msg >> curfile 357 1.1.1.5 mrg timeout_cnt = 0 358 1.1.1.5 mrg cnt = cnt + 1 359 1.1.1.5 mrg } 360 1.1.1.5 mrg printf "%s %08d|", testname, cnt >> curfile 361 1.1.1.5 mrg cnt = cnt + 1 362 1.1.1.5 mrg filewritten[curfile]=1 363 1.1.1.5 mrg need_close=1 364 1.1.1.5 mrg print >> curfile 365 1.1.1.5 mrg } 366 1.1.1.5 mrg has_timeout=0 367 1.1.1.5 mrg } else { 368 1.1.1.5 mrg filewritten[curfile]=1 369 1.1.1.5 mrg need_close=1 370 1.1.1.5 mrg print >> curfile 371 1.1 mrg } 372 1.1.1.5 mrg } else { 373 1.1.1.5 mrg has_timeout=0 374 1.1.1.5 mrg timeout_cnt=0 375 1.1 mrg next 376 1.1.1.5 mrg } 377 1.1 mrg } 378 1.1 mrg END { 379 1.1 mrg n=1 380 1.1 mrg while (n < expfileno) { 381 1.1 mrg if (expfileseen[expfiles[n]]) { 382 1.1 mrg print "Running "expfiles[n]" ..." 383 1.1 mrg if (filewritten["${TMP}/list"n]) { 384 1.1 mrg if (expfileseen[expfiles[n]] == 1) 385 1.1 mrg cmd="cat" 386 1.1 mrg else 387 1.1 mrg cmd="LC_ALL=C sort" 388 1.1 mrg if ("$MODE" == "sum") 389 1.1 mrg system (cmd" ${TMP}/list"n" | sed -n 's/^[^ ]* [^ |]*|//p'") 390 1.1 mrg else 391 1.1 mrg system ("cat ${TMP}/list"n) 392 1.1 mrg } 393 1.1 mrg } 394 1.1 mrg n = n + 1 395 1.1 mrg } 396 1.1 mrg } 397 1.1 mrg EOF 398 1.1 mrg 399 1.1 mrg SUMS_AWK=${TMP}/sums.awk 400 1.1 mrg rm -f $SUMS_AWK 401 1.1 mrg cat << EOF > $SUMS_AWK 402 1.1 mrg BEGIN { 403 1.1 mrg variant="$VAR" 404 1.1 mrg tool="$TOOL" 405 1.1.1.4 mrg passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kpasscnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0; dgerrorcnt=0; 406 1.1.1.7 mrg pathcnt=0; dupcnt=0 407 1.1 mrg curvar=""; insummary=0 408 1.1 mrg } 409 1.1 mrg /^Running target / { curvar = \$3; next } 410 1.1.1.4 mrg /^ERROR: \(DejaGnu\)/ { if (variant == curvar) dgerrorcnt += 1 } 411 1.1 mrg /^# of / { if (variant == curvar) insummary = 1 } 412 1.1 mrg /^# of expected passes/ { if (insummary == 1) passcnt += \$5; next; } 413 1.1 mrg /^# of unexpected successes/ { if (insummary == 1) xpasscnt += \$5; next; } 414 1.1 mrg /^# of unexpected failures/ { if (insummary == 1) failcnt += \$5; next; } 415 1.1 mrg /^# of expected failures/ { if (insummary == 1) xfailcnt += \$5; next; } 416 1.1.1.2 mrg /^# of unknown successes/ { if (insummary == 1) kpasscnt += \$5; next; } 417 1.1.1.2 mrg /^# of known failures/ { if (insummary == 1) kfailcnt += \$5; next; } 418 1.1 mrg /^# of untested testcases/ { if (insummary == 1) untstcnt += \$5; next; } 419 1.1 mrg /^# of unresolved testcases/ { if (insummary == 1) unrescnt += \$5; next; } 420 1.1 mrg /^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; } 421 1.1.1.7 mrg /^# of paths in test names/ { if (insummary == 1) pathcnt += \$7; next; } 422 1.1.1.7 mrg /^# of duplicate test names/ { if (insummary == 1) dupcnt += \$6; next; } 423 1.1 mrg /^$/ { if (insummary == 1) 424 1.1 mrg { insummary = 0; curvar = "" } 425 1.1 mrg next 426 1.1 mrg } 427 1.1 mrg { next } 428 1.1 mrg END { 429 1.1 mrg printf ("\t\t=== %s Summary for %s ===\n\n", tool, variant) 430 1.1.1.4 mrg if (dgerrorcnt != 0) printf ("# of DejaGnu errors\t\t%d\n", dgerrorcnt) 431 1.1 mrg if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt) 432 1.1 mrg if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt) 433 1.1 mrg if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt) 434 1.1 mrg if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt) 435 1.1.1.2 mrg if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt) 436 1.1.1.2 mrg if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt) 437 1.1 mrg if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt) 438 1.1 mrg if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt) 439 1.1 mrg if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) 440 1.1.1.7 mrg if (pathcnt != 0) printf ("# of paths in test names\t%d\n", pathcnt) 441 1.1.1.7 mrg if (dupcnt != 0) printf ("# of duplicate test names\t%d\n", dupcnt) 442 1.1 mrg } 443 1.1 mrg EOF 444 1.1 mrg 445 1.1 mrg PVAR=`echo $VAR | sed 's,/,.,g'` 446 1.1 mrg TMPFILE=${TMP}/var-$PVAR 447 1.1 mrg rm -f $TMPFILE 448 1.1 mrg rm -f ${TMP}/list* 449 1.1 mrg cat ${TMP}/expfiles $SUM_FILES | $AWK -f $GUTS_AWK 450 1.1 mrg cat $SUM_FILES | $AWK -f $SUMS_AWK > $TMPFILE 451 1.1 mrg # If there are multiple variants, output the counts for this one; 452 1.1 mrg # otherwise there will just be the final counts at the end. 453 1.1 mrg test $VARIANT_COUNT -eq 1 || cat $TMPFILE 454 1.1 mrg done 455 1.1 mrg 456 1.1 mrg # Set up an awk script to get the combined summary counts for the tool. 457 1.1 mrg 458 1.1 mrg TOTAL_AWK=${TMP}/total.awk 459 1.1 mrg cat << EOF > $TOTAL_AWK 460 1.1 mrg BEGIN { 461 1.1 mrg tool="$TOOL" 462 1.1.1.4 mrg passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0; dgerrorcnt=0 463 1.1.1.7 mrg pathcnt=0; dupcnt=0 464 1.1 mrg } 465 1.1.1.4 mrg /^# of DejaGnu errors/ { dgerrorcnt += \$5 } 466 1.1 mrg /^# of expected passes/ { passcnt += \$5 } 467 1.1 mrg /^# of unexpected failures/ { failcnt += \$5 } 468 1.1 mrg /^# of unexpected successes/ { xpasscnt += \$5 } 469 1.1 mrg /^# of expected failures/ { xfailcnt += \$5 } 470 1.1.1.2 mrg /^# of unknown successes/ { kpasscnt += \$5 } 471 1.1.1.2 mrg /^# of known failures/ { kfailcnt += \$5 } 472 1.1 mrg /^# of untested testcases/ { untstcnt += \$5 } 473 1.1 mrg /^# of unresolved testcases/ { unrescnt += \$5 } 474 1.1 mrg /^# of unsupported tests/ { unsupcnt += \$5 } 475 1.1.1.7 mrg /^# of paths in test names/ { pathcnt += \$7 } 476 1.1.1.7 mrg /^# of duplicate test names/ { dupcnt += \$6 } 477 1.1 mrg END { 478 1.1 mrg printf ("\n\t\t=== %s Summary ===\n\n", tool) 479 1.1.1.4 mrg if (dgerrorcnt != 0) printf ("# of DejaGnu errors\t\t%d\n", dgerrorcnt) 480 1.1 mrg if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt) 481 1.1 mrg if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt) 482 1.1 mrg if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt) 483 1.1 mrg if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt) 484 1.1.1.2 mrg if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt) 485 1.1.1.2 mrg if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt) 486 1.1 mrg if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt) 487 1.1 mrg if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt) 488 1.1 mrg if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) 489 1.1.1.7 mrg if (pathcnt != 0) printf ("# of paths in test names\t%d\n", pathcnt) 490 1.1.1.7 mrg if (dupcnt != 0) printf ("# of duplicate test names\t%d\n", dupcnt) 491 1.1 mrg } 492 1.1 mrg EOF 493 1.1 mrg 494 1.1 mrg # Find the total summaries for the tool and add to the end of the output. 495 1.1 mrg cat ${TMP}/var-* | $AWK -f $TOTAL_AWK 496 1.1 mrg 497 1.1 mrg # This is ugly, but if there's version output from the compiler under test 498 1.1 mrg # at the end of the file, we want it. The other thing that might be there 499 1.1 mrg # is the final summary counts. 500 1.1.1.3 mrg tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM 501 1.1 mrg 502 1.1 mrg exit 0 503