Changeset 23732


Ignore:
Timestamp:
02/15/19 14:01:14 (6 years ago)
Author:
jdquinn
Message:

CHG: Catching Python errors by searching log for “Traceback”

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/jenkins/jenkins.sh

    r23375 r23732  
    11#!/bin/bash
    2 #This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
     2#This bash script calls the nightlyrun.m matlab file to run our nightly test decks.
    33#It then processes the results and sends an email to the Ice developpers.
    44
     
    2424        echo "File $1 not found!" >&2   # Error message to stderr.
    2525        exit 1
    26 fi 
     26fi
    2727
    2828#Defaults (to avoid -eq: unary operator expected)
     
    3737#Get Operating system (OS) name{{{
    3838OS=$(uname -s)
    39 if [[ $OS == CYGWIN* ]]; then 
     39if [[ $OS == CYGWIN* ]]; then
    4040        OS="win";
    4141fi
     
    121121#Install external packages    (ISSM_EXTERNALPACKAGES){{{
    122122
    123 #number of packages: 
     123#number of packages:
    124124NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
    125125
     
    190190fi
    191191
    192 # Source here to include any newly installed externalpackages on the path. 
     192# Source here to include any newly installed externalpackages on the path.
    193193source $ISSM_DIR/etc/environment.sh
    194194
     
    220220                make distclean
    221221                ./scripts/automakererun.sh
    222                 if [ $? -ne 0 ]; then 
     222                if [ $? -ne 0 ]; then
    223223                        echo "autoreconf failed!"
    224224                        exit 1
    225225                fi
    226226                eval "./configure $ISSM_CONFIG"
    227                 if [ $? -ne 0 ]; then 
     227                if [ $? -ne 0 ]; then
    228228                        echo "ISSM configuration failed (see options below)"
    229229                        echo $ISSM_CONFIG
     
    243243                make
    244244        fi
    245         if [ $? -ne 0 ] && [ $NUMCPUS_INSTALL -gt 1 ]; then 
     245        if [ $? -ne 0 ] && [ $NUMCPUS_INSTALL -gt 1 ]; then
    246246                echo " "
    247247                echo "Compilation failed, trying to compile with only one thread"
     
    249249                make
    250250        fi
    251         if [ $? -ne 0 ]; then 
     251        if [ $? -ne 0 ]; then
    252252                echo "ISSM_COMPILATION failed!"
    253253                exit 1
     
    263263#}}}
    264264
    265 #Restore CXX/CC to their previous values 
     265#Restore CXX/CC to their previous values
    266266export CXX=$CXX_PREVIOUS
    267267export CC=$CC_PREVIOUS
     
    344344done
    345345
    346 #filter out windows characters: 
     346#filter out windows characters:
    347347cat matlab_log.log | tr -cd '\11\12\40-\176' > matlab_log.log2 && mv matlab_log.log2 matlab_log.log
    348348fi
     
    353353if [ $PYTHON_TEST -eq 1 ]; then
    354354#Launch all tests on different cpus
     355#export PYTHONPATH="$ISSM_DIR/src/m/dev"
    355356export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
    356357export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured
     
    380381        cat python_log$i.log >> python_log.log
    381382done
     383fi
     384
     385# Check that Python did not exit in error
     386exitedInError=`grep "Traceback" python_log.log | wc -l`
     387
     388if [ $exitedInError -ne 0 ]
     389then
     390        echo "Python error!"
     391        cat python_log.log
     392        echo "FAILURE"
     393        exit 1
    382394fi
    383395# }}}
     
    413425                                $SED -i.bak 's/steps=\[1\];/steps=\[1:8\];\n\ntry\n/' $FILE
    414426                                $SED -i.bak "s/if any(steps==8)/&${STEP_EIGHT}/" $FILE
    415                         elif [ "${dir}" == "./IceBridge" ];     
     427                        elif [ "${dir}" == "./IceBridge" ];
    416428                        then
    417429                                $SED -i.bak 's/steps=\[1\];/steps=\[1:5\];\n\ntry\n/' $FILE
    418                         elif [ "${dir}" == "./IceflowModels" ]; 
     430                        elif [ "${dir}" == "./IceflowModels" ];
    419431                        then
    420432                                # Almost nothing to this example
    421433                                $SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
    422                         elif [ "${dir}" == "./ISMIP" ]; 
     434                        elif [ "${dir}" == "./ISMIP" ];
    423435                        then
    424436                                # Eight steps... none of which are implmented in the script...
    425437                                $SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
    426                         elif [ "${dir}" == "./Inversion" ];     
     438                        elif [ "${dir}" == "./Inversion" ];
    427439                        then
    428440                                $SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
    429                         elif [ "${dir}" == "./Jakobshavn" ];   
     441                        elif [ "${dir}" == "./Jakobshavn" ];
    430442                        then
    431443                                $SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
    432                         elif [ "${dir}" == "./Jakobshavn" ];   
     444                        elif [ "${dir}" == "./Jakobshavn" ];
    433445                        then
    434446                                $SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
    435                         elif [ "${dir}" == "./Pig" ];   
     447                        elif [ "${dir}" == "./Pig" ];
    436448                        then
    437449                                # Step 6 is needed
     
    439451                                $SED -i.bak 's/steps=\[1\];/steps=\[1:7\];\n!mv DomainOutline.bkp DomainOutline.exp;\n\ntry\n/' $FILE
    440452                                $SED -i.bak "s/if any(steps==6)/&${STEP_SIX}/" $FILE
    441                         elif [ "${dir}" == "./PigSensitivity" ];       
     453                        elif [ "${dir}" == "./PigSensitivity" ];
    442454                        then
    443455                                # Step 4 is needed
     
    445457                                $SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
    446458                                $SED -i.bak "s/if any(steps==6)/&${STEP_FOUR}/" $FILE
    447                         elif [ "${dir}" == "./SquareIceShelf" ];       
     459                        elif [ "${dir}" == "./SquareIceShelf" ];
    448460                        then
    449461                                # Almost nothing to this example
    450462                                $SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
    451                         elif [ "${dir}" == "./UncertaintyQuantification" ];     
     463                        elif [ "${dir}" == "./UncertaintyQuantification" ];
    452464                        then
    453465                                $SED -i.bak 's/steps=\[1\];/steps=\[1:7\];\n\ntry\n/' $FILE
    454                         elif [ "${dir}" == "./Data" ]; 
     466                        elif [ "${dir}" == "./Data" ];
    455467                        then
    456468                                echo "Data directory is used by examples. No modifications required."
Note: See TracChangeset for help on using the changeset viewer.