1 |
#!/bin/bash |
#!/bin/sh |
2 |
# Copyright 2006 by ACcESS MNRF |
|
3 |
|
# |
4 |
|
# Submit a PBS job to run the tests |
5 |
# |
# |
6 |
# http://www.access.edu.au |
# Usage: autotest-scons # Short testing, only C++ tests |
7 |
# Primary Business: Queensland, Australia |
# Usage: autotest-scons run_tests # Short testing, only C++ tests |
8 |
# Licensed under the Open Software License version 3.0 |
# Usage: autotest-scons all_tests # Long testing, C++ and python tests |
|
# http://www.opensource.org/licenses/osl-3.0.php |
|
9 |
# |
# |
10 |
|
# Copy this somewhere and run it every day via cron |
11 |
# |
# |
12 |
|
# This file should be maintained in SVN as esys13/trunk/autotest-scons, |
13 |
|
# be sure to copy it there and commit after modification |
14 |
# |
# |
|
# $Id: autotest-scons 162 2005-11-11 00:09:59Z svn $ |
|
|
# An explicit testing script for esys using the scons build system |
|
15 |
|
|
16 |
# list of users to email test results to |
# TODO: should try using the entire node: scons -j $NCPUS all_tests |
17 |
# currently disabled during testing. |
# I've been told this produces poor results...why? |
18 |
# MAIL_RECIPIENTS="gross@esscc.uq.edu.au elspeth@esscc.uq.edu.au matt@esscc.uq.edu.au robert.woodcock@csiro.au Peter.Hornby@csiro.au" |
|
19 |
MAIL_RECIPIENTS="elspeth@esscc.uq.edu.au" |
# Which tests should we run? |
20 |
|
target='run_tests' # Default scons target that runs the tests |
21 |
# the python tests to run |
test "x$1" != "x" && target="$1" |
22 |
BRUCE_PYTESTS="ImportTest.passed BruceTest.passed test_utilOnBruce.py" |
|
23 |
ESCRIPT_PYTESTS="ImportTest.passed BinaryOps.passed UnaryOps.passed SliceGetting.passed SliceSetting.passed MiscTests.passed ArchiveTests.passed newEscriptTests.passed test_xml.passed insituTests.passed s2.passed" |
MAIL_RECIPIENTS="gross@esscc.uq.edu.au elspeth@esscc.uq.edu.au matt@esscc.uq.edu.au robert.woodcock@csiro.au Peter.Hornby@csiro.au k.steube@uq.edu.au" |
24 |
FINLEY_PYTESTS="ImportTest.passed finleyTest.passed SimpleSolve.passed RecTest.passed test_linearPDEsOnFinley.passed test_generators.passed test_visualization_interface.passed test_utilOnFinley.passed" |
# MAIL_RECIPIENTS="k.steube@uq.edu.au" |
25 |
|
|
26 |
# Changed slightly to cope with new script, so it doesn't stomp all over previous iterations |
RunDate=`date '+%Y_%m_%d'` # Time stamp for log file names |
27 |
|
|
28 |
echo "===> cd $1" |
WorkDir=/raid3/ksteube/AutoTests |
29 |
cd $1 |
cd $WorkDir |
30 |
if [ $? != 0 ] |
|
31 |
then |
# Where to put the output of scons run_tests |
32 |
echo "couldnt cd $1" |
out_file="$WorkDir/Logs/$RunDate.test.output" |
33 |
echo "couldnt cd $1" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
34 |
exit 1 |
# Save the name of this script |
35 |
fi |
SCRIPT_NAME=$0 |
36 |
|
|
37 |
# this is for the automated script |
# Below here \$variable means I want the variable interpreted when PBS runs the job, not when the job is submitted |
38 |
echo "===> change up a directory" |
# Similarly for \`...\` |
39 |
cd .. |
|
40 |
echo "===> make a sandbox and work in that" |
# Write the PBS script to run the tests |
41 |
mkdir sandbox |
cat << EOF > Logs/$RunDate.pbs.script.sh |
42 |
cd sandbox |
#!/bin/bash |
43 |
|
|
44 |
PWD=`pwd` |
#PBS -q q1 |
45 |
echo "===> working in: $PWD" |
#PBS -l ncpus=2 |
46 |
|
#PBS -o $RunDate.pbs.stdout |
47 |
# Setup the environment |
#PBS -e $RunDate.pbs.stderr |
48 |
echo "loading modules" |
|
49 |
. ${MODULESHOME}/init/sh |
echo "PBS_JOBNAME \$PBS_JOBNAME" |
50 |
module load intel_cc.9.0.026 |
echo "PBS_JOBID \$PBS_JOBID" |
51 |
export MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6 |
echo "PBS_QUEUE \$PBS_QUEUE" |
52 |
module load python/2.4.1 |
echo "NCPUS \$NCPUS" |
53 |
|
echo "USER \$USER" |
54 |
|
echo "PBS_O_HOST \$PBS_O_HOST" |
55 |
|
echo "PBS_O_WORKDIR \$PBS_O_WORKDIR" |
56 |
|
echo "PBS_O_SHELL \$PBS_O_SHELL" |
57 |
|
echo "" |
58 |
|
echo "" |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
START=\`date '+%Y/%m/%d %H:%M'\` |
63 |
|
|
64 |
|
finish () { |
65 |
|
END=\`date '+%Y/%m/%d %H:%M'\` |
66 |
|
cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS |
67 |
|
\$2. |
68 |
|
The tests ran from \$START to \$END. |
69 |
|
See the log files in $WorkDir/Logs for more information. |
70 |
|
This mail was sent by $SCRIPT_NAME |
71 |
|
running as \$USER on \`hostname\`. |
72 |
|
END_MSG |
73 |
|
test "x$1" = "FAIL" && exit 1 |
74 |
|
exit 0 |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
cd $WorkDir || finish FAILURE "Could not cd to WorkDir $WorkDir" |
79 |
|
|
80 |
|
# Create an empty out_file |
81 |
|
cat /dev/null > $out_file || finish FAILURE "Could not create out_file $out_file" |
82 |
|
|
83 |
|
umask 022 |
84 |
|
|
85 |
|
test -d sandbox.$RunDate && finish FAILURE "Today's sandbox already exists" |
86 |
|
mkdir sandbox.$RunDate || finish FAILURE "Could not mkdir sandbox" |
87 |
|
cd sandbox.$RunDate || finish FAILURE "Could not cd to sandbox" |
88 |
|
|
89 |
|
echo "Checking out esys13/trunk" |
90 |
|
svn checkout svn+ssh://shake200.esscc.uq.edu.au/home/www_svn/repos/esys13/trunk >> $out_file 2>&1 || finish FAILURE "Could not check out esys13/trunk" |
91 |
|
|
92 |
|
# Load modules |
93 |
|
. /opt/modules/default/init/bash |
94 |
|
module use /raid2/matt/modules/modulefiles |
95 |
|
module use /raid2/toolspp4/modulefiles/gcc-3.3.6 |
96 |
|
module use /usr/share/modules/modulefiles |
97 |
|
module load esys/env # Matt's recommended modules |
98 |
|
module load doxygen/1.4.6 |
99 |
|
# The next line is to avoid /raid3/ksteube/AutoTests/sandbox.2006_06_17/trunk/build/posix/bruce/test/bruce_UnitTest: error while loading shared libraries: libboost_python-mt-d.so.1.33.0: cannot open shared object file: No such file or directory |
100 |
module load boost/1.33.0/python-2.4.1 |
module load boost/1.33.0/python-2.4.1 |
|
module load numarray/1.3.3 |
|
101 |
|
|
|
# set openmp settings |
|
|
export OMP_NUM_THREADS=4 |
|
102 |
|
|
103 |
# doesn't appear to work - don't know why. |
# Had to request 2 CPUs, but only use one for the tests |
104 |
#echo "===> svn update" |
export OMP_NUM_THREADS=1 |
105 |
#svn update |
|
106 |
#if [ $? != 0 ] |
# Run the tests |
107 |
#then |
echo "Running the tests" |
108 |
# echo "svn update failed" |
cd trunk || finish FAILURE "Could not cd to trunk" |
109 |
# echo "svn update failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
scons $target >> $out_file 2>&1 || finish FAILURE "Could not run scons $target" |
110 |
# exit 2 |
|
111 |
#fi |
# Delete files older than 21 days |
112 |
|
find $WorkDir -atime +21 -exec rm -f {} \; |
113 |
# Need to test this bit yet. |
|
114 |
echo "==> removing previous checkout" |
# Clean up the sandbox |
115 |
rm -rf trunk/ |
cd $WorkDir || finish FAILURE "Could not cd to clean up WorkDir $WorkDir" |
116 |
ls |
/bin/rm -rf sandbox.$RunDate || finish FAILURE "Could not delete sandbox" |
117 |
# This works - temporarily removed to speed up testing. |
|
118 |
echo "==> svn checkout" |
finish SUCCESS "Successfully ran 'scons $target', see Logs in $WorkDir on ess" |
119 |
svn checkout svn+ssh://ess/esys13/trunk |
|
120 |
if [ $? != 0 ] |
EOF |
121 |
then |
|
122 |
echo "svn checkout failed" |
# cd to the logs area so the PBS logs are deposited there |
123 |
echo "svn checkout failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
cd $WorkDir/Logs |
124 |
exit 2 |
|
125 |
fi |
# Submit the job |
126 |
|
. /opt/modules/default/init/sh |
127 |
echo "==> change to trunk" |
module load pbspro |
128 |
ls trunk |
qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null |
129 |
cd trunk |
|
|
|
|
|
# This bit works. Commented out to speed up testing. |
|
|
echo "===> scons building esys" |
|
|
scons |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo "scons build failed" |
|
|
echo "scons build failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 3 |
|
|
fi |
|
|
|
|
|
# This bit works. Commented out to speed up testing. |
|
|
echo "===> building unit_tests" |
|
|
scons build_all_tests |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo "build_tests failed" |
|
|
echo "build_tests failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 3 |
|
|
fi |
|
|
|
|
|
FAIL=0 |
|
|
|
|
|
#echo "===> running all tests" |
|
|
#scons all_tests |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo "all_tests failed" |
|
|
echo "all_tests failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 4 |
|
|
fi |
|