11.1Smrg#! /bin/sh
21.6Smaya# $NetBSD: test-bigfile,v 1.6 2018/12/14 23:57:22 maya 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.3Sschmonz
101.4Smrgtmperr="tmp.$test.err"
111.4Smrg
121.3Sschmonzif [ "yes" = "$verbose" ]; then
131.3Sschmonz	echo "Running test $test"
141.3Sschmonzelse
151.4Smrg	exec 2>"$tmperr"
161.3Sschmonzfi
171.1Smrg
181.1Smrgbozotestport=11111
191.1Smrg
201.1Smrg# copy beginning file
211.4Smrgcp "${datadir}/bigfile.${test}" ./bigfile
221.1Smrg
231.1Smrg# fire up bozohttpd
241.5Smrg${bozohttpd} -b -b -I ${bozotestport} -n -s -f "$@" "${datadir}" "${host}" &
251.1Smrgbozopid=$!
261.1Smrg
271.4Smrg"${wget}" -c http://localhost:${bozotestport}/bigfile
281.1Smrg
291.1Smrgkill -9 $bozopid
301.1Smrg
311.4Smrgif cmp ./bigfile "${datadir}/bigfile"; then
321.1Smrg	rm -f ./bigfile
331.1Smrg	exit 0
341.1Smrgelse
351.1Smrg	rm -f ./bigfile
361.4Smrg	if [ "yes" = "$verbose" ]; then
371.4Smrg		echo "Failed test $test:"
381.4Smrg		cat "$tmperr"
391.4Smrg	fi
401.1Smrg	exit 1
411.1Smrgfi
42