Changeset 3312 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
Oct 6, 2018 2:15:46 PM (5 years ago)
Author:
knoop
Message:

Added proper exit code to PALM and fixed exit code handling by palmbuild and palmrun

Location:
palm/trunk/SCRIPTS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmbuild

    r3236 r3312  
    100100
    101101
    102 
    103     # ERROR HANDLING
    104     # IN CASE OF EXIT:
     102    # ERROR HANDLING IN CASE OF EXIT
    105103 trap 'rm -rf  ${source_path}/${configuration_identifier}_last_make_protocol
    106        if [[ $locat != normal ]]
    107        then
    108           printf "\n\n +++ palmbuild killed \n\n"
     104       if [[ $locat != normal  &&  $locat != control_c ]]
     105       then
     106          printf "\n\n+++ palmbuild crashed \n\n"
    109107          exit 1
     108       elif [[ $locat != normal ]]
     109       then
     110          printf "\n+++ palmbuild killed by \"^C\" \n\n"
     111          exit 2
    110112       else
    111113          if [[ $silent = false ]]
    112114          then
    113              printf "\n\n *** palmbuild finished \n\n"
     115            printf "\n --> palmbuild finished\n\n"
    114116          fi
    115117          exit 0
    116        fi
    117       ' exit
    118 
    119 
    120     # IN CASE OF TERMINAL-BREAK:
    121  trap 'printf "\n\n +++ palmbuild killed by \"^C\" \n\n"
    122        rm  ${source_path}/${configuration_identifier}_last_make_protocol
    123        exit
     118       fi' exit
     119
     120
     121    # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C):
     122 trap 'locat=control_c
     123       exit 1
    124124      ' 2
    125125
     
    776776          echo "  *** creating utilities on local host"
    777777       fi
    778        make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
    779        mv agent_preprocessing $source_path/../SCRIPTS/.
     778       make  -f Makefile_utilities  $make_options  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options" | tee ${configuration_identifier}_last_make_protocol
     779
     780       if [[ ${PIPESTATUS[0]} != 0 ]]
     781       then
     782          printf "\a\n  +++ error(s) occurred during compiling of the utilities for host configuration \"$configuration_identifier\" "
     783          if [[ $silent = false ]]
     784          then
     785             answer=dummy
     786             printf "\n"
     787             while [[ "$answer" != c  &&  "$answer" != k ]]
     788             do
     789                printf "  >>> continue / list errors / kill palmbuild (c/l/k) ? "
     790                read  answer
     791                if [[ "$answer" = l ]]
     792                then
     793                   more ${configuration_identifier}_last_make_protocol
     794                fi
     795             done
     796             if [[ $answer = k ]]
     797             then
     798                locat=user_abort; exit
     799             fi
     800          else
     801             # ABORT ANYWAY
     802             locat=user_abort; exit
     803          fi
     804       else
     805          cp agent_preprocessing $source_path/../SCRIPTS/.
     806       fi
    780807
    781808
     
    789816       make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"  2>&1 | tee ${configuration_identifier}_last_make_protocol
    790817
    791        if [[ $? != 0 ]]
     818       if [[ ${PIPESTATUS[0]} != 0 ]]
    792819       then
    793820          printf "\a\n  +++ error(s) occurred during compiling or linking for host configuration \"$configuration_identifier\" "
     
    885912          make  $make_options  PROG=$program_name  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$linker_options"
    886913
    887           if [[ $? != 0 ]]
     914          if [[ ${PIPESTATUS[0]} != 0 ]]
    888915          then
    889916
  • palm/trunk/SCRIPTS/palmrun

    r3294 r3312  
    263263          done
    264264          [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $tempdir)
    265           printf "\n\n+++ palmrun killed \n\n"
    266        elif [[ $locat != control_c ]]
    267        then
     265          printf "\n\n+++ palmrun crashed \n\n"
     266          exit 1
     267       elif [[ $locat != normal ]]
     268       then
     269          [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $tempdir)
     270          printf "\n+++ palmrun killed by \"^C\" \n\n"
     271          exit 2
     272       else
    268273          printf "\n --> palmrun finished\n\n"
     274          exit 0
    269275       fi' exit
    270276
    271277
    272278    # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C):
    273  trap 'cd; rm -rf $tempdir
    274        printf "\n+++ palmrun killed by \"^C\" \n\n"
    275        locat=control_c
    276        exit
     279 trap 'locat=control_c
     280       exit 1
    277281      ' 2
    278282
     
    18611865       fi
    18621866
    1863        if [[ $? != 0 ]]
     1867       if [[ ${PIPESTATUS[0]} != 0 ]]
    18641868       then
    18651869   
     
    18771881    palmbuild  -v  $use_existing_sources_folder  -h $configuration_identifier  -d $run_identifier
    18781882
    1879     if [[ $? != 0 ]]
     1883    if [[ ${PIPESTATUS[0]} != 0 ]]
    18801884    then
    18811885
     
    22312235    $execute_command  <  coupling_steering
    22322236
    2233     if [[ $? != 0 ]]
     2237    if [[ ${PIPESTATUS[0]} != 0 ]]
    22342238    then
    22352239
     
    25422546                   batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${configuration_identifier}_${run_identifier}${endout[$i]}  ${extout[$i]}
    25432547                fi
    2544                 [[ $? != 0 ]]  &&  transfer_failed=true
     2548                [[ ${PIPESTATUS[0]} != 0 ]]  &&  transfer_failed=true
    25452549
    25462550
Note: See TracChangeset for help on using the changeset viewer.