]> git.ipfire.org Git - thirdparty/gcc.git/blame - contrib/test_summary
contrib/gcc-changelog: Skip over review lines
[thirdparty/gcc.git] / contrib / test_summary
CommitLineData
d258564a
JL
1#! /bin/sh
2
fb340c3c 3# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009, 2010
7527cf21 4# Free Software Foundation
91fa313b 5# Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
d258564a
JL
6
7# This script is Free Software, and it can be copied, distributed and
8# modified as defined in the GNU General Public License. A copy of
9# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
10
11# This script processes *.{sum,log} files, producing a shell-script
12# that sends e-mail to the appropriate lists and renames files to
bc8735ed
AO
13# *.sent. It currently handles only gcc, but it should be quite easy
14# to modify it to handle other packages and its mailing lists.
d258564a
JL
15
16# The scripts assumes it is run in the root directory of the build
17# tree, and it will include all .sum files it finds in the mail
18# report.
19
20# configure flags are extracted from ./config.status
21
22# if the BOOT_CFLAGS environment variable is set, it will be included
23# in the mail report too.
24
25# The usage pattern of this script is as follows:
26
59d3b2e4 27# test_summary | more # so as to observe what should be done
d258564a 28
59d3b2e4 29# test_summary | sh # so as to actually send e-mail and move log files
d258564a
JL
30
31# It accepts a few command line arguments. For example:
5ce810b7
PE
32if test x"$1" = "x-h"; then
33 cat <<_EOF
34 -o: re-reads logs that have been mailed already (.sum.sent)
35 -t: prevents logs from being renamed
36 -p: prepend specified file (or list of files: -p "a b") to the report
37 -i: append specified file (or list of files: -i "a b") to the report
38 -m: specify the e-mail address to send notes to. An appropriate default
39 should be selected from the log files.
40 -f: force reports to be mailed; if omitted, only reports that differ
41 from the sent.* version are sent.
42_EOF
43 exit 0
44fi
269df0f8
JL
45
46# Find a good awk.
47if test -z "$AWK" ; then
48 for AWK in gawk nawk awk ; do
49 if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
50 :
51 else
52 break
53 fi
54 done
55fi
56
5da01bc1 57: ${filesuffix=}; export filesuffix
d258564a
JL
58: ${move=true}; export move
59: ${forcemail=false}; export forcemail
60while true; do
61 case "$1" in
62 -o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;;
63 -t) move=false; shift;;
0a955618 64 -p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
3e5fb7a9 65 -i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
d258564a
JL
66 -m) mailto=$2; forcemail=true; shift 2;;
67 -f) unset mailto; forcemail=true; shift;;
68 *) break;;
69 esac
70done
71: ${mailto="\" address \""}; export mailto
26d8af06 72files=`find . -name \*.sum$filesuffix -print | sort`
d258564a
JL
73anyfile=false anychange=$forcemail &&
74for file in $files; do
75 [ -f $file ] &&
76 anyfile=true &&
77 { $anychange ||
fb340c3c 78 anychange=`diff $file.sent $file 2>/dev/null |
d258564a 79 if test ! -f $file.sent ||
fb340c3c 80 egrep '^[<>] (XPASS|FAIL)' >/dev/null; then
d258564a
JL
81 echo true
82 else
83 echo false
84 fi
85 `
86 }
87 true
88done &&
89$anyfile &&
90if $forcemail || $anychange; then :; else mailto=nobody; fi &&
e50d2932
AO
91# We use cat instead of listing the files as arguments to AWK because
92# GNU awk 3.0.0 would break if any of the filenames contained `=' and
93# was preceded by an invalid ``variable'' name.
0930984e 94( echo @TOPLEVEL_CONFIGURE_ARGUMENTS@ | ./config.status --file=-; cat $files ) |
269df0f8 95$AWK '
d258564a 96BEGIN {
d25fc1b5 97 lang=""; configflags = "";
bc8735ed
AO
98 address="gcc-testresults@gcc.gnu.org";
99 version="gcc";
dd5330e8 100 print "cat <<'"'"'EOF'"'"' |";
0a955618 101'${prepend_logs+" system(\"cat $prepend_logs\"); "}'
d258564a 102}
0930984e 103NR == 1 {
ce985125 104 configflags = $0 " ";
ce985125 105 srcdir = configflags;
1e4573c0
CL
106 sub(/\/configure\047? .*/, "", srcdir);
107 sub(/^\047/, "", srcdir);
7527cf21
GP
108 if ( system("test -f " srcdir "/LAST_UPDATED") == 0 ) {
109 printf "LAST_UPDATED: ";
110 system("tail -1 " srcdir "/LAST_UPDATED");
111 print "";
112 }
da397f8e 113
1e4573c0 114 sub(/^[^ ]*\/configure\047? */, " ", configflags);
ce0d943a 115 sub(/,;t t $/, " ", configflags);
d25fc1b5
AO
116 sub(/ --with-gcc-version-trigger=[^ ]* /, " ", configflags);
117 sub(/ --norecursion /, " ", configflags);
118 sub(/ $/, "", configflags);
119 sub(/^ *$/, " none", configflags);
120 configflags = "configure flags:" configflags;
dd5330e8 121}
d258564a
JL
122/^Running target / { print ""; print; }
123/^Target / { if (host != "") next; else host = $3; }
83694b61 124/^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); }
d258564a
JL
125/^Native / { if (host != "") next; else host = $4; }
126/^[ ]*=== [^ ]+ tests ===/ {
127 if (lang == "") lang = " "$2" "; else lang = " ";
128}
692c4bf5 129$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
547d5d22 130/===.*Summary/ { print ""; print; blanks=1; }
d258564a 131/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
c2d88223 132/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { sub ("\r", ""); print; }
1249691b 133/^using:/ { print ""; print; print ""; }
d258564a
JL
134# dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
135# dumpall != 0 { print; }
136# /^FAIL/ { dumpall=1; }
137/^$/ && blanks>0 { print; --blanks; }
138END { if (lang != "") {
3e5fb7a9 139 print "";
0a955618
AO
140 print "Compiler version: " prefix version lang;
141 print "Platform: " host;
d258564a
JL
142 print configflags;
143 '${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
144 if (boot_cflags != 0) print boot_cflags;
3e5fb7a9 145'${append_logs+" system(\"cat $append_logs\"); "}'
d258564a
JL
146 print "EOF";
147 print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
148}}
149{ next; }
e50d2932 150' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
d258564a
JL
151if $move; then
152 for file in $files `ls -1 $files | sed s/sum$/log/`; do
1e6347d8 153 [ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&"
d258564a
JL
154 done
155fi &&
156echo true
157exit 0