Changeset 2185


Ignore:
Timestamp:
09/10/09 12:40:15 (16 years ago)
Author:
Mathieu Morlighem
Message:

updated nightly run

Location:
issm/trunk/cron
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/cron/nightlyrun.sh

    r2182 r2185  
    2323function todaydate()
    2424{
    25         export today=`date | awk '{printf("%s-%s-%s",$2,$3,$6);}'`;
    26         suffix=`date | awk '{printf("%s-%s-%s",$2,$3,$6);}'`                     
     25        suffix=`date | awk '{printf("%s-%s-%s  %s",$2,$3,$6,$4);}'`                     
    2726        echo $suffix;                   
    2827}
     
    3029{
    3130        #return host name depending on the OS
    32         if [[ "$1" == "winxp32" ]]
     31        if [ "$1" = "winxp32" ]
    3332        then
    3433                HOST_NAME=`hostname`;
     
    4544        echo "no config file specified. Exiting..."
    4645        exit 1
    47 else
    48         #launch nightly run (get start time)
    49         source $1;
    50         START_TIME=$(timer)
    51 fi
    52 
    53 #create nightly run variables
    54 export TODAY=$(todaydate);
    55 export HOST_NAME=$(host_name $OS);
    56 export ISSM_RELEASE="issm"
    57 export OS
     46fi
     47
     48#launch nightly run (get start time)
     49source $1;
     50TODAY=$(todaydate);
     51HOST_NAME=$(host_name $OS);
     52START_TIME=$(timer)
     53
     54#Initialize nightly run output
     55rm -rf $ISSM_DIR/test/Verification/NightlyRun
     56mkdir  $ISSM_DIR/test/Verification/NightlyRun
     57cat << END > $ISSM_DIR/test/Verification/NightlyRun/nightly.log
     58today:   $(echo $TODAY)
     59user:    $(whoami)
     60host:    $(echo $HOST_NAME)
     61OS:      $(echo $OS)
     62release: $(echo "issm")
     63END
    5864
    5965#create ISSM variables
     
    6167export ISSM_ARCH
    6268
    63 #Erase previous code and Fetch the new one
    64 rm -rf trunk
    65 svn checkout $REPOSITORY
    66 
    67 #install ISSM
    68 
    69 #1: modify some variables
    70 cd $ISSM_DIR/etc
    71 
    72 #source environment variables with new matlab path
    73 source environment.sh MATLAB_DIR=$MATLAB_PATH
    74 
    75 #create simpler  cluster.rc file, with only the cluster we are interested in.
    76 cat << END > cluster.rc
     69#Checkout and install ISSM if required
     70if [ "$SKIPINSTALLATION" != "yes" ]
     71then
     72
     73        #Erase previous code and Fetch the new one
     74        rm -rf trunk
     75        svn checkout $REPOSITORY
     76
     77        #source environment variables with new matlab path
     78        cd $ISSM_DIR/etc
     79        source environment.sh MATLAB_DIR=$MATLAB_PATH
     80
     81        #create simpler  cluster.rc file, with only the cluster we are interested in.
     82        cat << END > cluster.rc
    7783begin
    7884cluster_name=$HOST_NAME
     
    8389END
    8490
    85 if [[ $SKIPPACKAGESCOMPILATION  == "yes" ]]
    86 then
    87         #erase externapackages, and link with externalpackages_dir
     91        #Install external packages
     92        if [ "$SKIPPACKAGESCOMPILATION"  = "yes" ]
     93        then
     94
     95                #erase externapackages, and link with externalpackages_dir
     96                cd $ISSM_DIR
     97                rm -rf externalpackages
     98                cp -Rf $EXTERNALPACKAGESDIR ./
     99
     100                rm -rf devpackages
     101                cp -Rf $DEVPACKAGESDIR ./
     102        else
     103               
     104                cd $ISSM_DIR/externalpackages
     105                for ep in $EXTERNALPACKAGES
     106                do
     107                        cd $ep
     108                        cp configs/$OS/* .
     109                        ./install.sh $NUMCPUS
     110                        cd ..
     111                done
     112
     113                #3: install automake and autoconf
     114                cd $ISSM_DIR/devpackages
     115                make
     116                cd ..
     117        fi
     118else
     119
     120        #source environment variables with new matlab path
     121        cd $ISSM_DIR/etc
     122        source environment.sh MATLAB_DIR=$MATLAB_PATH
     123
     124fi
     125
     126#Generate Makefiles and compile ISSM if requested
     127if [ "$SKIPCOMPILATION" != "yes" ]
     128then
    88129        cd $ISSM_DIR
    89         rm -rf externalpackages
    90         cp -Rf $EXTERNALPACKAGESDIR ./
    91 
    92         rm -rf devpackages
    93         cp -Rf $DEVPACKAGESDIR ./
    94 else
    95         #2: install some required external packages
    96         cd $ISSM_DIR/externalpackages
    97         for ep in $EXTERNALPACKAGES
    98         do
    99                 cd $ep
    100                 cp configs/$OS/* .
    101                 ./install.sh $NUMCPUS
    102                 cd ..
    103         done
    104 
    105         #3: install automake and autoconf
    106         cd $ISSM_DIR/devpackages
    107         make
    108         cd ..
    109 fi
    110 
    111 #3: generate MakeFiles
    112 cd $ISSM_DIR
    113 sh scripts/automakererun.sh
    114 sh configs/$OS/$OS.sh
    115 
    116 #4: compile and install ISSM
    117 if [[ "$OS" == "winxp32" ]]
    118 then
    119         cd $ISSM_DIR/src/c
    120         ./intel-compile.sh >> ../../c-compilation.log 2>&1
    121         cd $ISSM_DIR/src/mex
    122         make install >> ../../mex-compilation.log 2>&1
    123         cd $ISSM_DIR
    124 else
    125         make -j $NUMCPUS >> ../../cmex-compilation.log 2>&1
    126         make -j $NUMCPUS install >> ../../cmex-compilation.log 2>&1
    127 fi
    128 
    129 INSTAL_TIME=$(timer)
    130 export ELAPSED_INSTAL=$(timer $START_TIME)
     130        sh scripts/automakererun.sh
     131        sh configs/$OS/$OS.sh
     132
     133        #4: compile and install ISSM
     134        if [ "$OS" = "winxp32" ]
     135        then
     136                cd $ISSM_DIR/src/c
     137                ./intel-compile.sh >> ../../c-compilation.log 2>&1
     138                cd $ISSM_DIR/src/mex
     139                make install >> ../../mex-compilation.log 2>&1
     140                cd $ISSM_DIR
     141        else
     142                make -j $NUMCPUS >> ../../cmex-compilation.log 2>&1
     143                make -j $NUMCPUS install >> ../../cmex-compilation.log 2>&1
     144        fi
     145fi
    131146
    132147#windows environments: ISSM_DIR_WIN variable not correctly picked up when using
    133148#the cron job. just get startup to take the ISSM_DIR variable as the pwd:
    134 if [[ "$OS" == "winxp32" ]]
     149if [ "$OS" = "winxp32" ]
    135150then
    136151        cat startup.m | sed 's/clear status/clear status; ISSM_DIR=pwd;/g' > startup.m.bak
     
    138153fi
    139154
     155#put installation elapsed time in nightly.log
     156INSTALL_TIME=$(timer)
     157ELAPSED_INSTALL=$(timer $START_TIME)
     158cat << END >> $ISSM_DIR/test/Verification/NightlyRun/nightly.log
     159elapsed_install: $(echo $ELAPSED_INSTALL)
     160END
     161
    140162#Launch matlab and the nightly run script
    141 mktemp matlaberror.log
    142 cat > matlab_run.m << EOF
    143 startup
    144 warning off %necessary to avoid a nightly.log of several Go for cielo_parallel
    145 try,
    146         nightlyrun;
    147 catch me,
    148         %An error occured, get report and exit
    149         directory=strsplit(pwd,'/');
    150         message=getReport(me)
    151         fid=fopen([ISSM_DIR '/matlaberror.log'], 'wt');
    152         fprintf(fid,'Matlab error occured in: %s\n',directory{end});
    153         fprintf(fid,'%s',message);
    154         fclose(fid);
    155 end
     163cd $ISSM_DIR/cron/
     164./run.sh $NROPTIONS
     165ELAPSED_RUN=$(timer $INSTALL_TIME)
     166ELAPSED_TOTAL=$(timer $START_TIME)
     167cat << END >> $ISSM_DIR/test/Verification/NightlyRun/nightly.log
     168elapsed_run: $(echo $ELAPSED_RUN)
     169elapsed_total: $(echo $ELAPSED_TOTAL)
     170END
     171
     172#Build html report
     173cd $ISSM_DIR/cron/
     174./report.sh
     175echo "html report located in $ISSM_DIR/test/Verification/NightlyRun/report.html"
    156176exit
    157 EOF
    158 
    159 matlab -nojvm -nosplash  -r matlab_run -logfile nightlylong.log
    160 
    161 #removed unused lines to deal with a smaller file
    162 cat nightlylong.log | egrep 'ERROR|SUCCESS|FAILURE' > nightly.log
    163 #rm nightlylong.log
    164 
    165 #Build html report
    166 export ELAPSED_RUN=$(timer $INSTAL_TIME)
    167 export ELAPSED_TOTAL=$(timer $START_TIME)
    168 ./cron/report.sh
    169177               
    170178#send mail
     
    172180for i in `echo $MAILINGLIST`; do
    173181
    174         if [[ "$OS" == "winxp32" ]]
     182        if [ "$OS" = "winxp32" ]
    175183        then
    176184                email -html -f "ISSM Nightly run $EMAIL_ADRESS" -s "Nightly runs of $ISSM_RELEASE , operating system: $OS. " $i < report.html
    177185        else
    178                 if [[ "$OS" == "linux64" ]]
     186                if [ "$OS" = "linux64" ]
    179187                then
    180188                        cat - report.html <<HERE | /usr/lib/sendmail  -oi -t
     
    197205
    198206done
    199 
    200 #Erase log and error logs
    201 #rm -rf nightly.log report.html
    202 
    203 #Erase ice code
    204 #cd ..
    205 #rm -rf trunk/
  • issm/trunk/cron/report.sh

    r2182 r2185  
    22#generate html report from nightly.log output file
    33
    4 #Process log
    5 cat nightly.log | grep 'ERROR'   | grep -v "PETSC ERROR" > errors.log
    6 cat nightly.log | grep 'SUCCESS'                         > success.log
    7 cat nightly.log | grep 'FAILURE'                         > failures.log
     4cd $ISSM_DIR/test/Verification/NightlyRun/
     5
     6#process nightly.log
     7TODAY=`     cat nightly.log | grep "today"           | awk '{printf("%s %s",$2,$3);}'`
     8USER=`      cat nightly.log | grep "user"            | awk '{print $2}'`
     9HOST_NAME=` cat nightly.log | grep "host"            | awk '{print $2}'`
     10OS=`        cat nightly.log | grep "OS"              | awk '{print $2}'`
     11RELEASE=`   cat nightly.log | grep "release"         | awk '{print $2}'`
     12EL_INSTALL=`cat nightly.log | grep "elapsed_install" | awk '{print $2}'`
     13EL_RUN=`    cat nightly.log | grep "elapsed_run"     | awk '{print $2}'`
     14EL_TOTAL=`  cat nightly.log | grep "elapsed_total"   | awk '{print $2}'`
     15
     16#Process matlab_log.log
     17cat matlab_log.log         | egrep 'ERROR|SUCCESS|FAILURE'          > matlab.log
     18NUM_TOT=`wc -l matlab.log | awk '{print $1}'`
     19NUM_ERR=`cat matlab.log | grep 'ERROR'   | grep -v "PETSC ERROR" | wc -l`
     20NUM_SUC=`cat matlab.log | grep 'SUCCESS' | wc -l`
     21NUM_FAI=`cat matlab.log | grep 'FAILURE' | wc -l`
     22
     23#style
     24H1_STYLE='width="1000px" cellpadding="20"'
     25H1_FONT='style="color:#6495ed; font-family:Arial, Verdana, Tahoma; font-weight: bold; font-size:35px;" align="center"'
     26
     27H2_STYLE='width="900px" cellpadding="20"'
     28H2_FONT='style="color:#6495ed; font-family:Arial, Verdana, Tahoma; font-size:28px; font-weight: bold;" align="left"'
     29
     30TABLE_STYLE='width="800px" rules=none bgcolor="#ffffdd" border=1 bordercolor="#000000" cellpadding="3"'
     31TABLE_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14; font-weight: normal;" align="left"'
     32
     33MATLAB_STYLE='width="1000px" rules=none'
     34MATLAB_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14px; font-weight: normal;" align="left"'
     35
     36BODY_STYLE='width="1000px"'
     37BODY_FONT="style=\"color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14px;\""
     38
     39FOOTER_STYLE='width="800px"  cellpadding="10"'
     40FOOTER_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:12px; font-weight: normal;" align="center"'
     41
     42#style 2
     43BODY_FONTC=`echo $BODY_FONT | sed -e "s/style=\"/style=\"text-align:center; /g"`
     44BODY_FONTL=`echo $BODY_FONT | sed -e "s/style=\"/style=\"text-align:left; /g"`
    845
    946#create some variables
     
    1451        IS_INSTALL=1
    1552fi
    16 if [ $(wc -l nightly.log | awk '{printf("%s",$1);}')  -eq 0 ]
     53if [ $(wc -l matlab.log | awk '{printf("%s",$1);}')  -eq 0 ]
    1754then
    1855        IS_RUN=0
     
    2057        IS_RUN=1
    2158fi
    22 
    23 #style
    24 H1_STYLE='width="800px" cellpadding="20"'
    25 H1_FONT='style="color:#6495ed; font-family:Arial, Verdana, Tahoma; font-weight: bold; font-size:35px;" align="center"'
    26 
    27 H2_STYLE='width="840px" cellpadding="20"'
    28 H2_FONT='style="color:#6495ed; font-family:Arial, Verdana, Tahoma; font-size:28px; font-weight: bold;" align="left"'
    29 
    30 TABLE_STYLE='width="820px" rules=none bgcolor="#ffffdd" border=1 bordercolor="#000000" cellpadding="3"'
    31 TABLE_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14; font-weight: normal;" align="left"'
    32 
    33 MATLAB_STYLE='width="820px" rules=none'
    34 MATLAB_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14px; font-weight: normal;" align="left"'
    35 
    36 BODY_STYLE='width="820px"'
    37 BODY_FONT="style=\"color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14px;\""
    38 
    39 NOTEST_STYLE='width="650px"'
    40 NOTEST_FONT='style="color:#FF0000; font-family:Arial, Verdana, Tahoma; font-size:14px;" align="left"'
    41 
    42 FOOTER_STYLE='width="800px"  cellpadding="10"'
    43 FOOTER_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:12px; font-weight: normal;" align="center"'
    4459
    4560#build report.html
     
    5671</tr>
    5772<tr>
    58 <td $TABLE_FONT>user: $(whoami)</td>
    59 <td $TABLE_FONT>total elapsed time: $ELAPSED_TOTAL</td>
    60 </tr>
    61 <tr>
    6273<td $TABLE_FONT>OS: $OS</td>
    63 <td $TABLE_FONT>installation elapsed time: $ELAPSED_INSTAL</td>
    64 </tr>
    65 <tr>
    66 $(#print status
    67 if [ $(echo $IS_INSTALL) -eq 0 ];
    68 then
    69         #installation failed, end of report
    70         echo "<td $TABLE_FONT>status: <span style=\"color:#FF0000\">installation failed</span></td>"
    71         echo "<td $TABLE_FONT>execution elapsed time: $ELAPSED_RUN</td>"
    72         echo "</tr>"
    73         echo "</table>"
    74         rm errors.log success.log
    75 else
    76         #installation successful. Did we go to the end?
    77 
    78         if [ $(echo $IS_RUN) -eq 0 ];
     74<td $TABLE_FONT>user: $USER</td>
     75</tr>
     76<tr>
     77<td $TABLE_FONT>status: STATUS</td>
     78<td $TABLE_FONT>release: $RELEASE</td>
     79</tr>
     80<tr>
     81<td $TABLE_FONT>number of success: $NUM_SUC/$NUM_TOT
     82<td $TABLE_FONT>total elapsed time: $EL_TOTAL</td>
     83</tr>
     84<tr>
     85<td $TABLE_FONT>number of errors: $NUM_ERR/$NUM_TOT
     86
     87<td $TABLE_FONT>installation elapsed time: $EL_INSTALL</td>
     88</tr>
     89<tr>
     90<td $TABLE_FONT>number of failures: $NUM_FAI/$NUM_TOT
     91<td $TABLE_FONT>installation elapsed time: $EL_INSTALL</td>
     92</tr>
     93</table>
     94<br><hr width="1000px">
     95END
     96
     97#update status
     98if [ $IS_RUN -eq 1 ]
     99then
     100        cat summary.html | sed -e "s/STATUS/<span style=\"color:#008000\">all test desks have been run<\/span>/g" > summary2.html
     101        mv summary2.html summary.html
     102else
     103        if [ $IS_INSTALL -eq 1 ]
    79104        then
    80                 #run failed, end of report
    81                 echo "<td $TABLE_FONT>status: <span style=\"color:#FF0000\">installation successful but tests runs failed</span></td>"
    82                 echo "<td $TABLE_FONT>execution elapsed time: $ELAPSED_RUN</td>"
    83                 echo "</tr>"
    84                 echo "</table>"
    85                 rm errors.log success.log failures.log
    86 
     105                cat summary.html | sed -e "s/STATUS/<span style=\"color:#ff0000\">installation successful but tests runs failed<\/span>/g" > summary2.html
     106                mv summary2.html summary.html
    87107        else
    88 
    89                 echo "<td $TABLE_FONT>status: <span style=\"color:#008000\">all test desks have been run</span></td>"
    90                 echo "<td $TABLE_FONT>execution elapsed time: $ELAPSED_RUN</td>"
    91                 echo "</tr>"
    92                 echo "<tr>"
    93                 echo "<td $TABLE_FONT>number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l nightly.log | awk '{printf("%s",$1);}';  rm errors.log)</td>"
    94                 echo "<td $TABLE_FONT>  </td>"
    95                 echo "</tr>"
    96                 echo "<tr>"
    97                 echo "<td $TABLE_FONT>number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l nightly.log | awk '{printf("%s",$1);}'; rm success.log)</td>"
    98                 echo "<td $TABLE_FONT>  </td>"
    99                 echo "</tr>"
    100                 echo "</table>"
    101 
    102                 #draw a line and clean up
    103                 echo "<br><hr width=\"900px\">"
     108                cat summary.html | sed -e "s/STATUS/<span style=\"color:#ff0000\">installation failed<\/span>/g" > summary2.html
     109                mv summary2.html summary.html
    104110        fi
    105 fi)
    106 END
     111fi
    107112
    108113#Matlab error report
     114if [ -e matlaberror.log ]
     115then
    109116cat << END > matlaberror.html
    110117<table $H2_STYLE><tr><td $H2_FONT>Matlab error</td></tr></table>
     
    113120</td></tr></table>
    114121END
     122else
     123        mktemp matlaberror.html
     124fi
    115125
    116126#report content
    117 if [ $(echo $IS_INSTALL) = 1 ];
     127if [ $IS_INSTALL -eq 1 ];
    118128then
    119129        cat << END > content.html
     
    130140<th $(echo $BODY_FONT)>Control fit</th>
    131141<th $(echo $BODY_FONT)>Parallel</th>
    132 </tr>
    133 $( COUNTER=0
    134 MAX=`wc -l nightly.log | awk '{printf("%s",$1);}'`
    135 while [  $COUNTER -lt $MAX ]; do
    136         let COUNTER=COUNTER+1
    137 
    138         echo "<tr>"
    139 
    140         #see wether it is success or error (get color: red or green)
    141         RESULT="$(cat nightly.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$COUNTER'o/ {printf("%s\n",$2);}';)"
    142         if [ "$RESULT" = "SUCCESS" ]; 
    143         then
    144                 color="bgcolor=#ddffdd";
    145         else
    146                 if [ "$RESULT" = "ERROR" ];
    147                 then
    148                         color="bgcolor=#ffdddd";
    149                 else
    150                         color="bgcolor=#ddddff";
    151                 fi
    152         fi
    153         FONT=$(echo "$BODY_FONT $color")
    154 
    155         #build html corresponding line
    156         cat nightly.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk -v FONT="$FONT" '
    157         /line'$COUNTER'o/ { printf("<td %s>%s</td><td %s>%s%s%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td>",FONT,$2,FONT,$4,$5,$6,FONT,$8,FONT,$10,FONT,$12,FONT,$14,FONT,$16,FONT,$18,FONT,$20);}
    158         ';
    159 
    160         echo "</tr>"
    161 
    162 done)
     142<th $(echo $BODY_FONT)>Field checked</th>
     143</tr>
     144$(cat matlab.log | while read line
     145  do
     146          echo "<tr>"
     147
     148          #get status
     149          STATUS=`echo $line | awk '{print $1}'`
     150
     151          #FAILURE
     152          if [ "$STATUS" = "FAILURE" ]
     153          then
     154
     155                  FONTC=$(echo "$BODY_FONTC bgcolor=#ffff00");
     156                  FONTL=$(echo "$BODY_FONTL bgcolor=#ffff00");
     157                  echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" '
     158                  { printf("<td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td>",FONTL,$1,FONTC,"N/A",FONTL,$3,FONTL,$5,FONTL,$7,FONTC,$9,FONTC,$11,FONTC,$13,FONTC,$15,FONTC,"N/A");}
     159                          ';
     160
     161                  else
     162
     163                  #SUCCESS
     164                  if [ "$STATUS" = "SUCCESS" ]
     165                  then
     166                          color="bgcolor=#ddffdd";
     167
     168                  #ERROR
     169                  else
     170                          color="bgcolor=#ffdddd";
     171                  fi
     172
     173                  FONTC=$(echo "$BODY_FONTC $color")
     174                  FONTL=$(echo "$BODY_FONTL $color")
     175                  echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" '
     176                  { printf("<td %s>%s</td><td %s>%s%s%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td>",FONTL,$1,FONTL,$3,$4,$5,FONTL,$7,FONTL,$9,FONTL,$11,FONTC,$13,FONTC,$15,FONTC,$17,FONTC,$19,FONTL,$21);}
     177                          ';
     178          fi
     179
     180          echo "</tr>"
     181
     182  done
     183          )
    163184</table>
    164185<br>
     
    176197
    177198#concatenate files
    178 if [ $IS_RUN -eq 0 ];
    179 then
    180         cat summary.html matlaberror.html content.html footer.html > report.html
    181 else
    182         cat summary.html                  content.html footer.html > report.html
    183 fi
    184 rm  summary.html content.html footer.html matlaberror.html
     199cat summary.html matlaberror.html content.html footer.html > report.html
     200rm  summary.html content.html footer.html matlaberror.html matlab.log
  • issm/trunk/cron/run.sh

    r2180 r2185  
    33numprocs=8;
    44
    5 #figure out if startup.m is here, otherwise, symlink it.
    6 if [ -e startup.m ]
    7 then
    8         echo ""
    9         #startup.m exists, do nothing
    10 else
    11         echo "creating startup.m symlink file"
    12         ln -s $ISSM_DIR/startup.m
    13 fi
     5#create softlink to startup
     6rm startup.m
     7cd $ISSM_DIR/test/Verification/NightlyRun/
     8ln -s $ISSM_DIR/startup.m .
    149
    15 
     10#Launch all tests on different cpus
    1611for (( i=1;i<=$numprocs;i++ ))
    1712do
    1813        #Launch matlab and the nightly run script
    19         cat > matlab_run$i.m << EOF
    20         startup
     14        cat > $ISSM_DIR/test/Verification/NightlyRun/matlab_run$i.m << EOF
    2115        warning off %necessary to avoid a nightly.log of several Go for cielo_parallel
    2216        try,
    23                 nightlyrun($i,$numprocs);
     17        $(if [ "$1" = ""  ]
     18        then
     19                echo "nightlyrun('rank',$i,'numprocs',$numprocs);"
     20        else
     21                echo "nightlyrun($1,'rank',$i,'numprocs',$numprocs);"
     22        fi
     23                )
    2424        catch me,
    2525                %An error occured, get report and exit
    2626                directory=strsplit(pwd,'/');
    2727                message=getReport(me)
    28                 fid=fopen([ISSM_DIR '/matlaberror.log'], 'wt');
    29                 fprintf(fid,'Matlab error occured in: %s\n',directory{end});
     28                fid=fopen([ISSM_DIR '/test/Verification/NightlyRun/matlaberror.log'], 'wt');
     29                fprintf(fid,'\nMatlab error occured in: %s\n\n',directory{end});
    3030                fprintf(fid,'%s',message);
    3131                fclose(fid);
     
    3333        exit
    3434EOF
    35         matlab -nojvm -nosplash  -r matlab_run$i -logfile nightlylong$i.log &
     35        matlab -nojvm -nosplash  -r matlab_run$i -logfile matlab_log$i.log &
    3636done
    3737
    3838wait
    3939
     40#remove matlab_run scripts.
     41rm -rf matlab_run*.m
     42
    4043#concatenate all reports
    41 mv nightlylong1.log  nightlylong.log
     44mv matlab_log1.log  matlab_log.log
    4245for (( i=2;i<=$numprocs;i++ ))
    4346do
    44         cat nightlylong.log nightlylong$i.log > nightlylong.log.bak
    45         mv nightlylong.log.bak nightlylong.log
    46         rm nightlylong$i.log
     47        cat matlab_log.log matlab_log$i.log > matlab_log.log.bak
     48        mv matlab_log.log.bak matlab_log.log
     49        rm matlab_log$i.log
    4750
    4851done
    49 
    50 #remove unused lines to deal with a smaller file
    51 cat nightlylong.log | egrep 'difference: |NIGHTLYRUNTERMINATEDCORRECTLY' > nightly.log
    52 rm nightlylong.log
    53 
    54 #remove matlab_run scripts.
    55 rm -rf matlab_run*.m
Note: See TracChangeset for help on using the changeset viewer.