Home | History | Annotate | Line # | Download | only in testsuite
test-bigfile revision 1.5
      1 #! /bin/sh
      2 # $NetBSD: test-bigfile,v 1.5 2018/11/21 09:37:02 mrg Exp $
      3 
      4 test="$1"; shift	# partial4000 or partial8000
      5 bozohttpd="$1"; shift
      6 wget="$1"; shift
      7 datadir="$1"; shift
      8 verbose="$1"; shift
      9 host="$1"; shift
     10 
     11 tmperr="tmp.$test.err"
     12 
     13 if [ "yes" = "$verbose" ]; then
     14 	echo "Running test $test"
     15 else
     16 	exec 2>"$tmperr"
     17 fi
     18 
     19 bozotestport=11111
     20 
     21 # copy beginning file
     22 cp "${datadir}/bigfile.${test}" ./bigfile
     23 
     24 # fire up bozohttpd
     25 ${bozohttpd} -b -b -I ${bozotestport} -n -s -f "$@" "${datadir}" "${host}" &
     26 bozopid=$!
     27 
     28 "${wget}" -c http://localhost:${bozotestport}/bigfile
     29 
     30 kill -9 $bozopid
     31 
     32 if cmp ./bigfile "${datadir}/bigfile"; then
     33 	rm -f ./bigfile
     34 	exit 0
     35 else
     36 	rm -f ./bigfile
     37 	if [ "yes" = "$verbose" ]; then
     38 		echo "Failed test $test:"
     39 		cat "$tmperr"
     40 	fi
     41 	exit 1
     42 fi
     43