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

Diff of /branches/windows_from_1456_trunk_1544_merged_in/autotest-scons

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

revision 318 by jgs, Tue Dec 6 02:25:26 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    # Write the PBS script to run the tests
40    cat << EOF > Logs/$RunDate.pbs.script.sh
41    #!/bin/bash
42    
43  # define compiler executable and library locations  #PBS -q q1
44  export PATH=/opt/intel/cmplrs/80.058/intel_cc_80/bin:$PATH  #PBS -N autotest
45  export LD_LIBRARY_PATH=/opt/intel/cmplrs/80.058/intel_cc_80/lib  #PBS -l ncpus=$requested_cpus
46    #PBS -o $RunDate.pbs.stdout
47  echo cd $1  #PBS -e $RunDate.pbs.stderr
48  cd $1  #PBS -W umask=022
49  if [ $? != 0 ]  
50  then  echo "PBS_JOBNAME       \$PBS_JOBNAME"
51    echo couldnt cd $1  echo "PBS_JOBID         \$PBS_JOBID"
52    echo "couldnt cd $1" | mail -s "esys autotest results" $MAIL_RECIPIENTS  echo "PBS_QUEUE         \$PBS_QUEUE"
53    exit 1  echo "NCPUS             \$NCPUS"
54  fi  echo "USER              \$USER"
55    echo "PBS_O_HOST        \$PBS_O_HOST"
56  echo loading esys setup  echo "PBS_O_WORKDIR     \$PBS_O_WORKDIR"
57  . ~jgs/bin/scons_setup  echo "PBS_O_SHELL       \$PBS_O_SHELL"
58  if [ $? != 0 ]  date
59  then  echo ""
60    echo couldnt load scons setup  echo ""
61    echo "couldnt load scons setup" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
62    exit 2  
63  fi  
64    START=\`date '+%Y/%m/%d %H:%M'\`
65  echo running svn update  
66  svn update  finish () {
67  if [ $? != 0 ]    date
68  then    # Clean up the sandbox
69    echo svn update failed    cd $WorkDir
70    echo "svn update failed" | mail -s "esys autotest results" $MAIL_RECIPIENTS    /bin/rm -rf sandbox.$RunDate
71    exit 3    END=\`date '+%Y/%m/%d %H:%M'\`
72  fi    cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS
73    \$2.
74  echo running scons debug=1  The tests ran from \$START to \$END on \$NCPUS CPUs
75  scons debug=1  See the log files in $WorkDir/Logs/$RunDate*
76  if [ $? != 0 ]  This mail was sent by $SCRIPT_NAME
77  then  running as \$USER on \`hostname\`.
78    echo scons failed  END_MSG
79    echo "scons failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS    test "x\$1" = "FAILURE" && exit 1
80    exit 5    exit 0
81  fi  }
82    
83  #echo running mk unit_test  
84  #./mk unit_test  cd $WorkDir             || finish FAILURE "Could not cd to WorkDir $WorkDir"
85  #if [ $? != 0 ]  
86  #then  # Create an empty out_file
87  #  echo ./mk unit_test failed  cat /dev/null > $out_file       || finish FAILURE "Could not create out_file $out_file"
88  #  echo "./mk unit_test failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
89  #  exit 6  umask 022
90  #fi  
91    test -d sandbox.$RunDate        && finish FAILURE "Today's sandbox already exists"
92  #echo running mk py_test  mkdir sandbox.$RunDate          || finish FAILURE "Could not mkdir sandbox"
93  #./mk py_test  cd sandbox.$RunDate         || finish FAILURE "Could not cd to sandbox"
94  #if [ $? != 0 ]  
95  #then  echo "Checking out esys13/trunk"
96  #  echo ./mk py_test failed  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  #  echo "./mk py_test failed - see autotest logfile" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
98  #  exit 7  # Load modules
99  #fi  . /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
106    
107    # How many threads? One per CPU.
108    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    
 echo "success" | mail -s "esys autotest results" $MAIL_RECIPIENTS  
 exit 0  

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

  ViewVC Help
Powered by ViewVC 1.1.26