#! /bin/sh
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
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
: ${filesuffix=}; export filesuffix
: ${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;;
-p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
-i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
-m) mailto=$2; forcemail=true; shift 2;;
-f) unset mailto; forcemail=true; shift;;
*) break;;
esac
done
: ${mailto="\" address \""}; export mailto
files=`find . -name \*.sum$filesuffix -print | sort`
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 &&
cat ./config.status $files |
$AWK '
BEGIN {
lang=""; configflags = "";
address="gcc-testresults@gcc.gnu.org";
version="gcc";
print "cat <<'"'"'EOF'"'"' |";
'${prepend_logs+" system(\"cat $prepend_logs\"); "}'
}
($0 ~ /^[^ ]*\/configure / || $0 ~ /^configflags == "" {
configflags = $0 " ";
sub(/^ srcdir = configflags;
sub(/\/configure .*/, "", srcdir);
printf "LAST_UPDATED: ";
system("tail -1 " srcdir "/LAST_UPDATED");
print "";
sub(/^[^ ]*\/configure */, " ", configflags);
sub(/ --with-gcc-version-trigger=[^ ]* /, " ", configflags);
sub(/ --norecursion /, " ", configflags);
sub(/ $/, "", configflags);
sub(/^ *$/, " none", configflags);
configflags = "configure flags:" configflags;
}
/^Running target / { print ""; print; }
/^Target / { if (host != "") next; else host = $3; }
/^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); }
/^Native / { if (host != "") next; else host = $4; }
/^[ ]*=== [^ ]+ tests ===/ {
if (lang == "") lang = " "$2" "; else lang = " ";
}
$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
/\===.*Summary/ { print ""; print; blanks=1; }
/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|/^using:/ { print ""; print; print ""; }
/^$/ && blanks>0 { print; --blanks; }
END { if (lang != "") {
print "";
print "Compiler version: " prefix version lang;
print "Platform: " host;
print configflags;
'${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
if (boot_cflags != 0) print boot_cflags;
'${append_logs+" system(\"cat $append_logs\"); "}'
print "EOF";
print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
}}
{ next; }
' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
if $move; then
for file in $files `ls -1 $files | sed s/sum$/log/`; do
[ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&"
done
fi &&
echo true
exit 0