1998-05-24 06:35:33 +08:00
|
|
|
#! /bin/sh
|
|
|
|
|
2009-04-26 04:03:12 +08:00
|
|
|
# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009
|
|
|
|
# Free Software Foundation
|
1998-07-28 05:01:54 +08:00
|
|
|
# Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
|
1998-05-24 06:35:33 +08:00
|
|
|
|
|
|
|
# This script is Free Software, and it can be copied, distributed and
|
|
|
|
# modified as defined in the GNU General Public License. A copy of
|
|
|
|
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
|
|
# This script processes *.{sum,log} files, producing a shell-script
|
|
|
|
# that sends e-mail to the appropriate lists and renames files to
|
1999-07-18 11:45:48 +08:00
|
|
|
# *.sent. It currently handles only gcc, but it should be quite easy
|
|
|
|
# to modify it to handle other packages and its mailing lists.
|
1998-05-24 06:35:33 +08:00
|
|
|
|
|
|
|
# The scripts assumes it is run in the root directory of the build
|
|
|
|
# tree, and it will include all .sum files it finds in the mail
|
|
|
|
# report.
|
|
|
|
|
|
|
|
# configure flags are extracted from ./config.status
|
|
|
|
|
|
|
|
# if the BOOT_CFLAGS environment variable is set, it will be included
|
|
|
|
# in the mail report too.
|
|
|
|
|
|
|
|
# The usage pattern of this script is as follows:
|
|
|
|
|
1998-07-28 04:37:47 +08:00
|
|
|
# test_summary | more # so as to observe what should be done
|
1998-05-24 06:35:33 +08:00
|
|
|
|
1998-07-28 04:37:47 +08:00
|
|
|
# test_summary | sh # so as to actually send e-mail and move log files
|
1998-05-24 06:35:33 +08:00
|
|
|
|
|
|
|
# It accepts a few command line arguments. For example:
|
2003-03-09 09:33:00 +08:00
|
|
|
if test x"$1" = "x-h"; then
|
|
|
|
cat <<_EOF
|
|
|
|
-o: re-reads logs that have been mailed already (.sum.sent)
|
|
|
|
-t: prevents logs from being renamed
|
|
|
|
-p: prepend specified file (or list of files: -p "a b") to the report
|
|
|
|
-i: append specified file (or list of files: -i "a b") to the report
|
|
|
|
-m: specify the e-mail address to send notes to. An appropriate default
|
|
|
|
should be selected from the log files.
|
|
|
|
-f: force reports to be mailed; if omitted, only reports that differ
|
|
|
|
from the sent.* version are sent.
|
|
|
|
_EOF
|
|
|
|
exit 0
|
|
|
|
fi
|
1998-05-24 06:40:01 +08:00
|
|
|
|
|
|
|
# Find a good awk.
|
|
|
|
if test -z "$AWK" ; then
|
|
|
|
for AWK in gawk nawk awk ; do
|
|
|
|
if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2000-12-29 03:28:11 +08:00
|
|
|
: ${filesuffix=}; export filesuffix
|
1998-05-24 06:35:33 +08:00
|
|
|
: ${move=true}; export move
|
|
|
|
: ${forcemail=false}; export forcemail
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;;
|
|
|
|
-t) move=false; shift;;
|
1998-11-25 20:59:24 +08:00
|
|
|
-p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
|
1998-06-19 09:39:58 +08:00
|
|
|
-i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
|
1998-05-24 06:35:33 +08:00
|
|
|
-m) mailto=$2; forcemail=true; shift 2;;
|
|
|
|
-f) unset mailto; forcemail=true; shift;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
: ${mailto="\" address \""}; export mailto
|
2001-05-28 23:50:29 +08:00
|
|
|
files=`find . -name \*.sum$filesuffix -print | sort`
|
1998-05-24 06:35:33 +08:00
|
|
|
anyfile=false anychange=$forcemail &&
|
|
|
|
for file in $files; do
|
|
|
|
[ -f $file ] &&
|
|
|
|
anyfile=true &&
|
|
|
|
{ $anychange ||
|
|
|
|
anychange=`diff -u $file.sent $file 2>/dev/null |
|
|
|
|
if test ! -f $file.sent ||
|
|
|
|
egrep '^[-+](XPASS|FAIL)' >/dev/null; then
|
|
|
|
echo true
|
|
|
|
else
|
|
|
|
echo false
|
|
|
|
fi
|
|
|
|
`
|
|
|
|
}
|
|
|
|
true
|
|
|
|
done &&
|
|
|
|
$anyfile &&
|
|
|
|
if $forcemail || $anychange; then :; else mailto=nobody; fi &&
|
2000-08-09 13:12:51 +08:00
|
|
|
# We use cat instead of listing the files as arguments to AWK because
|
|
|
|
# GNU awk 3.0.0 would break if any of the filenames contained `=' and
|
|
|
|
# was preceded by an invalid ``variable'' name.
|
2009-08-28 02:59:32 +08:00
|
|
|
( echo @TOPLEVEL_CONFIGURE_ARGUMENTS@ | ./config.status --file=-; cat $files ) |
|
1998-05-24 06:40:01 +08:00
|
|
|
$AWK '
|
1998-05-24 06:35:33 +08:00
|
|
|
BEGIN {
|
2003-01-19 22:34:12 +08:00
|
|
|
lang=""; configflags = "";
|
1999-07-18 11:45:48 +08:00
|
|
|
address="gcc-testresults@gcc.gnu.org";
|
|
|
|
version="gcc";
|
2000-06-04 10:06:54 +08:00
|
|
|
print "cat <<'"'"'EOF'"'"' |";
|
1998-11-25 20:59:24 +08:00
|
|
|
'${prepend_logs+" system(\"cat $prepend_logs\"); "}'
|
1998-05-24 06:35:33 +08:00
|
|
|
}
|
2009-08-28 02:59:32 +08:00
|
|
|
NR == 1 {
|
2003-01-07 19:56:25 +08:00
|
|
|
configflags = $0 " ";
|
|
|
|
srcdir = configflags;
|
2003-01-19 22:34:12 +08:00
|
|
|
sub(/\/configure .*/, "", srcdir);
|
2009-04-26 04:03:12 +08:00
|
|
|
if ( system("test -f " srcdir "/LAST_UPDATED") == 0 ) {
|
|
|
|
printf "LAST_UPDATED: ";
|
|
|
|
system("tail -1 " srcdir "/LAST_UPDATED");
|
|
|
|
print "";
|
|
|
|
}
|
2001-07-28 05:10:29 +08:00
|
|
|
|
2003-01-19 22:34:12 +08:00
|
|
|
sub(/^[^ ]*\/configure */, " ", configflags);
|
2007-02-10 08:30:46 +08:00
|
|
|
sub(/,;t t $/, " ", configflags);
|
2003-01-19 22:34:12 +08:00
|
|
|
sub(/ --with-gcc-version-trigger=[^ ]* /, " ", configflags);
|
|
|
|
sub(/ --norecursion /, " ", configflags);
|
|
|
|
sub(/ $/, "", configflags);
|
|
|
|
sub(/^ *$/, " none", configflags);
|
|
|
|
configflags = "configure flags:" configflags;
|
2000-06-04 10:06:54 +08:00
|
|
|
}
|
1998-05-24 06:35:33 +08:00
|
|
|
/^Running target / { print ""; print; }
|
|
|
|
/^Target / { if (host != "") next; else host = $3; }
|
1999-08-10 11:22:39 +08:00
|
|
|
/^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); }
|
1998-05-24 06:35:33 +08:00
|
|
|
/^Native / { if (host != "") next; else host = $4; }
|
|
|
|
/^[ ]*=== [^ ]+ tests ===/ {
|
|
|
|
if (lang == "") lang = " "$2" "; else lang = " ";
|
|
|
|
}
|
1999-01-07 08:17:40 +08:00
|
|
|
$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
|
1998-05-24 06:35:33 +08:00
|
|
|
/\===.*Summary/ { print ""; print; blanks=1; }
|
|
|
|
/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
|
2009-08-19 03:40:48 +08:00
|
|
|
/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { sub ("\r", ""); print; }
|
2004-08-26 13:51:22 +08:00
|
|
|
/^using:/ { print ""; print; print ""; }
|
1998-05-24 06:35:33 +08:00
|
|
|
# dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
|
|
|
|
# dumpall != 0 { print; }
|
|
|
|
# /^FAIL/ { dumpall=1; }
|
|
|
|
/^$/ && blanks>0 { print; --blanks; }
|
|
|
|
END { if (lang != "") {
|
1998-06-19 09:39:58 +08:00
|
|
|
print "";
|
1998-11-25 20:59:24 +08:00
|
|
|
print "Compiler version: " prefix version lang;
|
|
|
|
print "Platform: " host;
|
1998-05-24 06:35:33 +08:00
|
|
|
print configflags;
|
|
|
|
'${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
|
|
|
|
if (boot_cflags != 0) print boot_cflags;
|
1998-06-19 09:39:58 +08:00
|
|
|
'${append_logs+" system(\"cat $append_logs\"); "}'
|
1998-05-24 06:35:33 +08:00
|
|
|
print "EOF";
|
|
|
|
print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
|
|
|
|
}}
|
|
|
|
{ next; }
|
2000-08-09 13:12:51 +08:00
|
|
|
' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
|
1998-05-24 06:35:33 +08:00
|
|
|
if $move; then
|
|
|
|
for file in $files `ls -1 $files | sed s/sum$/log/`; do
|
2002-05-17 01:43:21 +08:00
|
|
|
[ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&"
|
1998-05-24 06:35:33 +08:00
|
|
|
done
|
|
|
|
fi &&
|
|
|
|
echo true
|
|
|
|
exit 0
|