/[escript]/branches/cookbookdev/autotest-scons
ViewVC logotype

Diff of /branches/cookbookdev/autotest-scons

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 683 by robwdcock, Mon Mar 27 05:46:50 2006 UTC revision 937 by ksteube, Thu Jan 25 03:31:14 2007 UTC
# Line 1  Line 1 
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    
 # list of users to email test results to  
 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"  
64    
65  # the python tests to run  
66  BRUCE_PYTESTS="ImportTest.passed BruceTest.passed test_utilOnBruce.py"  START=\`date '+%Y/%m/%d %H:%M'\`
67  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"  
68  FINLEY_PYTESTS="ImportTest.passed finleyTest.passed SimpleSolve.passed RecTest.passed test_linearPDEsOnFinley.passed test_generators.passed test_visualization_interface.passed test_utilOnFinley.passed"  finish () {
69      date
70  echo "===> cd $1"    # Clean up the sandbox
71  cd $1    cd $WorkDir
72  if [ $? != 0 ]    /bin/rm -rf sandbox.$RunDate
73  then    END=\`date '+%Y/%m/%d %H:%M'\`
74    echo "couldnt cd $1"    cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS
75    echo "couldnt cd $1" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  \$2.
76    exit 1  The tests ran from \$START to \$END on \$NCPUS CPUs
77  fi  See the log files in $WorkDir/Logs/$RunDate*
78    This mail was sent by $SCRIPT_NAME
79  PWD=`pwd`  running as \$USER on \`hostname\`.
80  echo "===> working in: $PWD"  END_MSG
81      test "x\$1" = "FAILURE" && exit 1
82  # Setup the environment    exit 0
83  . ${MODULESHOME}/init/sh  }
84  module load intel_cc.9.0.026  
85  export MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6  
86    cd $WorkDir             || finish FAILURE "Could not cd to WorkDir $WorkDir"
87    
88    # Create an empty out_file
89    cat /dev/null > $out_file       || finish FAILURE "Could not create out_file $out_file"
90    
91    umask 022
92    
93    test -d sandbox.$RunDate        && finish FAILURE "Today's sandbox already exists"
94    mkdir sandbox.$RunDate          || finish FAILURE "Could not mkdir sandbox"
95    cd sandbox.$RunDate         || finish FAILURE "Could not cd to sandbox"
96    
97    echo "Checking out esys13/trunk"
98    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"
99    
100    # Load modules
101    . /opt/modules/default/init/bash
102    module use /raid2/matt/modules/modulefiles
103    module use /raid2/toolspp4/modulefiles/gcc-3.3.6
104    module use /usr/share/modules/modulefiles
105    module load esys/env    # Recommended modules
106    module load doxygen/1.4.6
107  module load boost/1.33.0/python-2.4.1  module load boost/1.33.0/python-2.4.1
 module load python/2.4.1  
 module load numarray/1.3.3  
108    
109  # set openmp settings  # How many threads? One per CPU.
110  export OMP_SCHEDULE="dynamic"  export OMP_NUM_THREADS=\$NCPUS
111  export OMP_NUM_THREADS=4  
112  export OMP_DYNAMIC=TRUE  # Run the tests
113  export OMP_NESTED=FALSE  echo "Running the tests $target"
114    cd trunk                || finish FAILURE "Could not cd to trunk"
115  echo "===> svn update"  scons -j \$NCPUS $target >> $out_file 2>&1      || finish FAILURE "Could not run scons $target"
116  svn update  
117  if [ $? != 0 ]  echo "Cleaning up after the tests"
118  then  
119    echo "svn update failed"  # Delete files older than 21 days
120    echo "svn update failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  find $WorkDir -atime +21 -exec rm -f {} \;
121    exit 2  
122  fi  finish SUCCESS "Successfully ran 'scons $target' on \`hostname\`"
123    
124  echo "===> scons building esys"  EOF
125  scons  
126  if [ $? != 0 ]  # cd to the logs area so the PBS logs are deposited there
127  then  cd $WorkDir/Logs
128    echo "scons build failed"  
129    echo "scons build failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  # Submit the job
130    exit 3  . /opt/modules/default/init/sh
131  fi  module load pbspro
132    
133  echo "===> building unit_tests"  # Submit the job
134  scons build_tests  qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null
135  if [ $? != 0 ]  
 then  
   echo "unit_test build failed"  
   echo "unit_test build failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
   exit 3  
 fi  
   
 FAIL=0  
   
 echo "===> running unit_tests"  
 scons run_tests  
 if [ $? != 0 ]  
 then  
   echo "unit_testing failed"  
   echo "unit_test failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
   FAIL=1  
 fi  
   
 for pytest in $ESCRIPT_PYTESTS  
 do  
   echo "===>running escript python test: $pytest"  
   scons build/posix/escript/test/python/$pytest  
   if [ $? != 0 ]  
   then  
     echo "python testing failed for $pytest in module $module"  
     echo "escript py_test: $pytest failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
     FAIL=1  
   fi  
 done  
   
 for pytest in $FINLEY_PYTESTS  
 do  
   echo "running finley python test: $pytest"  
   scons build/posix/finley/test/python/$pytest  
   if [ $? != 0 ]  
   then  
     echo "python testing failed for $pytest in module $module"  
     echo "finley py_test: $pytest failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
     FAIL=1  
   fi  
 done  
   
 for pytest in $BRUCE_PYTESTS  
 do  
   echo "running bruce python test: $pytest"  
   scons build/posix/bruce/test/python/$pytest  
   if [ $? != 0 ]  
   then  
     echo "python testing failed for $pytest in module $module"  
     echo "bruce py_test: $pytest failed" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
     FAIL=1  
   fi  
 done  
   
 if [ $FAIL == 0 ]  
 then  
     echo success  
     echo "success" | mail -s "esys autotest-scons results" $MAIL_RECIPIENTS  
 fi  
 exit 0  

Legend:
Removed from v.683  
changed lines
  Added in v.937

  ViewVC Help
Powered by ViewVC 1.1.26