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