xref: /netbsd-src/external/mpl/dhcp/dist/keama/tests/checkone.sh (revision 154bfe8e089c1a0a4e9ed8414f08d3da90949162)
1#!/bin/sh
2
3#set -x
4
5if [ $# -ne 1 ]; then
6	echo "usage: $0 test-name" >&2
7	exit 1
8fi
9
10if [ x$KEA4 = x ]; then
11	echo "KEA4 is not set" >&2
12fi
13if [ x$KEA6 = x ]; then
14	echo "KEA6 is not set" >&2
15fi
16
17file=$1
18
19cd "$(dirname "$0")"
20
21isout=$(expr $file : ".*\.out")
22if [ $isout -eq 0 ]; then
23	full=$file.out
24else
25	full=$file
26fi
27if [ ! -f $full ]; then
28	echo "can't find $file" >&2
29	exit 1
30fi
31
32is4=$(expr $file : ".*4")
33is6=$(expr $file : ".*6")
34if [ \( $is4 -eq 0 \) -a \( $is6 -eq 0 \) ]; then
35	echo "can't get version from $file" >&2
36	exit 1
37fi
38
39base=$(basename $full .out)
40log=/tmp/$base.log$$
41if [ $is4 -ne 0 ]; then
42	$KEA4 -t $full >& $log
43	if [ $? -ne 0 ]; then
44		echo "$full raised an error" >&2
45		exit 1
46	fi
47fi
48if [ $is6 -ne 0 ]; then
49	$KEA6 -t $full >& $log
50	if [ $? -ne 0 ]; then
51		echo "$full raised an error" >&2
52		exit 1
53	fi
54fi
55