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

Diff of /trunk/autotest-scons

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.26