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

Diff of /trunk/autotest-scons

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

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 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  
 #  
   
 # Which tests should we run?  
 target='run_tests'  # Default scons target that runs the tests  
 test "x$1" != "x" && target="$1"  
 requested_cpus=2  
 test "x$target" = "xall_tests" && requested_cpus=4  
5    
6  MAIL_RECIPIENTS="l.gross@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  # This time is when the job was submitted. If it waits in the queue it might run on another day.  NCPUS=4
10  # This date is also used to create the sandbox directory where the tests are run.  TEST_DIR=/data1/ksteube/EscriptDev/AutoTests
11  RunDate=`date '+%Y_%m_%d'`  # Time stamp for log file names  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 q80  
 #PBS -N autotest  
 #PBS -l ncpus=$requested_cpus  
 #PBS -o $RunDate.pbs.stdout  
 #PBS -e $RunDate.pbs.stderr  
 #PBS -W umask=022  
   
 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"  
 date  
 echo ""  
 echo ""  
   
   
   
 START=\`date '+%Y/%m/%d %H:%M'\`  
   
19  finish () {  finish () {
20    # state will be 'FAILURE' or 'SUCCESS'    # state will be 'FAILURE' or 'SUCCESS'
21    state="\$1"    state="$1"
22      message="$2"
23    date    date
24    # Clean up the sandbox    # Clean up the sandbox
25    cd $WorkDir    cd $TEST_DIR
26    /bin/rm -rf sandbox.$RunDate    /bin/rm -rf sandbox.$RunDate
27    END=\`date '+%Y/%m/%d %H:%M'\`    END=`date '+%Y/%m/%d %H:%M'`
28    cat << END_MSG | mail -s "ESYS_TESTS $target $RunDate \$state" $MAIL_RECIPIENTS    cat << END_MSG | mail -s "ESYS_TESTS $TEST_NAME $RunDate $state" $MAIL_RECIPIENTS
29  \$2.  $message.
30  The tests ran from \$START to \$END on \$NCPUS CPUs  The tests ran from $START to $END on $NCPUS cores
31  See the log files in $WorkDir/Logs/$RunDate*  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    if [ "x\$state" = "xFAILURE" ]; then    # 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      touch Logs/$RunDate.FAILURE
39      exit 1      exit 1
40    fi    fi
# Line 88  END_MSG Line 42  END_MSG
42  }  }
43    
44    
45  # set -x  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    # Save output in Logs/date.test.output
49    exec 1> $TEST_DIR/Logs/$RunDate.test.output 2>&1
50    
 cd $WorkDir             || finish FAILURE "Could not cd to WorkDir $WorkDir"  
51    
52  # Create an empty out_file  cd $TEST_DIR                || finish FAILURE "Could not cd to WorkDir $TEST_DIR"
53  cat /dev/null > $out_file       || finish FAILURE "Could not create out_file $out_file"  
54    test -d Logs || mkdir Logs
55    
56  umask 022  umask 022
57    
# Line 102  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    
62    # Load modules
63    . /usr/share/modules/init/sh
64    module load escript/current
65    module load subversion-1.3.1
66    module load pbs
67    
68  echo "Checking out esys13/trunk"  echo "Checking out esys13/trunk"
69  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"  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  # Load modules  export LD_LIBRARY_PATH="$TEST_DIR/lib:$LD_LIBRARY_PATH"
73  . /opt/modules/default/init/bash  export PYTHONPATH="$TEST_DIR:$PYTHONPATH"
 module use /raid2/matt/modules/modulefiles  
 module use /raid2/toolspp4/modulefiles/gcc-3.3.6  
 module use /usr/share/modules/modulefiles  
 module load esys/env    # Recommended modules  
 module load doxygen/1.4.6  
 module load boost/1.33.0/python-2.4.1  
 module load gmsh-1.65.0  
 module load epydoc/2.1/python-2.4.3  
74    
75  # How many threads? One per CPU.  # How many threads? One per CPU.
76  export OMP_NUM_THREADS=\$NCPUS  export OMP_NUM_THREADS=1
77    
78  # Run the tests  # Run the tests
79  echo "Running the tests $target"  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 -j \$NCPUS $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"
 # Run epydoc to create the python documentation  
 echo "Running epydoc"  
 export LD_LIBRARY_PATH="$PWD/lib:$LD_LIBRARY_PATH"  
 mkdir release release/doc release/doc/epydoc  
 scons api_epydoc >> $out_file 2>&1      || finish FAILURE "Could not run scons api_epydoc"  
 cd release/doc/epydoc  
 tar cf - . | ssh shake200 "cd /home/www/esys/esys13/nightly/epydoc; tar xf -"   || finish FAILURE "Could not copy epydoc to shake200"  
 cd ../../..  
83    
84  echo "Cleaning up after the tests"  echo "Cleaning up after the tests"
85    
86  # Delete files older than 60 days  # Delete files older than 60 days
87  find $WorkDir -atime +60 -exec rm -f {} \;  find $TEST_DIR -ctime +60 -exec rm -f {} \;
   
 finish SUCCESS "Successfully ran 'scons $target' on \`hostname\`"  
   
 EOF  
   
 # cd to the logs area so the PBS logs are deposited there  
 cd $WorkDir/Logs  
   
 # Submit the job  
 . /opt/modules/default/init/sh  
 module load pbspro  
88    
89  # Submit the job  finish SUCCESS "Successfully ran 'scons $TEST_NAME' on `hostname`"
 qsub -S /bin/bash $RunDate.pbs.script.sh > /dev/null  
90    

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

  ViewVC Help
Powered by ViewVC 1.1.26