77 lines (65 with data), 3.1 kB
#!/bin/bash
# this script shouldn't be run more than once at any given time
# so we write a file to indicate that it's already running
# and remove it when we are done
lockfile -r 0 /tmp/lurchtestscript.lock || exit;
# DEBUG:
#if ! lockfile -r 0 /tmp/lurchtestscript.lock; then
# subjline="[Lurch Tests] - Testing Script Already Running"
# echo "Error: the testing script is already running. ("`date`")" | /usr/bin/nail -r lurch-devel@scranton.edu -s "$subjline" -S smtp=royalpo.scranton.edu -S replyto=lurch-devel@lists.sourceforge.net ken.monks@gmail.com ncarter@bentley.edu
# rm -f /tmp/lurchtestscript.lock
# exit
#fi;
# we should delete it before exiting
function depart {
rm -f /tmp/lurchtestscript.lock
exit
}
# if the script is called with "clean" as the only argument
# we will erase the whole local copy of the repository and
# start from scratch. That could take up to three hours to run.
# Note that it will do it even if the current version matches the repo.
cd /home/lurch
if [ "$1" = "clean" ]; then
rm -rf Lurch
rm -rf .svn
fi
# check if svn is playing nice today
if ! svn info https://lurch.svn.sourceforge.net/svnroot/lurch >> /dev/null ; then
subjline="[Lurch Tests] - sourceforge not available"
echo "Error: svn at sourceforge is currently inaccessible. ("`date`")" | /usr/bin/nail -r lurch-devel@scranton.edu -s "$subjline" -S smtp=royalpo.scranton.edu -S replyto=lurch-devel@lists.sourceforge.net ken.monks@gmail.com ncarter@bentley.edu
depart
fi
# check if the current revision is the same as the repository
if [ -d Lurch ]; then
cd /home/lurch/Lurch
thisrev=`svn info | grep ^Revision`
thatrev=`svn info https://lurch.svn.sourceforge.net/svnroot/lurch | grep ^Revision`
if [ "$thisrev" = "$thatrev" ]; then
# DEBUG:
# subjline="[Lurch Tests] - $thisrev - Taking a break!"
# echo "All lurch files are up to date. Nothing new to test." | /usr/bin/nail -r lurch-devel@scranton.edu -s "$subjline" -S smtp=royalpo.scranton.edu -S replyto=lurch-devel@lists.sourceforge.net ken.monks@gmail.com ncarter@bentley.edu
if [ "$1" != "force" ]; then
depart
fi
fi
cd /home/lurch
fi
# not the same... so we start over
rm -rf testlurch.txt
rm -rf .last_results.txt
rm -rf .last_errors.txt
echo `date` > testlurch.txt
svn log -r${thatrev:10} >> testlurch.txt
/home/lurch/scripts/testlurch -l /home/lurch/ -srtq >> testlurch.txt 2>&1
wait
if [ -s testlurch.txt ]; then
subjline="[Lurch Tests] - $thatrev "`tail -1 testlurch.txt`
echo `date` >> testlurch.txt
grep -vE "^[[:space:]]*A[[:space:]]*Lurch" < testlurch.txt | \
/usr/bin/nail -r lurch-devel@scranton.edu -s "$subjline" -S smtp=royalpo.scranton.edu -S replyto=lurch-devel@lists.sourceforge.net ken.monks@gmail.com ncarter@bentley.edu
else
subjline="[Lurch Tests] - testlurch produced no output"
echo "Error: testlurch did not produce any output. I'm not sure why. "`date` | /usr/bin/nail -r lurch-devel@scranton.edu -s "$subjline" -S smtp=royalpo.scranton.edu -S replyto=lurch-devel@lists.sourceforge.net ken.monks@gmail.com ncarter@bentley.edu
fi
depart