summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-22 03:44:16 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-22 03:44:16 +0000
commitcde6e03deabe5f5eeacfaaf421926571b4639504 (patch)
treec11e28ad6e41538749884fa7d46bdcef0103815a /bin
parentd489d4e42c670983eae1ea3706013c37fdd97be9 (diff)
downloadATCD-cde6e03deabe5f5eeacfaaf421926571b4639504.tar.gz
ChangeLogTag:Thu Aug 21 22:38:19 1997 Carlos O'Ryan <coryan@polka.cs.wustl.edu>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/auto_compile195
-rwxr-xr-xbin/auto_compile_wrapper46
2 files changed, 241 insertions, 0 deletions
diff --git a/bin/auto_compile b/bin/auto_compile
new file mode 100755
index 00000000000..72fbfe78953
--- /dev/null
+++ b/bin/auto_compile
@@ -0,0 +1,195 @@
+#
+# $Id$
+#
+# This script checkouts ACE from CVS, updates the "clone" directory,
+# compiles $ACE_ROOT/ace and $ACE_ROOT/tests and finally runs
+# $ACE_ROOT/tests/run_tests.sh.
+#
+# If it detects any problem it send email.
+#
+# DO NOT invoke this script from your crontab, use
+# auto_compile_wrapper for that.
+#
+# This script requires Perl5.
+#
+# TODO: Modify the script or split it in such a way that the main copy
+# can be obtained either using cvs or downloading the lastest beta
+# from the WWW.
+#
+
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# The first three lines above let this script run without specifying the
+# full path to perl, as long as it is in the user's PATH.
+# Taken from perlrun man page.
+
+use File::Basename;
+require POSIX;
+
+# This is the module we will checkout, someday someone could define a
+# smaller module.
+$MODULE='ACE_wrappers';
+
+# This are the sub-directories (in the module) we really compile.
+
+@BUILD_LIST=('ace', 'tests');
+
+# This are the pairs "sub-directory,script" we run.
+
+%RUN_LIST=('tests' => 'run_tests.sh');
+
+# We obtain our revision to report errors in a "nice" manner.
+$REVISION='$Revision$';
+
+# Find out the command name.
+$CMD = basename($0);
+
+# Extract configuration information from command line.
+# TODO: Some validation and checking should be done here.
+$CHECKOUT = $ARGV[0];
+$BUILD = $ARGV[1];
+$LOGDIR = $ARGV[2];
+$ADMIN = $ARGV[3];
+
+# When an error is found we try to die gracefully and send some email
+# to ADMIN.
+
+sub mydie {
+ local $msg = shift;
+ open(MAIL, "|mail $ADMIN")
+ || die "cannot open email pipe on error: $msg\n";
+ print MAIL 'The following error is brought to you by: ', "\n";
+ print MAIL $CMD, ' [', $REVISION, "] for $BUILD on $CHECKOUT\n";
+ print MAIL "\n", $msg, "\n";
+ print MAIL "\nPlease check log files for more info\n";
+ close(MAIL)
+ || die "cannot close email pipe on error: $msg\n";
+ print HIST 'FAILED', "\n";
+ exit 0;
+}
+
+### MAIN FUNCTION
+
+$histfile = $LOGDIR . '/history';
+open(HIST, '>>' . $histfile)
+ # Do not use 'mydie' to report the problem, it tries to use HIST....
+ || die "cannot open history file \"$histfile\"\n";
+
+$date = localtime;
+
+print HIST $CMD, ': running at ', $date, ' ';
+
+if (-f $LOGDIR . '/.disable') {
+ print HIST 'DISABLED\n';
+ exit 0;
+}
+
+$LOGFILE = $LOGDIR . '/' . POSIX::strftime("%b%d_%Y.log", localtime);
+open(LOG, '>' . $LOGFILE)
+ || mydie "cannot open log file";
+
+# The following lines are useful when debugging the script or wrapper.
+# print LOG $CHECKOUT, " ", $BUILD, " ", $LOGDIR, " ", $ADMIN, "\n";
+#while (($key,$value) = each %ENV) {
+# print LOG $key, " = ", $value, "\n";
+#}
+
+chdir($CHECKOUT)
+ || mydie "Cannot chdir to $CHECKOUT";
+
+$date = localtime;
+print LOG "$CMD: starting checkout at ", $date, "\n";
+open(CVS, "cvs checkout -P $MODULE 2>&1 |")
+ || mydie "cannot start checkout of $MODULE";
+
+$conflicts = 0;
+while (<CVS>) {
+ if (m/^C /) {
+ $conflicts = 1;
+ }
+ print LOG $_;
+}
+close(CVS)
+ || mydie "error while checking out $MODULE";
+$date = localtime;
+print LOG "$CMD: checkout finished at ", $date, "\n";
+
+if ($conflicts != 0) {
+ mydie "conflicts on checkout";
+}
+
+chdir($MODULE)
+ || mydie "cannot chdir to $MODULE";
+
+$date = localtime;
+print LOG "$CMD: starting clone at ", $date, "\n";
+open(MAKE, "bin/create_ace_build -a -v $BUILD 2>&1 |")
+ || mydie "cannot clone directory";
+while(<MAKE>) {
+ print LOG $_;
+}
+close(MAKE)
+ || mydie "error while cloning ACE_ROOT";
+$date = localtime;
+print LOG "$CMD: clone finished at ", $date, "\n";
+
+chdir('build/' . $BUILD)
+ || mydie "cannot chdir to $BUILD";
+
+# This is needed for real make run....
+$ENV{'ACE_ROOT'} = $CHECKOUT . '/' . $MODULE . '/build/' . $BUILD;
+
+foreach $i (@BUILD_LIST) {
+ $date = localtime;
+ print LOG "$CMD: make for $i started at ", $date, "\n";
+ open(MAKE, "make -k -C $i 2>&1 |")
+ || mydie "cannot start make for $i";
+ $make_errors = 0;
+ while (<MAKE>) {
+ if (m/^make: \*\*\*/) {
+ $make_errors = 1;
+ }
+ print LOG $_;
+ }
+ close(MAKE)
+ || mydie "errors while running make in $i";
+ $date = localtime;
+ print LOG "$CMD: make for $i finished at ", $date, "\n";
+ if ($make_errors == 1) {
+ mydie "errors detected in $i compilation";
+ }
+}
+
+while (($directory,$program) = each %RUN_LIST) {
+ $date = localtime;
+ print LOG "$CMD: running $program in $directory at ", $date, "\n";
+ chdir($directory)
+ || mydie "cannot chdir to $directory";
+
+ open(RUN, "$program 2>&1 |")
+ || mydie "cannot run $program";
+ $run_error = 0;
+ while (<RUN>) {
+ print LOG $_;
+ if (m/^Error/) {
+ $run_error = 1;
+ }
+ }
+ close(RUN)
+ || mydie "cannot finish $program";
+ $date = localtime;
+ print LOG "$CMD: $program finished ", $date, "\n";
+
+ if ($run_error != 0) {
+ mydie "errors detected while running $program in $directory";
+ }
+}
+
+close(LOG)
+ || mydie "cannot close LOGFILE";
+
+print HIST "OK\n";
+close(HIST)
+ || mydie "cannot close history file";
diff --git a/bin/auto_compile_wrapper b/bin/auto_compile_wrapper
new file mode 100755
index 00000000000..5d5cda7e1fd
--- /dev/null
+++ b/bin/auto_compile_wrapper
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Usually cron setups a really miserable enviroment, this script
+# serves two purposes:
+# 1. Setup a good enviroment for auto_compile.
+# 2. Invoke auto_compile with the proper arguments for each site.
+#
+# The idea is to modify this script on a per-site basis and leave
+# auto_compile unmodified.
+#
+
+# Setup a proper path, remember that cvs, GNU make, perl5 and your
+# compiler must be there.
+PATH=.:$HOME/bin:/pkg/gnu/bin:/opt/SUNWspro/bin:$PATH
+export PATH
+
+# Obvious enough.
+CVSROOT=/project/cvs-repository
+export CVSROOT
+
+# It could be a good idea to set CVSREAD this will make the staging
+# area read-only, but our staging areas are public.
+# CVSREAD=Y
+# export CVSREAD
+
+# Here we define the cvs working copy for our staging area.
+CHECKOUT=$HOME/head
+
+# In some sites the building directory differs from the cvs working
+# copy. The directory is updated running
+# $ACE_ROOT/bin/create_ace_build; but it must be setup manually the
+# first time.
+# TODO: Arrange for automatic creation of platform_macros.GNU &
+# config.h.
+BUILD=SUNCC
+
+# Here is where we store auto_compile output and keep a history of
+# each run.
+LOGDIR=$HOME/head/ACE_wrappers/build/$BUILD/auto_compile
+
+# Who do we send email when compilation (or anything else) fails.
+ADMIN="coryan@cs.wustl.edu"
+
+exec /pkg/gnu/bin/perl $HOME/bin/auto_compile $CHECKOUT $BUILD $LOGDIR $ADMIN