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