summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-28 17:48:13 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-28 17:48:13 +0000
commit2342abeb0a094fc67383b6063409a224f4b55241 (patch)
tree7b583f75d661036e87da77ebd85f8195731d7683 /bin
parentf3a562bbb985ca889341e87a8db0032e1f4acac8 (diff)
downloadATCD-2342abeb0a094fc67383b6063409a224f4b55241.tar.gz
added this script, which checks build logs named *.log, of current day
Diffstat (limited to 'bin')
-rwxr-xr-xbin/check_build_logs98
1 files changed, 98 insertions, 0 deletions
diff --git a/bin/check_build_logs b/bin/check_build_logs
new file mode 100755
index 00000000000..899814925b0
--- /dev/null
+++ b/bin/check_build_logs
@@ -0,0 +1,98 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+#
+# Reviews build logs and reports problems, via stdout or mail.
+
+$usage="$0 [-l log directory] [-m mail recipient(s)]\n";
+
+####
+#### Configuration parameters.
+####
+$find = 'find';
+$mail = 'mail';
+
+$ostype = $ENV{'OSTYPE'} || `/bin/uname -s`;
+if ( "$ostype" =~ /(solaris)|(SunOS)/i ) {
+ $find = '/pkg/gnu/bin/find';
+ $mail = 'mailx';
+}
+
+
+$log_directory = '/project/danzontmp/levine/build-logs';
+$mail_recipients = '';
+
+####
+#### Process command line args.
+####
+foreach my $arg (@ARGV) {
+ if ($arg eq '-l') {
+ if ( $ARGV[1] =~ /^[\da-zA-Z]+$/ ) {
+ $log_directory = $ARGV[1];
+ shift;
+ } else {
+ print STDERR "$0: must provide argument for -l option\n";
+ die $usage;
+ }
+ shift;
+ } elsif ($arg eq '-m') {
+ if ( $ARGV[1] =~ /^[\da-zA-Z]+$/ ) {
+ $mail_recipients = $ARGV[1];
+ shift;
+ } else {
+ print STDERR "$0: must provide argument for -m option\n";
+ die $usage;
+ }
+ shift;
+ } elsif ($arg eq '-?') {
+ print "$usage";
+ exit;
+ } else {
+ print "$usage";
+ exit;
+ }
+}
+
+
+####
+#### Find the log files.
+####
+chdir $log_directory ||
+ die "$0: unable to cd to \"$log_directory\"\n";
+
+($log_files = ( `$find . -name '*.log' -daystart -ctime 0 -print` )) =~
+ tr [\n] [ ];
+
+
+####
+#### Grep the log files for problems.
+####
+@output = ();
+open (EGREP, "egrep -n \'Error|errors|[^a][Ss]top|No rule to make|\(undefined symb\)|[Ww]arn|not exist|core dumped|: #[0-9]|cxx:\' $log_files |") ||
+ die "$0: unable to open egrep\n";
+while (<EGREP>) {
+ push @output, $_;
+}
+close EGREP;
+
+
+####
+#### Produce output, if there were any problems.
+####
+if ($#output > -1) {
+
+ if ("$mail_recipients") {
+ open (MAIL, "| $mail -s 'ACE+TAO build results' $mail_recipients") ||
+ die "$0: unable to open pipe to $mail\n";
+ select MAIL;
+ }
+
+ print "This is an automatically generated message.\n\n";
+ print "Log files are in $log_directory.\n\n";
+
+ print @output;
+
+ close MAIL if "$mail_recipients";
+}