dejagnu-report-card work-in-progress

Jacob Bachmeyer <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
I have attached work-in-progress versions of the dejagnu-report-card 
tool.  These, in particular, do not yet properly handle command line 
arguments and the dejagnu(1) multi-launcher I am currently developing 
both uses and passes "-v" (verbose), so there is more work to be done on 
these before they are ready for wide distribution.

The order of the output lines in the Tcl version is unstable.  It 
appears to be directory order.  That is a bug that will be fixed.

Additional optimization work has brought the Tcl version much closer to 
its AWK predecessor in performance and internal structure.  Differences 
are imperceptible and currently difficult to reliably measure.  It does 
seem to be a bit slower than AWK.

The shell version is different in an interesting way:  while it is much 
slower in absolute terms, it is the only version that produces output 
incrementally.

The portable Awk version is also not yet written.  I presume that "gawk 
--lint --posix" will be suitable to verify that it is indeed portable?

While these are not yet ready to merge into the DejaGnu tree, I wanted 
the list to see them and would welcome any helpful feedback.


-- Jacob

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
report-card.sh (application/x-sh, 2.5 KB)
#!/bin/sh

# report-card.sh -- produce a nice summary of DejaGnu results
#
# Copyright (C) 2018 Jacob Bachmeyer
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

## Get list of files to scan

if test x"$1" = x; then
    set -- *.sum
fi

TOOLS=
for f in "$@"; do TOOLS="${TOOLS} $(basename ${f} .sum)"; done

## Compute width of filename column

fwidth=$((for f in ${TOOLS}; do expr length $f; done) | sort -nr | head -1)

## Get pass names and compute widths of pass column

get_passes() (grep '^Running pass' -h -- "$@" \
    | sed -e 's/Running pass `//' -e "s/' ...//" | sort | uniq)

pwidth=$((for p in $(get_passes "$@"); do expr length $p; done) \
    | sort -nr | head -1)

if test x"$pwidth" = x; then
    nwidth=$fwidth
else
    nwidth=$(expr $fwidth + 3 + $pwidth)
fi

## Emit header

printf '%*s   __________________________________________________\n' $nwidth ' '
printf '%*s  /  %6s %6s %6s %6s %6s %6s %6s\n' $nwidth ' ' \
    PASS FAIL '?PASS' '?FAIL' UNSUP UNRES UNTEST
printf '%*s  |--------------------------------------------------\n' $nwidth ' '

## Read and emit counts

re_list='PASS FAIL [KX]PASS [KX]FAIL UNSUPPORTED UNRESOLVED UNTESTED'

for file in "$@"; do
    passes=$(get_passes ${file})
    if test x"$passes" = x; then
	printf '%*s  | ' $nwidth $(basename $file .sum)
	for re in ${re_list}; do
	    printf ' %6s' $(grep -c "^${re}: " -- ${file})
	done
	echo
    else
	for pass in ${passes}; do
	    printf '%*s / %-*s  | ' $fwidth $(basename $file .sum) $pwidth $pass
	    for re in ${re_list}; do
		printf ' %6s' $(grep -c "^${re}: ${pass}:" -- ${file})
	    done
	    echo
	done
    fi
done

sum_counts() (re="$1"; shift;
    expr 0 $(grep -c "${re}" -- "$@" | sed -e 's/^.*:/ + /'))

if test x"$pwidth" != x; then
    printf '%*s  |--------------------------------------------------\n' \
	$nwidth ' '
    for pass in $(get_passes "$@"); do
	printf '%*s   %-*s  | ' $fwidth '' $pwidth $pass
	for re in ${re_list}; do
	    printf ' %6s' $(sum_counts "^${re}: ${pass}:" "$@")
	done
	echo
    done
fi

printf '%*s  |--------------------------------------------------\n' $nwidth ' '
printf '%*s  | ' $nwidth ' '
for re in ${re_list}; do
    printf ' %6s' $(sum_counts "^${re}: " "$@")
done
echo
printf '%*s  \\__________________________________________________\n' $nwidth ' '

#EOF
report-card.tcl (application/x-tcl, 5.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.