summaryrefslogtreecommitdiff
path: root/libexec/httpd/testsuite/test-bigfile
blob: 943f1806bb5a4154fc340dbb18cec4d2eaac72d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /bin/sh
# $NetBSD: test-bigfile,v 1.6 2018/12/14 23:57:22 maya Exp $

test="$1"; shift	# partial4000 or partial8000
bozohttpd="$1"; shift
wget="$1"; shift
datadir="$1"; shift
verbose="$1"; shift

tmperr="tmp.$test.err"

if [ "yes" = "$verbose" ]; then
	echo "Running test $test"
else
	exec 2>"$tmperr"
fi

bozotestport=11111

# copy beginning file
cp "${datadir}/bigfile.${test}" ./bigfile

# fire up bozohttpd
${bozohttpd} -b -b -I ${bozotestport} -n -s -f "$@" "${datadir}" "${host}" &
bozopid=$!

"${wget}" -c http://localhost:${bozotestport}/bigfile

kill -9 $bozopid

if cmp ./bigfile "${datadir}/bigfile"; then
	rm -f ./bigfile
	exit 0
else
	rm -f ./bigfile
	if [ "yes" = "$verbose" ]; then
		echo "Failed test $test:"
		cat "$tmperr"
	fi
	exit 1
fi