summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/test/ipflib.sh
blob: 82d473d0d36bcfac9381bb221f2c9701bf206e44 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# (C)opyright 2012 by Darren Reed.
#
# See the IPFILTER.LICENCE file for details on licencing.
#
test_init() {
	mkdir -p results
	find_touch
	set_core $name 1
}

set_core() {
	if [ -n "${FINDLEAKS}" -a -x /bin/mdb ] ; then
		_findleaks=1
	else
		_findleaks=0
	fi
	if [ -x /bin/coreadm ] ; then
		_cn="$1.$2.core"
		coreadm -p "${PWD}/$_cn"
	else
		_cn=
	fi
}

test_end_leak() {
	if [ $1 -ne 0 ] ; then
		if [ ${_findleaks} = 1 -a -f $_cn ] ; then
			echo "==== ${name}:${n} ====" >> leaktest
			echo '::findleaks' | mdb ../i86/ipftest $_cn >> leaktest
			rm $_cn
		else
			exit 2;
		fi
	fi
}

check_results() {
	cmp expected/$1 results/$1
	status=$?
	if [ $status = 0 ] ; then
		$TOUCH $1
	fi
}

find_touch() {
	if [ -f /bin/touch ] ; then
		TOUCH=/bin/touch
	else
		if [ -f /usr/bin/touch ] ; then
			TOUCH=/usr/bin/touch
		else
			if [ -f /usr/ucb/touch ] ; then
				TOUCH=/usr/ucb/touch
			fi
		fi
	fi
}
OpenPOWER on IntegriCloud