xref: /netbsd-src/external/mpl/dhcp/dist/keama/tests/samples/runone.sh (revision b2c35e17b976cf7ccd7250c86c6f5e95090ed636)
1#!/bin/sh
2
3#set -x
4
5if [ $# -ne 1 ]; then
6	echo "usage: $0 config-name" >&2
7	exit 1
8fi
9
10file=$1
11
12cd "$(dirname "$0")"
13
14trail=$(expr $file : ".*6$")
15options=""
16if [ $trail -eq 0 ]; then
17	options="-4"
18else
19	options="-6"
20fi
21
22out=/tmp/$file.out$$
23
24../../keama $options -N -i  $file.conf -o $out >&2
25status=$?
26if [ $status -eq 255 ]; then
27	echo "$file config raised an error" >&2
28	exit 1
29fi
30
31expected=$file.json
32
33diff --brief $out $expected
34if [ $? -ne 0 ]; then
35	echo "$file config doesn't provide expected output" >&2
36	exit 1
37fi
38
39exit $status
40