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

Diff of /branches/escript3047_with_pastix2995/autotest-scons

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

revision 739 by ksteube, Tue Jun 20 00:52:56 2006 UTC revision 1707 by ksteube, Thu Aug 14 06:38:14 2008 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/bash
2    
3  #  # The test suite no longer runs as a PBS job (can't compile jobs on a
4  # Submit a PBS job to run the tests  # compute node because the compilers are on local disk of the login node)
 #  
 #   Usage: autotest-scons       # Short testing, only C++ tests  
 #   Usage: autotest-scons run_tests # Short testing, only C++ tests  
 #   Usage: autotest-scons all_tests # Long testing, C++ and python tests  
 #  
 # Copy this somewhere and run it every day via cron  
 #  
 # This file should be maintained in SVN as esys13/trunk/autotest-scons,  
 # be sure to copy it there and commit after modification  
 #  
   
 # TODO: should try using the entire node: scons -j $NCPUS all_tests  
 # I've been told this produces poor results...why?  
   
 # Which tests should we run?  
 target='run_tests'  # Default scons target that runs the tests  
 test "x$1" != "x" && target="$1"  
5    
6  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"  MAIL_RECIPIENTS="l.gross@uq.edu.au Peter.Hornby@csiro.au k.steube@uq.edu.au artak@uq.edu.au c.altinay@uq.edu.au j.fenwick1@uq.edu.au"
7  # MAIL_RECIPIENTS="k.steube@uq.edu.au"  # MAIL_RECIPIENTS="k.steube@uq.edu.au"
8    
9  RunDate=`date '+%Y_%m_%d'`  # Time stamp for log file names  NCPUS=4
10    TEST_DIR=/data1/ksteube/EscriptDev/AutoTests
11    TEST_NAME='all_tests'
12    
13  WorkDir=/raid3/ksteube/AutoTests  RunDate=`date '+%Y_%m_%d'`  # Time stamp for log file names
 cd $WorkDir  
14    
15  # Where to put the output of scons run_tests  START=`date '+%Y/%m/%d %H:%M'`
 out_file="$WorkDir/Logs/$RunDate.test.output"  
16    
 # Save the name of this script  
