1 |
|
#!/bin/sh |
2 |
|
|
3 |
|
# |
4 |
|
# Submit a PBS job to run the tests |
5 |
|
# |
6 |
|
# Usage: autotest-scons # Short testing, only C++ tests |
7 |
|
# Usage: autotest-scons run_tests # Short testing, only C++ tests |
8 |
|
# Usage: autotest-scons all_tests # Long testing, C++ and python tests |
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 |
|
# |
15 |
|
|
16 |
|
# Which tests should we run? |
17 |
|
target='run_tests' # Default scons target that runs the tests |
18 |
|
test "x$1" != "x" && target="$1" |
19 |
|
requested_cpus=2 |
20 |
|
test "x$target" = "xall_tests" && requested_cpus=4 |
21 |
|
|
22 |
|
MAIL_RECIPIENTS="l.gross@uq.edu.au matt@esscc.uq.edu.au robert.woodcock@csiro.au Peter.Hornby@csiro.au k.steube@uq.edu.au" |
23 |
|
# MAIL_RECIPIENTS="k.steube@uq.edu.au" |
24 |
|
|
25 |
|
# This time is when the job was submitted. If it waits in the queue it might run on another day. |
26 |
|
# This date is also used to create the sandbox directory where the tests are run. |
27 |
|
RunDate=`date '+%Y_%m_%d'` # Time stamp for log file names |
28 |
|
|
29 |
|
WorkDir=/raid3/ksteube/AutoTests |
30 |
|
cd $WorkDir |
31 |
|
|
32 |
|
# Where to put the output of scons run_tests |
33 |
|
out_file="$WorkDir/Logs/$RunDate.test.output" |
34 |
|
|
35 |
|
# Save the name of this script |
36 |
|
SCRIPT_NAME=$0 |
37 |
|
|
38 |
|
# Below here \$variable means I want the variable interpreted when PBS runs the job, not when the job is submitted |
39 |
|
# Similarly for \`...\` |
40 |
|
|
41 |
|
# Write the PBS script to run the tests |
42 |
|
cat << EOF > Logs/$RunDate.pbs.script.sh |
43 |
#!/bin/bash |
#!/bin/bash |
44 |
|
|
45 |
# $Id: autotest-scons 162 2005-11-11 00:09:59Z svn $ |
#PBS -q q80 |
46 |
# An explicit testing script for esys using the scons build system |
#PBS -N autotest |
47 |
|
#PBS -l ncpus=$requested_cpus |
48 |
|
#PBS -o $RunDate.pbs.stdout |
49 |
|
#PBS -e $RunDate.pbs.stderr |
50 |
|
#PBS -W umask=022 |
51 |
|
|
52 |
|
echo "PBS_JOBNAME \$PBS_JOBNAME" |
53 |
|
echo "PBS_JOBID \$PBS_JOBID" |
54 |
|
echo "PBS_QUEUE \$PBS_QUEUE" |
55 |
|
echo "NCPUS \$NCPUS" |
56 |
|
echo "USER \$USER" |
57 |
|
echo "PBS_O_HOST \$PBS_O_HOST" |
58 |
|
echo "PBS_O_WORKDIR \$PBS_O_WORKDIR" |
59 |
|
echo "PBS_O_SHELL \$PBS_O_SHELL" |
60 |
|
date |
61 |
|
echo "" |
62 |
|
echo "" |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
START=\`date '+%Y/%m/%d %H:%M'\` |
67 |
|
|
68 |
|
finish () { |
69 |
|
# state will be 'FAILURE' or 'SUCCESS' |
70 |
|
state="\$1" |
71 |
|
date |
72 |
|
# Clean up the sandbox |
73 |
|
cd $WorkDir |
74 |
|
/bin/rm -rf sandbox.$RunDate |
75 |
|
END=\`date '+%Y/%m/%d %H:%M'\` |
76 |
|
cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$state" $MAIL_RECIPIENTS |
77 |
|
\$2. |
78 |
|
The tests ran from \$START to \$END on \$NCPUS CPUs |
79 |
|
See the log files in $WorkDir/Logs/$RunDate* |
80 |
|
This mail was sent by $SCRIPT_NAME |
81 |
|
running as \$USER on \`hostname\`. |
82 |
|
END_MSG |
83 |
|
if [ "x\$state" = "xFAILURE" ]; then |
84 |
|
touch Logs/$RunDate.FAILURE |
85 |
|
exit 1 |
86 |
|
fi |
87 |
|
exit 0 |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
# set -x |
92 |
|
|
93 |
|
|
94 |
|
cd $WorkDir || finish FAILURE "Could not cd to WorkDir $WorkDir" |
95 |
|
|
96 |
|
# Create an empty out_file |
97 |
|
cat /dev/null > $out_file || finish FAILURE "Could not create out_file $out_file" |
98 |
|
|
99 |
|
umask 022 |
100 |
|
|
101 |
|
test -d sandbox.$RunDate && finish FAILURE "Today's sandbox already exists" |
102 |
|
mkdir sandbox.$RunDate || finish FAILURE "Could not mkdir sandbox" |
103 |
|
cd sandbox.$RunDate || finish FAILURE "Could not cd to sandbox" |
104 |
|
|
105 |
|
echo "Checking out esys13/trunk" |
106 |
|
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" |
107 |
|
|
108 |
|
# Load modules |
109 |
|
. /opt/modules/default/init/bash |
110 |
|
module use /raid2/matt/modules/modulefiles |
111 |
|
module use /raid2/toolspp4/modulefiles/gcc-3.3.6 |
112 |
|
module use /usr/share/modules/modulefiles |
113 |
|
module load esys/env # Recommended modules |
114 |
|
module load doxygen/1.4.6 |
115 |
|
module load boost/1.33.0/python-2.4.1 |
116 |
|
module load gmsh-1.65.0 |
117 |
|
module load epydoc/2.1/python-2.4.3 |
118 |
|
|
119 |
|
# How many threads? One per CPU. |
120 |
|
export OMP_NUM_THREADS=\$NCPUS |
121 |
|
|
122 |
|
# Run the tests |
123 |
|
echo "Running the tests $target" |
124 |
|
cd trunk || finish FAILURE "Could not cd to trunk" |
125 |
|
scons -j \$NCPUS $target >> $out_file 2>&1 || finish FAILURE "Could not run scons $target" |
126 |
|
|
127 |
|
# Run epydoc to create the python documentation |
128 |
|
echo "Running epydoc" |
129 |
|
export LD_LIBRARY_PATH="$PWD/lib:$LD_LIBRARY_PATH" |
130 |
|
mkdir release release/doc release/doc/epydoc |
131 |
|
scons api_epydoc >> $out_file 2>&1 || finish FAILURE "Could not run scons api_epydoc" |
132 |
|
cd release/doc/epydoc |
133 |
|
tar cf - . | ssh shake200 "cd /home/www/esys/esys13/nightly/epydoc; tar xf -" || finish FAILURE "Could not copy epydoc to shake200" |
134 |
|
cd ../../.. |
135 |
|
|
136 |
|
echo "Cleaning up after the tests" |
137 |
|
|
138 |
|
# Delete files older than 60 days |
139 |
|
find $WorkDir -atime +60 -exec rm -f {} \; |
140 |
|
|
141 |
|
finish SUCCESS "Successfully ran 'scons $target' on \`hostname\`" |
142 |
|
|
143 |
|
EOF |
144 |
|
|
145 |
|
# cd to the logs area so the PBS logs are deposited there |
146 |
|
cd $WorkDir/Logs |
147 |
|
|
148 |
|
# Submit the job |
149 |
|
. /opt/modules/default/init/sh |
150 |
|
module load pbspro |
151 |
|
|
152 |
|
# Submit the job |
153 |
|
qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null |
154 |
|
|
|
# list of users to email test results to |
|
|
MAIL_RECIPIENTS="jgs@esscc.uq.edu.au gross@esscc.uq.edu.au cochrane@esscc.uq.edu.au elspeth@esscc.uq.edu.au matt@esscc.uq.edu.au" |
|
|
#MAIL_RECIPIENTS="jgs@esscc.uq.edu.au" |
|
|
|
|
|
# modules to test |
|
|
TESTS="escript bruce finley" |
|
|
|
|
|
# the python tests to run |
|
|
FINLEY_PYTESTS="ImportTest.py finleyTest.py SimpleSolve.py GradTest.py RecTest.py test_linearPDEsOnFinley.py test_generators.py test_visualization_interface.py test_utilOnFinley.py test_symbolsOnFinley.py" |
|
|
ESCRIPT_PYTESTS="ImportTest.py BinaryOps.py UnaryOps.py SliceGetting.py SliceSetting.py MiscTests.py ArchiveTests.py escriptTest.py newEscriptTests.py DataVariableTests.py test_xml.py" |
|
|
BRUCE_PYTESTS="ImportTest.py BruceTest.py test_utilOnBruce.py test_symbolsOnBruce.py" |
|
|
|
|
|
echo cd $1 |
|
|
cd $1 |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo couldnt cd $1 |
|
|
echo "couldnt cd $1" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
PWD=`pwd` |
|
|
echo working in: $PWD |
|
|
|
|
|
# define compiler executable and library locations |
|
|
export PATH=/opt/intel/cmplrs/80.058/intel_cc_80/bin:$PATH |
|
|
export LD_LIBRARY_PATH=/opt/intel/cmplrs/80.058/intel_cc_80/lib |
|
|
|
|
|
# define python location |
|
|
export PATH=/raid2/tools/python-2.3.4/bin:$PATH |
|
|
|
|
|
# set library and openmp settings |
|
|
export LD_LIBRARY_PATH=$PWD/lib:/raid2/tools/boost/lib:$LD_LIBRARY_PATH |
|
|
export PYTHONPATH=$PWD |
|
|
export OMP_SCHEDULE="dynamic" |
|
|
export OMP_NUM_THREADS=4 |
|
|
export OMP_DYNAMIC=TRUE |
|
|
export OMP_NESTED=FALSE |
|
|
|
|
|
FAIL=0 |
|
|
|
|
|
echo running svn update |
|
|
svn update |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo svn update failed |
|
|
echo "svn update failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 2 |
|
|
fi |
|
|
|
|
|
echo running scons debug=1 |
|
|
scons debug=1 |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo scons failed |
|
|
echo "scons failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 3 |
|
|
fi |
|
|
|
|
|
echo running bruce unit_tests |
|
|
cd bruce/test |
|
|
./unit_test-scons |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo bruce unit_test failed |
|
|
echo "bruce unit_test failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
cd ../.. |
|
|
|
|
|
echo running escript unit_tests |
|
|
cd escript/test |
|
|
./unit_test-scons |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo escript unit_test failed |
|
|
echo "escript unit_test failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
cd ../.. |
|
|
|
|
|
echo running finley unit_tests |
|
|
cd finley/test |
|
|
./unit_test-scons |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo finley unit_test failed |
|
|
echo "finley unit_test failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
cd ../.. |
|
|
|
|
|
echo running esysUtils unit_tests |
|
|
cd esysUtils/test |
|
|
./unit_test-scons |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo esysUtils unit_test failed |
|
|
echo "esysUtils unit_test failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
cd ../.. |
|
|
|
|
|
for module in $TESTS |
|
|
do |
|
|
echo "running python tests for: $module" |
|
|
cd $module/test/python |
|
|
if [ "$module" == "finley" ] |
|
|
then |
|
|
for pytest in $FINLEY_PYTESTS |
|
|
do |
|
|
echo "Running python test: $pytest" |
|
|
python $pytest |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo Python Testing FAILED for $pytest in module $module |
|
|
echo "finley py_test: $pytest failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
done |
|
|
elif [ "$module" == "escript" ] |
|
|
then |
|
|
for pytest in $ESCRIPT_PYTESTS |
|
|
do |
|
|
echo "Running python test: $pytest" |
|
|
python $pytest |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo Python Testing FAILED for $pytest in module $module |
|
|
echo "escript py_test: $pytest failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
done |
|
|
elif [ "$module" == "bruce" ] |
|
|
then |
|
|
for pytest in $BRUCE_PYTESTS |
|
|
do |
|
|
echo "Running python test: $pytest" |
|
|
python $pytest |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo Python Testing FAILED for $pytest in module $module |
|
|
echo "bruce py_test: $pytest failed - see autotest-scons logfile" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
FAIL=1 |
|
|
fi |
|
|
done |
|
|
fi |
|
|
cd ../../.. |
|
|
done |
|
|
|
|
|
if [ $FAIL == 0 ] |
|
|
then |
|
|
echo success |
|
|
echo "success" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
fi |
|
|
exit 0 |
|