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

Diff of /trunk/autotest-scons

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

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

Legend:
Removed from v.331  
changed lines
  Added in v.774

  ViewVC Help
Powered by ViewVC 1.1.26