17  SCRIPT_NAME=$0  SCRIPT_NAME=$0
18    
 # Below here \$variable means I want the variable interpreted when PBS runs the job, not when the job is submitted  
 # Similarly for \`...\`  
   
 # Write the PBS script to run the tests  
 cat << EOF > Logs/$RunDate.pbs.script.sh  
 #!/bin/bash  
   
 #PBS -q q1  
 #PBS -l ncpus=2  
 #PBS -o $RunDate.pbs.stdout  
 #PBS -e $RunDate.pbs.stderr  
   
 echo "PBS_JOBNAME       \$PBS_JOBNAME"  
 echo "PBS_JOBID         \$PBS_JOBID"  
 echo "PBS_QUEUE         \$PBS_QUEUE"  
 echo "NCPUS             \$NCPUS"  
 echo "USER              \$USER"  
 echo "PBS_O_HOST        \$PBS_O_HOST"  
 echo "PBS_O_WORKDIR     \$PBS_O_WORKDIR"  
 echo "PBS_O_SHELL       \$PBS_O_SHELL"  
 echo ""  
 echo ""  
   
   
   
 START=\`date '+%Y/%m/%d %H:%M'\`  
   
19  finish () {  finish () {
20    END=\`date '+%Y/%m/%d %H:%M'\`    # state will be 'FAILURE' or 'SUCCESS'
21    cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$1" $MAIL_RECIPIENTS    state="$1"
22  \$2.    message="$2"
23  The tests ran from \$START to \$END.    date
24  See the log files in $WorkDir/Logs for more information.    # Clean up the sandbox
25      cd $TEST_DIR
26      /bin/rm -rf sandbox.$RunDate
27      END=`date '+%Y/%m/%d %H:%M'`
28      cat << END_MSG | mail -s "ESYS_TESTS $TEST_NAME $RunDate $state" $MAIL_RECIPIENTS
29    $message.
30    The tests ran from $START to $END on $NCPUS cores
31    See the log files in $TEST_DIR/Logs/$RunDate*
32  This mail was sent by $SCRIPT_NAME  This mail was sent by $SCRIPT_NAME
33  running as \$USER on \`hostname\`.  running as $USER on `hostname`.
34  END_MSG  END_MSG
35    test "x$1" = "FAIL" && exit 1    # There are three ways to see errors:
36      # egrep 'FAIL|Error:|error set =' $TEST_DIR/Logs/$RunDate.test.output
37      if [ "x$state" = "xFAILURE" ]; then
38        touch Logs/$RunDate.FAILURE
39        exit 1
40      fi
41    exit 0    exit 0
42  }  }
43    
44    
45  cd $WorkDir             || finish FAILURE "Could not cd to WorkDir $WorkDir"  cat /dev/null > $TEST_DIR/Logs/$RunDate.test.output \
46                        || finish FAILURE "Could not create out_file $TEST_DIR/Logs/$RunDate.test.output"
47    
48  # Create an empty out_file  # Save output in Logs/date.test.output
49  cat /dev/null > $out_file       || finish FAILURE "Could not create out_file $out_file"  exec 1> $TEST_DIR/Logs/$RunDate.test.output 2>&1
50    
51    
52    cd $TEST_DIR                || finish FAILURE "Could not cd to WorkDir $TEST_DIR"
53    
54    test -d Logs || mkdir Logs
55    
56  umask 022  umask 022
57    
# Line 86  test -d sandbox.$RunDate       && finish FAIL Line 59  test -d sandbox.$RunDate       && finish FAIL
59  mkdir sandbox.$RunDate          || finish FAILURE "Could not mkdir sandbox"  mkdir sandbox.$RunDate          || finish FAILURE "Could not mkdir sandbox"
60  cd sandbox.$RunDate         || finish FAILURE "Could not cd to sandbox"  cd sandbox.$RunDate         || finish FAILURE "Could not cd to sandbox"
61    
 echo "Checking out esys13/trunk"  
 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"  
   
62  # Load modules  # Load modules
63  . /opt/modules/default/init/bash  . /usr/share/modules/init/sh
64  module use /raid2/matt/modules/modulefiles  module load escript/current
65  module use /raid2/toolspp4/modulefiles/gcc-3.3.6  module load subversion-1.3.1
66  module use /usr/share/modules/modulefiles  module load pbs
 module load esys/env    # Matt's recommended modules  
 module load doxygen/1.4.6  
 # 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  
 module load boost/1.33.0/python-2.4.1  
67    
68    echo "Checking out esys13/trunk"
69    svn checkout svn+ssh://shake200.esscc.uq.edu.au/home/www_svn/repos/esys13/trunk >> $TEST_DIR/Logs/$RunDate.test.output 2>&1 \
70                        || finish FAILURE "Could not check out esys13/trunk"
71    
72    export LD_LIBRARY_PATH="$TEST_DIR/lib:$LD_LIBRARY_PATH"
73    export PYTHONPATH="$TEST_DIR:$PYTHONPATH"
74    
75  # Had to request 2 CPUs, but only use one for the tests  # How many threads? One per CPU.
76  export OMP_NUM_THREADS=1  export OMP_NUM_THREADS=1
77    
78  # Run the tests  # Run the tests
79  echo "Running the tests"  echo "Running the tests $TEST_NAME"
80  cd trunk                || finish FAILURE "Could not cd to trunk"  cd trunk                || finish FAILURE "Could not cd to trunk"
81  scons $target >> $out_file 2>&1     || finish FAILURE "Could not run scons $target"  scons dodebug=no useMPI=no -j $NCPUS $TEST_NAME >> $TEST_DIR/Logs/$RunDate.test.output 2>&1 \
82                        || finish FAILURE "Could not run scons $TEST_NAME"
 # Delete files older than 21 days  
 find $WorkDir -atime +21 -exec rm -f {} \;  
   
 # Clean up the sandbox  
 cd $WorkDir             || finish FAILURE "Could not cd to clean up WorkDir $WorkDir"  
 /bin/rm -rf sandbox.$RunDate        || finish FAILURE "Could not delete sandbox"  
   
 finish SUCCESS "Successfully ran 'scons $target', see Logs in $WorkDir on ess"  
83    
84  EOF  echo "Cleaning up after the tests"
85    
86  # cd to the logs area so the PBS logs are deposited there  # Delete files older than 60 days
87  cd $WorkDir/Logs  find $TEST_DIR -ctime +60 -exec rm -f {} \;
88    
89  # Submit the job  finish SUCCESS "Successfully ran 'scons $TEST_NAME' on `hostname`"
 . /opt/modules/default/init/sh  
 module load pbspro  
 qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null  
90    

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

  ViewVC Help
Powered by ViewVC 1.1.26