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 |
# Which tests should we run? |
17 |
# currently disabled during testing. |
target='run_tests' # Default scons target that runs the tests |
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" |
test "x$1" != "x" && target="$1" |
19 |
MAIL_RECIPIENTS="elspeth@esscc.uq.edu.au" |
requested_cpus=2 |
20 |
|
test "x$target" = "xall_tests" && requested_cpus=4 |
21 |
# the python tests to run |
|
22 |
BRUCE_PYTESTS="ImportTest.passed BruceTest.passed test_utilOnBruce.py" |
# MAIL_RECIPIENTS="l.gross@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" |
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="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" |
|
25 |
|
RunDate=`date '+%Y_%m_%d'` # Time stamp for log file names |
26 |
# Changed slightly to cope with new script, so it doesn't stomp all over previous iterations |
|
27 |
|
WorkDir=/raid3/ksteube/AutoTests |
28 |
echo "===> cd $1" |
cd $WorkDir |
29 |
cd $1 |
|
30 |
if [ $? != 0 ] |
# Where to put the output of scons run_tests |
31 |
then |
out_file="$WorkDir/Logs/$RunDate.test.output" |
32 |
echo "couldnt cd $1" |
|
33 |
echo "couldnt cd $1" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
# Save the name of this script |
34 |
exit 1 |
SCRIPT_NAME=$0 |
35 |
fi |
|
36 |
|
# Below here \$variable means I want the variable interpreted when PBS runs the job, not when the job is submitted |
37 |
# this is for the automated script |
# Similarly for \`...\` |
38 |
echo "===> change up a directory" |
|
39 |
cd .. |
# Write the PBS script to run the tests |
40 |
echo "===> make a sandbox and work in that" |
cat << EOF > Logs/$RunDate.pbs.script.sh |
41 |
mkdir sandbox |
#!/bin/bash |
42 |
cd sandbox |
|
43 |
|
#PBS -q q1 |
44 |
PWD=`pwd` |
#PBS -N autotest |
45 |
echo "===> working in: $PWD" |
#PBS -l ncpus=$requested_cpus |
46 |
|
#PBS -o $RunDate.pbs.stdout |
47 |
# Setup the environment |
#PBS -e $RunDate.pbs.stderr |
48 |
echo "loading modules" |
#PBS -W umask=022 |
49 |
. ${MODULESHOME}/init/sh |
|
50 |
module load intel_cc.9.0.026 |
echo "PBS_JOBNAME \$PBS_JOBNAME" |
51 |
export MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6 |
echo "PBS_JOBID \$PBS_JOBID" |
52 |
module load python/2.4.1 |
echo "PBS_QUEUE \$PBS_QUEUE" |
53 |
|
echo "NCPUS \$NCPUS" |
54 |
|
echo "USER \$USER" |
55 |
|
echo "PBS_O_HOST \$PBS_O_HOST" |
56 |
|
echo "PBS_O_WORKDIR \$PBS_O_WORKDIR" |
57 |
|
echo "PBS_O_SHELL \$PBS_O_SHELL" |
58 |
|
date |
59 |
|
echo "" |
60 |
|
echo "" |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
START=\`date '+%Y/%m/%d %H:%M'\` |
65 |
|
|
66 |
|
finish () { |
67 |
|
date |
68 |
|
# Clean up the sandbox |
69 |
|
cd $WorkDir |
70 |
|
/bin/rm -rf sandbox.$RunDate |
71 |
|
END=\`date '+%Y/%m/%d %H:%M'\` |
72 |
|
cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS |
73 |
|
\$2. |
74 |
|
The tests ran from \$START to \$END on \$NCPUS CPUs |
75 |
|
See the log files in $WorkDir/Logs/$RunDate* |
76 |
|
This mail was sent by $SCRIPT_NAME |
77 |
|
running as \$USER on \`hostname\`. |
78 |
|
END_MSG |
79 |
|
test "x\$1" = "FAILURE" && exit 1 |
80 |
|
exit 0 |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
cd $WorkDir || finish FAILURE "Could not cd to WorkDir $WorkDir" |
85 |
|
|
86 |
|
# Create an empty out_file |
87 |
|
cat /dev/null > $out_file || finish FAILURE "Could not create out_file $out_file" |
88 |
|
|
89 |
|
umask 022 |
90 |
|
|
91 |
|
test -d sandbox.$RunDate && finish FAILURE "Today's sandbox already exists" |
92 |
|
mkdir sandbox.$RunDate || finish FAILURE "Could not mkdir sandbox" |
93 |
|
cd sandbox.$RunDate || finish FAILURE "Could not cd to sandbox" |
94 |
|
|
95 |
|
echo "Checking out esys13/trunk" |
96 |
|
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" |
97 |
|
|
98 |
|
# Load modules |
99 |
|
. /opt/modules/default/init/bash |
100 |
|
module use /raid2/matt/modules/modulefiles |
101 |
|
module use /raid2/toolspp4/modulefiles/gcc-3.3.6 |
102 |
|
module use /usr/share/modules/modulefiles |
103 |
|
module load esys/env # Recommended modules |
104 |
|
module load doxygen/1.4.6 |
105 |
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 |
|
106 |
|
|
107 |
# set openmp settings |
# How many threads? One per CPU. |
108 |
export OMP_NUM_THREADS=4 |
export OMP_NUM_THREADS=\$NCPUS |
109 |
|
|
110 |
|
# Run the tests |
111 |
|
echo "Running the tests $target" |
112 |
|
cd trunk || finish FAILURE "Could not cd to trunk" |
113 |
|
scons -j \$NCPUS $target >> $out_file 2>&1 || finish FAILURE "Could not run scons $target" |
114 |
|
|
115 |
|
echo "Cleaning up after the tests" |
116 |
|
|
117 |
|
# Delete files older than 21 days |
118 |
|
find $WorkDir -atime +21 -exec rm -f {} \; |
119 |
|
|
120 |
|
finish SUCCESS "Successfully ran 'scons $target' on \`hostname\`" |
121 |
|
|
122 |
|
EOF |
123 |
|
|
124 |
|
# cd to the logs area so the PBS logs are deposited there |
125 |
|
cd $WorkDir/Logs |
126 |
|
|
127 |
|
# Submit the job |
128 |
|
. /opt/modules/default/init/sh |
129 |
|
module load pbspro |
130 |
|
qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null |
131 |
|
|
|
# doesn't appear to work - don't know why. |
|
|
#echo "===> 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 |
|
|
|
|
|
# Need to test this bit yet. |
|
|
echo "==> removing previous checkout" |
|
|
rm -rf trunk/ |
|
|
ls |
|
|
# This works - temporarily removed to speed up testing. |
|
|
echo "==> svn checkout" |
|
|
svn checkout svn+ssh://ess/esys13/trunk |
|
|
if [ $? != 0 ] |
|
|
then |
|
|
echo "svn checkout failed" |
|
|
echo "svn checkout failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS |
|
|
exit 2 |
|
|
fi |
|
|
|
|
|
echo "==> change to trunk" |
|
|
ls trunk |
|
|
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 |
|