xref: /netbsd-src/libexec/httpd/testsuite/test-simple (revision cc576e1d8e4f4078fd4e81238abca9fca216f6ec)
1#! /bin/sh
2# $NetBSD: test-simple,v 1.4 2017/01/31 14:33:54 mrg Exp $
3
4test="$1"; shift
5bozohttpd="$1"; shift
6datadir="$1"; shift
7curdir="$1"; shift
8verbose="$1"; shift
9
10in="$curdir/$test.in"
11out="$curdir/$test.out"
12tmpout="tmp.$test.out"
13tmperr="tmp.$test.err"
14
15if [ "yes" = "$verbose" ]; then
16	echo "Running test $test"
17else
18	exec 2>"$tmperr"
19fi
20
21bozotestport=11111
22
23${bozohttpd} "$@" "${datadir}" < "$in" > "$tmpout"
24if "$curdir/html_cmp" cmp "$out" "$tmpout"; then
25	exit 0
26else
27	if [ "yes" = "$verbose" ]; then
28		echo "Failed test $test:"
29		cat "$tmperr"
30		$curdir/html_cmp diff "$out" "$tmpout"
31	fi
32	exit 1
33fi
34