]>
Commit | Line | Data |
---|---|---|
d258564a JL |
1 | #! /bin/sh |
2 | ||
1e6347d8 | 3 | # (C) 1998, 1999, 2000, 2002 Free Software Foundation |
91fa313b | 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 | |
bc8735ed AO |
12 | # *.sent. It currently handles only gcc, but it should be quite easy |
13 | # to modify it to handle other packages and its mailing lists. | |
d258564a JL |
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: | |
5ce810b7 PE |
31 | if test x"$1" = "x-h"; then |
32 | cat <<_EOF | |
33 | -o: re-reads logs that have been mailed already (.sum.sent) | |
34 | -t: prevents logs from being renamed | |
35 | -p: prepend specified file (or list of files: -p "a b") to the report | |
36 | -i: append specified file (or list of files: -i "a b") to the report | |
37 | -m: specify the e-mail address to send notes to. An appropriate default | |
38 | should be selected from the log files. | |
39 | -f: force reports to be mailed; if omitted, only reports that differ | |
40 | from the sent.* version are sent. | |
41 | _EOF | |
42 | exit 0 | |
43 | fi | |
269df0f8 JL |
44 | |
45 | # Find a good awk. | |
46 | if test -z "$AWK" ; then | |
47 | for AWK in gawk nawk awk ; do | |
48 | if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then | |
49 | : | |
50 | else | |
51 | break | |
52 | fi | |
53 | done | |
54 | fi | |
55 | ||
5da01bc1 | 56 | : ${filesuffix=}; export filesuffix |
d258564a JL |
57 | : ${move=true}; export move |
58 | : ${forcemail=false}; export forcemail | |
59 | while true; do | |
60 | case "$1" in | |
61 | -o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;; | |
62 | -t) move=false; shift;; | |
0a955618 | 63 | -p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;; |
3e5fb7a9 | 64 | -i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;; |
d258564a JL |
65 | -m) mailto=$2; forcemail=true; shift 2;; |
66 | -f) unset mailto; forcemail=true; shift;; | |
67 | *) break;; | |
68 | esac | |
69 | done | |
70 | : ${mailto="\" address \""}; export mailto | |
26d8af06 | 71 | files=`find . -name \*.sum$filesuffix -print | sort` |
d258564a JL |
72 | anyfile=false anychange=$forcemail && |
73 | for file in $files; do | |
74 | [ -f $file ] && | |
75 | anyfile=true && | |
76 | { $anychange || | |
77 | anychange=`diff -u $file.sent $file 2>/dev/null | | |
78 | if test ! -f $file.sent || | |
79 | egrep '^[-+](XPASS|FAIL)' >/dev/null; then | |
80 | echo true | |
81 | else | |
82 | echo false | |
83 | fi | |
84 | ` | |
85 | } | |
86 | true | |
87 | done && | |
88 | $anyfile && | |
89 | if $forcemail || $anychange; then :; else mailto=nobody; fi && | |
e50d2932 AO |
90 | # We use cat instead of listing the files as arguments to AWK because |
91 | # GNU awk 3.0.0 would break if any of the filenames contained `=' and | |
92 | # was preceded by an invalid ``variable'' name. | |
93 | cat ./config.status $files | | |
269df0f8 | 94 | $AWK ' |
d258564a | 95 | BEGIN { |
d25fc1b5 | 96 | lang=""; configflags = ""; |
bc8735ed AO |
97 | address="gcc-testresults@gcc.gnu.org"; |
98 | version="gcc"; | |
dd5330e8 | 99 | print "cat <<'"'"'EOF'"'"' |"; |
0a955618 | 100 | '${prepend_logs+" system(\"cat $prepend_logs\"); "}' |
d258564a | 101 | } |
d25fc1b5 AO |
102 | ($0 ~ /^[^ ]*\/configure / || $0 ~ /^# [^ ]*\/configure /) && |
103 | configflags == "" { | |
ce985125 | 104 | configflags = $0 " "; |
d25fc1b5 | 105 | sub(/^# /, "", configflags); |
ce985125 | 106 | srcdir = configflags; |
d25fc1b5 | 107 | sub(/\/configure .*/, "", srcdir); |
da397f8e RH |
108 | printf "LAST_UPDATED: "; |
109 | system("tail -1 " srcdir "/LAST_UPDATED"); | |
110 | print ""; | |
111 | ||
d25fc1b5 AO |
112 | sub(/^[^ ]*\/configure */, " ", configflags); |
113 | sub(/ --with-gcc-version-trigger=[^ ]* /, " ", configflags); | |
114 | sub(/ --norecursion /, " ", configflags); | |
115 | sub(/ $/, "", configflags); | |
116 | sub(/^ *$/, " none", configflags); | |
117 | configflags = "configure flags:" configflags; | |
dd5330e8 | 118 | } |
d258564a JL |
119 | /^Running target / { print ""; print; } |
120 | /^Target / { if (host != "") next; else host = $3; } | |
83694b61 | 121 | /^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); } |
d258564a JL |
122 | /^Native / { if (host != "") next; else host = $4; } |
123 | /^[ ]*=== [^ ]+ tests ===/ { | |
124 | if (lang == "") lang = " "$2" "; else lang = " "; | |
125 | } | |
692c4bf5 | 126 | $2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; } |
d258564a JL |
127 | /\===.*Summary/ { print ""; print; blanks=1; } |
128 | /tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; } | |
506d4ef6 | 129 | /^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { print; } |
1249691b | 130 | /^using:/ { print ""; print; print ""; } |
d258564a JL |
131 | # dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; } |
132 | # dumpall != 0 { print; } | |
133 | # /^FAIL/ { dumpall=1; } | |
134 | /^$/ && blanks>0 { print; --blanks; } | |
135 | END { if (lang != "") { | |
3e5fb7a9 | 136 | print ""; |
0a955618 AO |
137 | print "Compiler version: " prefix version lang; |
138 | print "Platform: " host; | |
d258564a JL |
139 | print configflags; |
140 | '${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}' | |
141 | if (boot_cflags != 0) print boot_cflags; | |
3e5fb7a9 | 142 | '${append_logs+" system(\"cat $append_logs\"); "}' |
d258564a JL |
143 | print "EOF"; |
144 | print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&"; | |
145 | }} | |
146 | { next; } | |
e50d2932 | 147 | ' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" && |
d258564a JL |
148 | if $move; then |
149 | for file in $files `ls -1 $files | sed s/sum$/log/`; do | |
1e6347d8 | 150 | [ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&" |
d258564a JL |
151 | done |
152 | fi && | |
153 | echo true | |
154 | exit 0 |