expr.c (expand_expr_real_1): Just use do_store_flag.
[official-gcc.git] / contrib / test_summary
blob9bb06051efd062c98b127eb018cacbd816f038e9
1 #! /bin/sh
3 # (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009
4 # Free Software Foundation
5 # Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
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
11 # This script processes *.{sum,log} files, producing a shell-script
12 # that sends e-mail to the appropriate lists and renames files to
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.
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.
20 # configure flags are extracted from ./config.status
22 # if the BOOT_CFLAGS environment variable is set, it will be included
23 # in the mail report too.
25 # The usage pattern of this script is as follows:
27 # test_summary | more # so as to observe what should be done
29 # test_summary | sh # so as to actually send e-mail and move log files
31 # It accepts a few command line arguments. For example:
32 if 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
46 # Find a good awk.
47 if 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
51 else
52 break
54 done
57 : ${filesuffix=}; export filesuffix
58 : ${move=true}; export move
59 : ${forcemail=false}; export forcemail
60 while true; do
61 case "$1" in
62 -o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;;
63 -t) move=false; shift;;
64 -p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
65 -i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
66 -m) mailto=$2; forcemail=true; shift 2;;
67 -f) unset mailto; forcemail=true; shift;;
68 *) break;;
69 esac
70 done
71 : ${mailto="\" address \""}; export mailto
72 files=`find . -name \*.sum$filesuffix -print | sort`
73 anyfile=false anychange=$forcemail &&
74 for file in $files; do
75 [ -f $file ] &&
76 anyfile=true &&
77 { $anychange ||
78 anychange=`diff -u $file.sent $file 2>/dev/null |
79 if test ! -f $file.sent ||
80 egrep '^[-+](XPASS|FAIL)' >/dev/null; then
81 echo true
82 else
83 echo false
87 true
88 done &&
89 $anyfile &&
90 if $forcemail || $anychange; then :; else mailto=nobody; fi &&
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.
94 cat ./config.status $files |
95 $AWK '
96 BEGIN {
97 lang=""; configflags = "";
98 address="gcc-testresults@gcc.gnu.org";
99 version="gcc";
100 print "cat <<'"'"'EOF'"'"' |";
101 '${prepend_logs+" system(\"cat $prepend_logs\"); "}'
103 ($0 ~ /^[^ ]*\/configure / || $0 ~ /^# [^ ]*\/configure /) &&
104 configflags == "" {
105 configflags = $0 " ";
106 sub(/^# /, "", configflags);
107 sub(/^s,@TOPLEVEL_CONFIGURE_ARGUMENTS@,/, "", configflags);
108 srcdir = configflags;
109 sub(/\/configure .*/, "", srcdir);
110 if ( system("test -f " srcdir "/LAST_UPDATED") == 0 ) {
111 printf "LAST_UPDATED: ";
112 system("tail -1 " srcdir "/LAST_UPDATED");
113 print "";
116 sub(/^[^ ]*\/configure */, " ", configflags);
117 sub(/,;t t $/, " ", configflags);
118 sub(/ --with-gcc-version-trigger=[^ ]* /, " ", configflags);
119 sub(/ --norecursion /, " ", configflags);
120 sub(/ $/, "", configflags);
121 sub(/^ *$/, " none", configflags);
122 configflags = "configure flags:" configflags;
124 /^Running target / { print ""; print; }
125 /^Target / { if (host != "") next; else host = $3; }
126 /^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); }
127 /^Native / { if (host != "") next; else host = $4; }
128 /^[ ]*=== [^ ]+ tests ===/ {
129 if (lang == "") lang = " "$2" "; else lang = " ";
131 $2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
132 /\===.*Summary/ { print ""; print; blanks=1; }
133 /tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
134 /^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { print; }
135 /^using:/ { print ""; print; print ""; }
136 # dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
137 # dumpall != 0 { print; }
138 # /^FAIL/ { dumpall=1; }
139 /^$/ && blanks>0 { print; --blanks; }
140 END { if (lang != "") {
141 print "";
142 print "Compiler version: " prefix version lang;
143 print "Platform: " host;
144 print configflags;
145 '${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
146 if (boot_cflags != 0) print boot_cflags;
147 '${append_logs+" system(\"cat $append_logs\"); "}'
148 print "EOF";
149 print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
151 { next; }
152 ' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
153 if $move; then
154 for file in $files `ls -1 $files | sed s/sum$/log/`; do
155 [ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&"
156 done
157 fi &&
158 echo true
159 exit 0