/[escript]/trunk/autotest-scons
ViewVC logotype

Diff of /trunk/autotest-scons

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

revision 330 by svn, Wed Dec 7 06:31:27 2005 UTC revision 739 by ksteube, Tue Jun 20 00:52:56 2006 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/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    # TODO: should try using the entire node: scons -j $NCPUS all_tests
17    # I've been told this produces poor results...why?
18    
19    # Which tests should we run?
20    target='run_tests'  # Default scons target that runs the tests
21    test "x$1" != "x" && target="$1"
22    
23    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    # MAIL_RECIPIENTS="k.steube@uq.edu.au"
25    
26    RunDate=`date '+%Y_%m_%d'`  # Time stamp for log file names
27    
28    WorkDir=/raid3/ksteube/AutoTests
29    cd $WorkDir
30    
31    # Where to put the output of scons run_tests
32    out_file="$WorkDir/Logs/$RunDate.test.output"
33    
34    # Save the name of this script
35    SCRIPT_NAME=$0
36    
37  # $Id: autotest 162 2005-11-11 00:09:59Z svn $  # Below here \$variable means I want the variable interpreted when PBS runs the job, not when the job is submitted
38  # An explicit testing script for esys using the scons build system  # Similarly for \`...\`
39    
40    # Write the PBS script to run the tests
41    cat << EOF > Logs/$RunDate.pbs.script.sh
42    #!/bin/bash
43    
44  # list of users to email test results to  #PBS -q q1
45  #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"  #PBS -l ncpus=2
46  MAIL_RECIPIENTS="jgs@esscc.uq.edu.au"  #PBS -o $RunDate.pbs.stdout
47    #PBS -e $RunDate.pbs.stderr
48  #modules to test  
49  TESTS="escript bruce finley"  echo "PBS_JOBNAME       \$PBS_JOBNAME"
50    echo "PBS_JOBID         \$PBS_JOBID"
51  # the python tests to run  echo "PBS_QUEUE         \$PBS_QUEUE"
52  FINLEY_PYTESTS="ImportTest.py SimpleSolve.py GradTest.py test_linearPDEsOnFinley.py test_generators.py test_visualization_interface.py test_utilOnFinley.py test_symbolsOnFinley.py"  echo "NCPUS             \$NCPUS"
53  #ESCRIPT_PYTESTS="ImportTest.py BinaryOps.py UnaryOps.py SliceGetting.py SliceSetting.py MiscTests.py newEscriptTests.py DataVariableTests.py test_xml.py"  echo "USER              \$USER"
54  ESCRIPT_PYTESTS="ImportTest.py BinaryOps.py UnaryOps.py SliceGetting.py SliceSetting.py MiscTests.py newEscriptTests.py DataVariableTests.py"  echo "PBS_O_HOST        \$PBS_O_HOST"
55  BRUCE_PYTESTS="ImportTest.py BruceTest.py test_utilOnBruce.py test_symbolsOnBruce.py"  echo "PBS_O_WORKDIR     \$PBS_O_WORKDIR"
56    echo "PBS_O_SHELL       \$PBS_O_SHELL"
57    echo ""
58  # define compiler executable and library locations  echo ""
59  export PATH=/opt/intel/cmplrs/80.058/intel_cc_80/bin:$PATH  
60  export LD_LIBRARY_PATH=/opt/intel/cmplrs/80.058/intel_cc_80/lib  
61    
62  echo cd $1  START=\`date '+%Y/%m/%d %H:%M'\`
63  cd $1  
64  if [ $? != 0 ]  finish () {
65  then    END=\`date '+%Y/%m/%d %H:%M'\`
66    echo couldnt cd $1    cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS
67    echo "couldnt cd $1" | mail -s "esys autotest results" $MAIL_RECIPIENTS  \$2.
68    exit 1  The tests ran from \$START to \$END.
69  fi  See the log files in $WorkDir/Logs for more information.
70    This mail was sent by $SCRIPT_NAME
71  echo loading esys setup  running as \$USER on \`hostname\`.
72  . ~jgs/bin/scons_setup  END_MSG
73  if [ $? != 0 ]    test "x$1" = "FAIL" && exit 1
74  then    exit 0
75    echo couldnt load scons setup  }
76    echo "couldnt load scons setup" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
77    exit 2  
78  fi  cd $WorkDir             || finish FAILURE "Could not cd to WorkDir $WorkDir"
79    
80  echo running svn update  # Create an empty out_file
81  svn update  cat /dev/null > $out_file       || finish FAILURE "Could not create out_file $out_file"
82  if [ $? != 0 ]  
83  then  umask 022
84    echo svn update failed  
85    echo "svn update failed" | mail -s "esys autotest results" $MAIL_RECIPIENTS  test -d sandbox.$RunDate        && finish FAILURE "Today's sandbox already exists"
86    exit 3  mkdir sandbox.$RunDate          || finish FAILURE "Could not mkdir sandbox"
87  fi  cd sandbox.$RunDate         || finish FAILURE "Could not cd to sandbox"
88    
89  echo running scons debug=1  echo "Checking out esys13/trunk"
90  scons debug=1  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  if [ $? != 0 ]  
92  then  # Load modules
93    echo scons failed  . /opt/modules/default/init/bash
94    echo "scons failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  module use /raid2/matt/modules/modulefiles
95    exit 5  module use /raid2/toolspp4/modulefiles/gcc-3.3.6
96  fi  module use /usr/share/modules/modulefiles
97    module load esys/env    # Matt's recommended modules
98  echo running bruce unit_tests  module load doxygen/1.4.6
99  cd bruce/test  # 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  ./unit_test-scons  module load boost/1.33.0/python-2.4.1
101  if [ $? != 0 ]  
102  then  
103    echo bruce unit_test failed  # Had to request 2 CPUs, but only use one for the tests
104    echo "bruce unit_test failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  export OMP_NUM_THREADS=1
105    exit 6  
106  fi  # Run the tests
107  cd ../..  echo "Running the tests"
108    cd trunk                || finish FAILURE "Could not cd to trunk"
109  echo running escript unit_tests  scons $target >> $out_file 2>&1     || finish FAILURE "Could not run scons $target"
110  cd escript/test  
111  ./unit_test-scons  # Delete files older than 21 days
112  if [ $? != 0 ]  find $WorkDir -atime +21 -exec rm -f {} \;
113  then  
114    echo escript unit_test failed  # Clean up the sandbox
115    echo "escript unit_test failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  cd $WorkDir             || finish FAILURE "Could not cd to clean up WorkDir $WorkDir"
116    exit 6  /bin/rm -rf sandbox.$RunDate        || finish FAILURE "Could not delete sandbox"
117  fi  
118  cd ../..  finish SUCCESS "Successfully ran 'scons $target', see Logs in $WorkDir on ess"
119    
120  echo running finley unit_tests  EOF
121  cd finley/test  
122  ./unit_test-scons  # cd to the logs area so the PBS logs are deposited there
123  if [ $? != 0 ]  cd $WorkDir/Logs
124  then  
125    echo finley unit_test failed  # Submit the job
126    echo "finley unit_test failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  . /opt/modules/default/init/sh
127    exit 6  module load pbspro
128  fi  qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null
 cd ../..  
   
 export LD_LIBRARY_PATH=/raid2/tools/python-2.3.4/lib:$LD_LIBRARY_PATH  
 export PYTHON_INCLUDE=/raid2/tools/python-2.3.4/include/python2.3  
 export PYTHON_LIB_PATH=/raid2/tools/python-2.3.4/lib  
 export PATH=/raid2/tools/python-2.3.4/bin:$PATH  
   
 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  
               exit 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  
               exit 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  
               exit 1  
             fi  
         done  
     fi  
     cd ../../..  
 done  
129    
 echo "success" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
 exit 0  

Legend:
Removed from v.330  
changed lines
  Added in v.739

  ViewVC Help
Powered by ViewVC 1.1.26