|
From: <sv...@va...> - 2005-07-21 21:32:43
|
Author: njn
Date: 2005-07-21 22:26:07 +0100 (Thu, 21 Jul 2005)
New Revision: 4224
Log:
Improve script to compare the current code with that from 24 hours ago,
and print the diff if they aren't the same.
Modified:
trunk/nightly/bin/nightly
Modified: trunk/nightly/bin/nightly
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/nightly/bin/nightly 2005-07-21 20:23:26 UTC (rev 4223)
+++ trunk/nightly/bin/nightly 2005-07-21 21:26:07 UTC (rev 4224)
@@ -1,74 +1,159 @@
#!/bin/sh
=20
-# Automated build and test for Valgrind. =20
+#-----------------------------------------------------------------------=
-----
+# Automated build and test for Valgrind. Compares Valgrind from 24 hour=
s
+# ago with the current one.
+#
# Use: two args, first is path to top of ValgrindABT tree
# second is name of machine
+#-----------------------------------------------------------------------=
-----
=20
+#-----------------------------------------------------------------------=
-----
+# Helper function
+#-----------------------------------------------------------------------=
-----
+
runcmd () {
- echo -n " $1 ... " >> log.short
- shift
+ logfile=3D$1
+ str=3D$2
+ shift 2
=20
- (eval "$*") >> log.verbose 2>&1
+ # Header in short logfile
+ echo -n " $str ... " >> $logfile.short
=20
- if [ $? =3D=3D 0 ]
+ # Header and command in verbose logfile
+ echo -n " $str ... " >> $logfile.verbose
+ echo "$*" >> $logfile.verbose
+
+ # Run the command
+ (eval "$*") >> $logfile.verbose 2>&1
+ res=3D$?
+
+ # Write result to the short logfile
+ if [ $res =3D=3D 0 ]
then
- echo "done" >> log.short
- return 0
+ echo "done" >> $logfile.short
else
- echo "failed" >> log.short
- return 1
+ echo "failed" >> $logfile.short
fi
+
+ return $res
}
=20
+#-----------------------------------------------------------------------=
-----
+# Startup
+#-----------------------------------------------------------------------=
-----
+# Get args from command line
ABT_TOP=3D$1
ABT_MACHINE=3D$2
=20
+# Get times and date
ABT_START=3D`date "+%F %H:%M:%S %Z"`
=20
+svn_old_date=3D`date --date=3Dyesterday +%Y-%m-%dT%H:%M:%S`
+svn_new_date=3D`date --date=3Dtoday +%Y-%m-%dT%H:%M:%S`
+
cd $ABT_TOP
=20
source $ABT_TOP/conf/$ABT_MACHINE.conf
=20
-rm -rf log.verbose log.short valgrind
=20
-echo > log.short
-echo > log.verbose
+#-----------------------------------------------------------------------=
-----
+# Check out, build, test
+#-----------------------------------------------------------------------=
-----
=20
-echo "Nightly build on" $ABT_MACHINE "(" $ABT_DETAILS ") started at" $AB=
T_START >> log.short
-echo >> log.short
+# Do everything twice -- once for the 24 hours old Valgrind, and once=20
+# for the current one.
+for logfile in old new ; do
=20
-echo "Nightly build on" $ABT_MACHINE "(" $ABT_DETAILS ") started at" $AB=
T_START >> log.verbose
-echo >> log.verbose
+ # Remove the old valgrind/ and vex/ directories
+ rm -rf valgrind vex
=20
-runcmd "Checking out vex source tree " \
- "svn co svn://svn.valgrind.org/vex/trunk vex" && \
-\
-runcmd "Building vex " \
- "cd vex && pwd && make clean version all" && \
-\
-runcmd "Checking out valgrind source tree" \
- "svn co svn://svn.valgrind.org/valgrind/trunk valgrind" && \
-\
-runcmd "Configuring valgrind " \
- "cd valgrind && ./autogen.sh && ./configure --prefix=3D$ABT_TOP/=
Inst --with-vex=3D$ABT_TOP/vex" && \
-\
-runcmd "Building valgrind " \
- "cd valgrind && make && make install" && \
-\
-runcmd "Running regression tests " \
- "cd valgrind && make regtest"
+ # Remove old short and verbose log files, and start the new ones
+ for ext in short verbose ; do
+ echo > $logfile.$ext
+ done
=20
-egrep -q '^=3D=3D [0-9]+ tests' log.verbose && (
- echo >> log.short
- echo "Regression test results follow" >> log.short
- echo >> log.short
- awk '/^=3D=3D [0-9]+ tests/, /^$/ { print }' log.verbose >> log.short
-) || (
- echo >> log.short
- echo "Last 20 lines of log.verbose follow" >> log.short
- echo >> log.short
- tail -20 log.verbose >> log.short
-)
+ # Choose the current Valgrind, or one from 24 hours ago
+ if [ $logfile =3D "old" ] ; then
+ svn_date=3D$svn_old_date
+ else
+ svn_date=3D$svn_new_date
+ fi
=20
-$ABT_TOP/conf/$ABT_MACHINE.sendmail "$ABT_START nightly build ($ABT_MACH=
INE, $ABT_DETAILS)" \
- $ABT_TOP/log.short
+ # Get dates for the old and new versions
+
+ # Check out, build, run tests
+ runcmd $logfile \
+ "Checking out vex source tree " \
+ "svn co svn://svn.valgrind.org/vex/trunk -r {$svn_date} vex" &=
& \
+ \
+ runcmd $logfile \
+ "Building vex " \
+ "cd vex && pwd && make clean version all" && \
+ \
+ runcmd $logfile \
+ "Checking out valgrind source tree" \
+ "svn co svn://svn.valgrind.org/valgrind/trunk -r {$svn_date} v=
algrind" && \
+ \
+ runcmd $logfile \
+ "Configuring valgrind " \
+ "cd valgrind && ./autogen.sh && ./configure --prefix=3D$ABT_T=
OP/Inst --with-vex=3D$ABT_TOP/vex" && \
+ \
+ runcmd $logfile \
+ "Building valgrind " \
+ "cd valgrind && make && make install" && \
+ \
+ runcmd $logfile \
+ "Running regression tests " \
+ "cd valgrind && make regtest"
+
+ # Grab some indicative text for the short log file -- if the regtests
+ # succeeded, show their results. If we didn't make it that far, show=
the
+ # last 20 lines.
+ egrep -q '^=3D=3D [0-9]+ tests' $logfile.verbose && (
+ echo >> $logfile.short
+ echo "Regression test results follow" >> $logfile.short
+ echo >> $logfile.short
+ awk '/^=3D=3D [0-9]+ tests/, /^$/ { print }' $logfile.verbose >> $=
logfile.short
+ ) || (
+ echo >> $logfile.short
+ echo "Last 20 lines of verbose log follow" >> $logfile.short \
+ echo >> $logfile.short
+ tail -20 $logfile.verbose >> $logfile.short
+ )
+done
+
+#-----------------------------------------------------------------------=
-----
+# Prepare results and send
+#-----------------------------------------------------------------------=
-----
+
+# 'final' shows the difference between the old and new results
+echo > final
+echo "Nightly build on" $ABT_MACHINE "(" $ABT_DETAILS ")" \
+ "started at" $ABT_START >> final
+
+# Always show the current results.
+cat new.short >> final
+
+# If the results differ from 24 hours ago, print extra stuff.
+diff -C1 old.short new.short > diff.short
+
+if [ $? !=3D 0 ] ; then
+ echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D" >> final
+ echo "=3D=3D Results from 24 hours ago =3D=3D" >> f=
inal
+ echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D" >> final
+ cat old.short >> final
+
+ echo >> final
+ echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D" >> final
+ echo "=3D=3D Difference between 24 hours ago and now =3D=3D" >> f=
inal
+ echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D" >> final
+ echo >> final
+ cat diff.short >> final
+ echo >> final
+fi
+
+# Email the results
+$ABT_TOP/conf/$ABT_MACHINE.sendmail \
+ "$ABT_START nightly build ($ABT_MACHINE, $ABT_DETAILS)" \
+ $ABT_TOP/final
|