Diff for /embedaddon/miniupnpc/testminiwget.sh between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:16:22 version 1.1.1.2, 2013/07/22 00:36:10
Line 1 Line 1
 #!/bin/sh  #!/bin/sh
 # $Id$  # $Id$
 # project miniupnp : http://miniupnp.free.fr/  # project miniupnp : http://miniupnp.free.fr/
(c) 2011 Thomas Bernard# (c) 2011-2012 Thomas Bernard
 #  #
 # test program for miniwget.c  # test program for miniwget.c
 # is usually invoked by "make check"  # is usually invoked by "make check"
Line 12 Line 12
 #  3 - compares served and received data  #  3 - compares served and received data
 #  4 - kills the local HTTP server and exits  #  4 - kills the local HTTP server and exits
 #  #
   # The script was tested and works with ksh, bash
   # It fails to run with dash 0.5.5.1 because of "kill %1"
   
HTTPSERVEROUT=/tmp/httpserveroutTMPDIR=`mktemp -d`
EXPECTEDFILE=/tmp/expectedfileHTTPSERVEROUT="${TMPDIR}/httpserverout"
DOWNLOADEDFILE=/tmp/downloadedfileEXPECTEDFILE="${TMPDIR}/expectedfile"
#ADDR=localhostDOWNLOADEDFILE="${TMPDIR}/downloadedfile"
ADDR="[::1]" 
 PORT=  PORT=
 RET=0  RET=0
   
   case "$HAVE_IPV6" in
       n|no|0)
           ADDR=localhost
           SERVERARGS=""
           ;;
       *)
           ADDR="[::1]"
           SERVERARGS="-6"
           ;;
   
   esac
   
 #make minihttptestserver  #make minihttptestserver
 #make testminiwget  #make testminiwget
   
 # launching the test HTTP server  # launching the test HTTP server
./minihttptestserver -6 -e $EXPECTEDFILE > $HTTPSERVEROUT &./minihttptestserver $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT &
while [ "$PORT" == "" ]; dowhile [ -z "$PORT" ]; do
         sleep 1
         PORT=`cat $HTTPSERVEROUT | sed 's/Listening on port \([0-9]*\)/\1/' `          PORT=`cat $HTTPSERVEROUT | sed 's/Listening on port \([0-9]*\)/\1/' `
 done  done
 echo "Test HTTP server is listening on $PORT"  echo "Test HTTP server is listening on $PORT"
Line 72  if [ $RET -eq 0 ]; then Line 86  if [ $RET -eq 0 ]; then
         rm -f "${DOWNLOADEDFILE}.2"          rm -f "${DOWNLOADEDFILE}.2"
         rm -f "${DOWNLOADEDFILE}.3"          rm -f "${DOWNLOADEDFILE}.3"
         rm -f $EXPECTEDFILE $HTTPSERVEROUT          rm -f $EXPECTEDFILE $HTTPSERVEROUT
           rmdir ${TMPDIR}
 else  else
         echo "at least one of the test FAILED"          echo "at least one of the test FAILED"
           echo "directory ${TMPDIR} is left intact"
 fi  fi
 exit $RET  exit $RET
   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>