mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 01:01:27 +00:00
Added to repository.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@755 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
44
nightly/README.txt
Normal file
44
nightly/README.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
This directory (nightly/) contains a simple, automatic build-and-test
|
||||
system for SCST, intended to be run by cron.
|
||||
|
||||
Note (importantly) it doesn't test the sources in the tree of which
|
||||
this directory is a part (viz, nightly/..). Instead it checks out
|
||||
a complete new tree, builds and tests that independently of the
|
||||
existing tree.
|
||||
|
||||
To use, choose a tag, probably a machine name, and run
|
||||
|
||||
bin/nightly <tag>
|
||||
|
||||
and supply the following two config files:
|
||||
|
||||
- conf/<tag>.conf: this is sourced by the 'nightly' script, and can define
|
||||
any or all of the following environment variables:
|
||||
|
||||
ABT_DETAILS: describes the machine in more detail, eg. the OS. The default
|
||||
is empty.
|
||||
ABT_EVAL: if provided, it must be the name of a shell script that executes
|
||||
the shell command $1 with arguments $2 .. ${$#}. Allows to compile and
|
||||
run the SCST regression tests on another system than the system the
|
||||
'nightly' script runs on. It is assumed that the remote system shares the
|
||||
local filesystem tree through e.g. NFS. It is the responsibility of the
|
||||
shell script to set the remote working directory such that it matches the
|
||||
local current directory ($PWD).
|
||||
ABT_JOBS: allows parallel builds -- it's passed as the argument to "make
|
||||
-j" when building SCST and the tests. The default is 1.
|
||||
ABT_KERNELS: kernel version numbers to test SCST against.
|
||||
ABT_TMPDIR: absolute path in which temporary files will be stored.
|
||||
|
||||
- conf/<tag>.sendmail: this should be a script that sends an email to the
|
||||
desired recipient (eg. the scst-developers list). It takes three
|
||||
command line arguments. The first is the email subject line, the second
|
||||
is the name of the file containing the email's body (showing the tests
|
||||
that failed, and the difference between now and 24 hours ago), the third
|
||||
is the name of the file containing all the diffs (which can be made into
|
||||
an attachment, for example).
|
||||
|
||||
CREDITS
|
||||
|
||||
The automatic build-and-test infrastructure for the SCST project reuses some
|
||||
ideas and shell script code from a similar infrastructure in the Valgrind project.
|
||||
159
nightly/bin/nightly
Executable file
159
nightly/bin/nightly
Executable file
@@ -0,0 +1,159 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Automated build and test for SCST. Compares SCST build from 24 hours
|
||||
# ago with the current one. See the README.txt on how to run it.
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Helper function
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
runcmd () {
|
||||
logfile="$1"
|
||||
str="$2"
|
||||
shift 2
|
||||
|
||||
# Header in short logfile
|
||||
printf "%-30s ..." "$str" >> ${logfile}.short
|
||||
|
||||
# Header and command in verbose logfile
|
||||
{ printf "%-30s ... " "$str"; echo "$*"; } >> ${logfile}.verbose
|
||||
|
||||
# Run the command
|
||||
("${ABT_EVAL}" "$*") >> ${logfile}.verbose 2>&1
|
||||
res=$?
|
||||
|
||||
# Write result to the short logfile
|
||||
if [ $res = 0 ]
|
||||
then
|
||||
echo "done" >> ${logfile}.short
|
||||
else
|
||||
echo "failed" >> ${logfile}.short
|
||||
fi
|
||||
|
||||
return $res
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Startup
|
||||
#----------------------------------------------------------------------------
|
||||
# Must have exactly one argument
|
||||
if [ "$#" -ne 1 ] ; then
|
||||
echo "usage: $0 <tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get args from command line
|
||||
if [ "${arg0#/}" = "${arg0}" ]; then
|
||||
scriptpath=`dirname $PWD/$0`
|
||||
else
|
||||
scriptpath=`dirname $0`
|
||||
fi
|
||||
ABT_TOP=`dirname ${scriptpath}`
|
||||
ABT_MACHINE="$1"
|
||||
|
||||
# Get times and date
|
||||
ABT_START=`date "+%F %H:%M:%S %Z"`
|
||||
|
||||
svn_old_date=`date --date=yesterday +%Y-%m-%dT%H:%M:%S`
|
||||
svn_new_date=`date --date=today +%Y-%m-%dT%H:%M:%S`
|
||||
|
||||
cd $ABT_TOP
|
||||
|
||||
# Setup any relevant environment variables from conf/<tag>.conf.
|
||||
. conf/$ABT_MACHINE.conf
|
||||
if [ "${ABT_JOBS}" = "" ]; then
|
||||
ABT_JOBS=1
|
||||
fi
|
||||
if [ "${ABT_EVAL}" = "" ]; then
|
||||
ABT_EVAL="eval"
|
||||
fi
|
||||
if [ "${ABT_TMPDIR}" = "" ]; then
|
||||
ABT_TMPDIR="/tmp/scst-$$"
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Check out, build, test
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Do everything twice -- once for the 24 hours old SCST, and once
|
||||
# for the current one.
|
||||
for logfile in old new ; do
|
||||
|
||||
# Remove the old scst directory.
|
||||
rm -rf "${ABT_TMPDIR}"
|
||||
mkdir -p "${ABT_TMPDIR}/scst"
|
||||
|
||||
# Remove old short and verbose log files, and start the new ones.
|
||||
for ext in short verbose ; do
|
||||
echo > ${logfile}.$ext
|
||||
done
|
||||
|
||||
# Choose the current SCST, or one from 24 hours ago.
|
||||
if [ ${logfile} = "old" ] ; then
|
||||
svn_date="$svn_old_date"
|
||||
else
|
||||
svn_date="$svn_new_date"
|
||||
fi
|
||||
|
||||
# Check out and run the tests.
|
||||
runcmd ${logfile} \
|
||||
"Checking out SCST source tree" \
|
||||
"svn co -q -r {${svn_date}} https://scst.svn.sourceforge.net/svnroot/scst/trunk ${ABT_TMPDIR}/scst" && \
|
||||
echo "Checked out SCST revision `svn info ${ABT_TMPDIR}/scst | grep Revision: | sed 's/.* //'`" &&\
|
||||
runcmd ${logfile} \
|
||||
"Running regression tests" \
|
||||
"cd ${ABT_TMPDIR}/scst && scripts/run-regression-tests -d ${ABT_TMPDIR}/regtest -j ${ABT_JOBS} ${ABT_KERNELS}"
|
||||
runcmd ${logfile} \
|
||||
"Cleaning up" \
|
||||
"rm -rf ${ABT_TMPDIR}"
|
||||
|
||||
cat ${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
|
||||
|
||||
# If the results differ from 24 hours ago, print extra stuff.
|
||||
diff -C1 old.short new.short > diff.short
|
||||
changed=$?
|
||||
|
||||
if [ $changed != 0 ] ; then
|
||||
echo "Results differ from 24 hours ago" >> final
|
||||
changed_str=""
|
||||
else
|
||||
echo "Results unchanged from 24 hours ago" >> final
|
||||
changed_str="(unchanged) "
|
||||
fi
|
||||
|
||||
# Always show the current results.
|
||||
cat new.short >> final
|
||||
|
||||
if [ $changed != 0 ] ; then
|
||||
echo "=================================================" >> final
|
||||
echo "== Results from 24 hours ago ==" >> final
|
||||
echo "=================================================" >> final
|
||||
cat old.short >> final
|
||||
|
||||
echo >> final
|
||||
echo "=================================================" >> final
|
||||
echo "== Difference between 24 hours ago and now ==" >> final
|
||||
echo "=================================================" >> final
|
||||
echo >> final
|
||||
cat diff.short >> final
|
||||
echo >> final
|
||||
fi
|
||||
|
||||
# Use the conf/<tag>.sendmail script to email the results.
|
||||
conf/$ABT_MACHINE.sendmail \
|
||||
"$changed_str$ABT_START nightly build ($ABT_MACHINE, $ABT_DETAILS)" \
|
||||
final > sendmail.log 2>&1
|
||||
6
nightly/conf/pcbart.conf
Normal file
6
nightly/conf/pcbart.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
# Specifics for Bart Van Assche's PC.
|
||||
|
||||
ABT_DETAILS="PC Bart, x86_64, openSUSE 11.1"
|
||||
ABT_JOBS=3
|
||||
ABT_KERNELS="2.6.23.17 2.6.29.1"
|
||||
14
nightly/conf/pcbart.sendmail
Executable file
14
nightly/conf/pcbart.sendmail
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# usage: $0 subject file-to-mail [file-to-attach]
|
||||
# Don't forget to set the variables 'from' and 'realname' in ~/.muttrc !!
|
||||
|
||||
recipients="scst-devel@lists.sourceforge.net"
|
||||
#recipients="bart.vanassche@gmail.com,bart"
|
||||
if [ $# -ge 3 ]; then
|
||||
gzip -9 <"$3" >"$3.gz"
|
||||
mutt -s "$1" -a "$3.gz" ${recipients} < "$2"
|
||||
rm -f "$3.gz"
|
||||
else
|
||||
mutt -s "$1" ${recipients} < "$2"
|
||||
fi
|
||||
Reference in New Issue
Block a user