summaryrefslogtreecommitdiffstats
path: root/tools/regression/sockets/unix_cmsg/unix_cmsg.t
blob: 70d92770d6e4afbb1a5187e856b0e8a5b9a65e49 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
# $FreeBSD$

cd `dirname $0`
cmd="./`basename $0 .t`"

make ${cmd} >/dev/null 2>&1

IFS=
n=0

run()
{
	result=`${cmd} -t $2 $3 ${5%% *} 2>&1`
	if [ $? -ne 0 ]; then
		echo -n "not "
	fi
	echo "ok $1 - $4 ${5#* }"
	echo ${result} | grep -E "SERVER|CLIENT" | while read line; do
		echo "# ${line}"
	done
}

echo "1..47"

for t1 in \
	"1 Sending, receiving cmsgcred" \
	"4 Sending cmsgcred, receiving sockcred" \
	"5 Sending, receiving timeval" \
	"6 Sending, receiving bintime" \
	"7 Check cmsghdr.cmsg_len"
do
	for t2 in \
		"0 " \
		"1 (no data)" \
		"2 (no array)" \
		"3 (no data, array)"
	do
		n=$((n + 1))
		run ${n} stream "-z ${t2%% *}" STREAM "${t1} ${t2#* }"
	done
done

for t1 in \
	"2 Receiving sockcred (listening socket)" \
	"3 Receiving sockcred (accepted socket)"
do
	for t2 in \
		"0 " \
		"1 (no data)"
	do
		n=$((n + 1))
		run ${n} stream "-z ${t2%% *}" STREAM "${t1} ${t2#* }"
	done
done

n=$((n + 1))
run ${n} stream "-z 0" STREAM "8 Check LOCAL_PEERCRED socket option"

for t1 in \
	"1 Sending, receiving cmsgcred" \
	"3 Sending cmsgcred, receiving sockcred" \
	"4 Sending, receiving timeval" \
	"5 Sending, receiving bintime" \
	"6 Check cmsghdr.cmsg_len"
do
	for t2 in \
		"0 " \
		"1 (no data)" \
		"2 (no array)" \
		"3 (no data, array)"
	do
		n=$((n + 1))
		run ${n} dgram "-z ${t2%% *}" DGRAM "${t1} ${t2#* }"
	done
done

for t1 in \
	"2 Receiving sockcred"
do
	for t2 in \
		"0 " \
		"1 (no data)"
	do
		n=$((n + 1))
		run ${n} dgram "-z ${t2%% *}" DGRAM "${t1} ${t2#* }"
	done
done
OpenPOWER on IntegriCloud