test-bigfile revision 1.5
11.1Smrg#! /bin/sh
21.5Smrg# $NetBSD: test-bigfile,v 1.5 2018/11/21 09:37:02 mrg Exp $
31.1Smrg
41.5Smrgtest="$1"; shift	# partial4000 or partial8000
51.5Smrgbozohttpd="$1"; shift
61.5Smrgwget="$1"; shift
71.5Smrgdatadir="$1"; shift
81.5Smrgverbose="$1"; shift
91.5Smrghost="$1"; shift
101.3Sschmonz
111.4Smrgtmperr="tmp.$test.err"
121.4Smrg
131.3Sschmonzif [ "yes" = "$verbose" ]; then
141.3Sschmonz	echo "Running test $test"
151.3Sschmonzelse
161.4Smrg	exec 2>"$tmperr"
171.3Sschmonzfi
181.1Smrg
191.1Smrgbozotestport=11111
201.1Smrg
211.1Smrg# copy beginning file
221.4Smrgcp "${datadir}/bigfile.${test}" ./bigfile
231.1Smrg
241.1Smrg# fire up bozohttpd
251.5Smrg${bozohttpd} -b -b -I ${bozotestport} -n -s -f "$@" "${datadir}" "${host}" &
261.1Smrgbozopid=$!
271.1Smrg
281.4Smrg"${wget}" -c http://localhost:${bozotestport}/bigfile
291.1Smrg
301.1Smrgkill -9 $bozopid
311.1Smrg
321.4Smrgif cmp ./bigfile "${datadir}/bigfile"; then
331.1Smrg	rm -f ./bigfile
341.1Smrg	exit 0
351.1Smrgelse
361.1Smrg	rm -f ./bigfile
371.4Smrg	if [ "yes" = "$verbose" ]; then
381.4Smrg		echo "Failed test $test:"
391.4Smrg		cat "$tmperr"
401.4Smrg	fi
411.1Smrg	exit 1
421.1Smrgfi
43