liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

test-helpers.sh (397B)


      1 killpid(){
      2   if test -e $1 && test -d /proc/`cat $1` ; then
      3     pid=$(cat $1)
      4     kill $pid
      5   fi
      6 }
      7 
      8 cleanup(){
      9   killpid $serverstatedir/pid
     10   test -n "$MPLCONFIGDIR" && test -d "$MPLCONFIGDIR" && rm -rf "$MPLCONFIGDIR"
     11   killpid foo.pid
     12   killpid ./vm/pid
     13 }
     14 trap cleanup EXIT
     15 
     16 fatal(){
     17   err=$?
     18   echo "FAIL: command $(eval echo $BASH_COMMAND) exited with code $err"
     19   exit $err
     20 }
     21 trap fatal ERR