1 | #! /bin/sh
|
---|
2 |
|
---|
3 | # (C) 1998, 1999, 2000, 2002 Free Software Foundation
|
---|
4 | # Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
|
---|
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 only gcc, but it should be quite easy
|
---|
13 | # 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 |
|
---|
26 | # test_summary | more # so as to observe what should be done
|
---|
27 |
|
---|
28 | # test_summary | sh # so as to actually send e-mail and move log files
|
---|
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
|
---|
33 | # -p: prepend specified file (or list of files: -p "a b") to the report
|
---|
34 | # -i: append specified file (or list of files: -i "a b") to the report
|
---|
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.
|
---|
39 |
|
---|
40 | # Find a good awk.
|
---|
41 | if 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
|
---|
49 | fi
|
---|
50 |
|
---|
51 | : ${filesuffix=}; export filesuffix
|
---|
52 | : ${move=true}; export move
|
---|
53 | : ${forcemail=false}; export forcemail
|
---|
54 | while true; do
|
---|
55 | case "$1" in
|
---|
56 | -o) filesuffix=.sent; move=false; : ${mailto=nobody}; shift;;
|
---|
57 | -t) move=false; shift;;
|
---|
58 | -p) prepend_logs=${prepend_logs+"$prepend_logs "}"$2"; shift 2;;
|
---|
59 | -i) append_logs=${append_logs+"$append_logs "}"$2"; shift 2;;
|
---|
60 | -m) mailto=$2; forcemail=true; shift 2;;
|
---|
61 | -f) unset mailto; forcemail=true; shift;;
|
---|
62 | *) break;;
|
---|
63 | esac
|
---|
64 | done
|
---|
65 | : ${mailto="\" address \""}; export mailto
|
---|
66 | files=`find . -name \*.sum$filesuffix -print | sort`
|
---|
67 | anyfile=false anychange=$forcemail &&
|
---|
68 | for 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
|
---|
82 | done &&
|
---|
83 | $anyfile &&
|
---|
84 | if $forcemail || $anychange; then :; else mailto=nobody; fi &&
|
---|
85 | # We use cat instead of listing the files as arguments to AWK because
|
---|
86 | # GNU awk 3.0.0 would break if any of the filenames contained `=' and
|
---|
87 | # was preceded by an invalid ``variable'' name.
|
---|
88 | cat ./config.status $files |
|
---|
89 | $AWK '
|
---|
90 | BEGIN {
|
---|
91 | lang="";
|
---|
92 | address="gcc-testresults@gcc.gnu.org";
|
---|
93 | version="gcc";
|
---|
94 | print "cat <<'"'"'EOF'"'"' |";
|
---|
95 | '${prepend_logs+" system(\"cat $prepend_logs\"); "}'
|
---|
96 | }
|
---|
97 | $1 ~ /\/configure$/ {
|
---|
98 | srcdir = $1;
|
---|
99 | gsub(/\/configure$/, "", srcdir);
|
---|
100 | printf "LAST_UPDATED: ";
|
---|
101 | system("tail -1 " srcdir "/LAST_UPDATED");
|
---|
102 | print "";
|
---|
103 |
|
---|
104 | $1 = "configure flags:"; configflags = $0;
|
---|
105 | gsub(/--with-gcc-version-trigger=[^ ]* /, "", configflags);
|
---|
106 | gsub(/ --norecursion/, "", configflags)
|
---|
107 | }
|
---|
108 | /^Running target / { print ""; print; }
|
---|
109 | /^Target / { if (host != "") next; else host = $3; }
|
---|
110 | /^Host / && host ~ /^unix\{.*\}$/ { host = $3 " " substr(host, 5); }
|
---|
111 | /^Native / { if (host != "") next; else host = $4; }
|
---|
112 | /^[ ]*=== [^ ]+ tests ===/ {
|
---|
113 | if (lang == "") lang = " "$2" "; else lang = " ";
|
---|
114 | }
|
---|
115 | $2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
|
---|
116 | /\===.*Summary/ { print ""; print; blanks=1; }
|
---|
117 | /tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
|
---|
118 | /^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { print; }
|
---|
119 | /^using:/ { print ""; print; print ""; }
|
---|
120 | # dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
|
---|
121 | # dumpall != 0 { print; }
|
---|
122 | # /^FAIL/ { dumpall=1; }
|
---|
123 | /^$/ && blanks>0 { print; --blanks; }
|
---|
124 | END { if (lang != "") {
|
---|
125 | print "";
|
---|
126 | print "Compiler version: " prefix version lang;
|
---|
127 | print "Platform: " host;
|
---|
128 | print configflags;
|
---|
129 | '${BOOT_CFLAGS+'print "BOOT_CFLAGS='"${BOOT_CFLAGS}"'";'}'
|
---|
130 | if (boot_cflags != 0) print boot_cflags;
|
---|
131 | '${append_logs+" system(\"cat $append_logs\"); "}'
|
---|
132 | print "EOF";
|
---|
133 | print "Mail -s \"Results for " prefix version lang "testsuite on " host "\" '"${mailto}"' &&";
|
---|
134 | }}
|
---|
135 | { next; }
|
---|
136 | ' | sed "s/\([\`\$\\\\]\)/\\\\\\1/g" &&
|
---|
137 | if $move; then
|
---|
138 | for file in $files `ls -1 $files | sed s/sum$/log/`; do
|
---|
139 | [ -f $file ] && echo "mv `${PWDCMD-pwd}`/$file `${PWDCMD-pwd}`/$file.sent &&"
|
---|
140 | done
|
---|
141 | fi &&
|
---|
142 | echo true
|
---|
143 | exit 0
|
---|