]> git.ipfire.org Git - thirdparty/gcc.git/blame - contrib/test_summary
Fix copyright.
[thirdparty/gcc.git] / contrib / test_summary
CommitLineData
d258564a
JL
1#! /bin/sh
2
91fa313b
AO
3# (C) 1998 Free Software Foundation
4# Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
d258564a
JL
5
6# This script is Free Software, and it can be copied, distributed and
7# modified as defined in the GNU General Public License. A copy of
8# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
9
10# This script processes *.{sum,log} files, producing a shell-script
11# that sends e-mail to the appropriate lists and renames files to
12# *.sent. It currently handles gcc and egcs, but it should be quite
13# easy to modify it to handle other packages and its mailing lists.
14
15# The scripts assumes it is run in the root directory of the build
16# tree, and it will include all .sum files it finds in the mail
17# report.
18
19# configure flags are extracted from ./config.status
20
21# if the BOOT_CFLAGS environment variable is set, it will be included
22# in the mail report too.
23
24# The usage pattern of this script is as follows:
25
59d3b2e4 26# test_summary | more # so as to observe what should be done
d258564a 27
59d3b2e4 28# test_summary | sh # so as to actually send e-mail and move log files
d258564a
JL
29
30# It accepts a few command line arguments. For example:
31# -o: re-reads logs that have been mailed already (.sum.sent)
32# -t: prevents logs from being renamed
0a955618 33# -p: prepend specified file (or list of files: -p "a b") to the report
3e5fb7a9 34# -i: append specified file (or list of files: -i "a b") to the report
59d3b2e4
GP
35# -m: specify the e-mail address to send notes to. An appropriate default
36# should be selected from the log files.
37# -f: force reports to be mailed; if omitted, only reports that differ
38# from the sent.* version are sent.
269df0f8
JL
39
40# Find a good awk.
41if test -z "$AWK" ; then
42 for AWK in gawk nawk awk ; do
43 if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
44 :
45 else
46 break
47 fi
48 done
49fi
50
d258564a
JL
51: ${filesuffix=}; export fileprefix
52: ${move=true}; export move
53: ${forcemail=false}; export forcemail
54while true; do
55 case "$1" in
56 -o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;;
57 -t) move=false; shift;;
0a955618 58 -p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
3e5fb7a9 59 -i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
d258564a
JL
60 -m) mailto=$2; forcemail=true; shift 2;;
61 -f) unset mailto; forcemail=true; shift;;
62 *) break;;
63 esac
64done
65: ${mailto="\" address \""}; export mailto
66files=`find . -name \*.sum$filesuffix -print`
67anyfile=false anychange=$forcemail &&
68for file in $files; do
69 [ -f $file ] &&
70 anyfile=true &&
71 { $anychange ||
72 anychange=`diff -u $file.sent $file 2>/dev/null |
73 if test ! -f $file.sent ||
74 egrep '^[-+](XPASS|FAIL)' >/dev/null; then
75 echo true
76 else
77 echo false
78 fi
79 `
80 }
81 true
82done &&
83$anyfile &&
84if $forcemail || $anychange; then :; else mailto=nobody; fi &&
269df0f8 85$AWK '
d258564a
JL
86BEGIN {
87 lang="";
cae94af8 88 print "cat <<\EOF |";
0a955618 89'${prepend_logs+" system(\"cat $prepend_logs\"); "}'
d258564a
JL
90}
91$1 ~ /\/configure$/ { $1 = "configure flags:"; configflags = $0 }
92/^Running target / { print ""; print; }
93/^Target / { if (host != "") next; else host = $3; }
94/^Native / { if (host != "") next; else host = $4; }
95/^[ ]*=== [^ ]+ tests ===/ {
96 if (lang == "") lang = " "$2" "; else lang = " ";
97}
98/\/ss(\/|c? )/ {
0a955618 99 program="ss";
d258564a
JL
100 if (lang == " ") address="nobody";
101 else if (lang == " gcc ") address="gcc2@cygnus.com";
102 else address="g++@cygnus.com";
103}
104/\/egcsh?((-[^ ]*)?\/|c?[ -])/ {
ddf469cc 105 address="egcs-testresults@egcs.cygnus.com";
d258564a
JL
106 if (version == 0) version="egcs";
107}
108/--disable-haifa/ { prefix="haifa-disabled "; }
109/--enable-haifa/ { prefix="haifa-enabled "; }
110$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); $0 = save; }
111/\===.*Summary/ { print ""; print; blanks=1; }
112/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
113/^(XPASS|FAIL|# of )/ { print; }
114# dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
115# dumpall != 0 { print; }
116# /^FAIL/ { dumpall=1; }
117/^$/ && blanks>0 { print; --blanks; }
118END { if (lang != "") {
3e5fb7a9 119 print "";
0a955618
AO
120 print "Compiler version: " prefix version lang;
121 print "Platform: " host;
d258564a
JL
122 print configflags;
123 '${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
124 if (boot_cflags != 0) print boot_cflags;
3e5fb7a9 125'${append_logs+" system(\"cat $append_logs\"); "}'
d258564a
JL
126 print "EOF";
127 print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
128}}
129{ next; }
130' ./config.status $files | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
131if $move; then
132 for file in $files `ls -1 $files | sed s/sum$/log/`; do
133 [ -f $file ] && echo "mv `pwd`/$file `pwd`/$file.sent &&"
134 done
135fi &&
136echo true
137exit 0