freebsd-dev/tools/regression/sockets/unix_cmsg/unix_cmsg.t
Sergey Kandaurov b57181586c Major update for unix_cmsg from Andrey Simonenko.
Quoting the submitter:
- Added tests for SCM_BINTIME, LOCAL_PEERCRED, cmsghdr.cmsg_len
- Code that checks correctness of groups was corrected (getgroups(2) change)
- unix_cmsg.c was completely redesigned and simplified
- Use less timeout value in unix_cmsg.c for faster work
- Added support for not sending data in a message, not sending data and
  data array associated with a cmsghdr structure in a message
- Existent tests were improved
- unix_cmsg.t was redesigned and simplified

Correctness of unix_cmsg verified on 7.1-STABLE, 9.1-STABLE and 10-CURRENT.

PR:		bin/131567
Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
MFC after:	2 weeks
2013-02-11 12:56:23 +00:00

89 lines
1.5 KiB
Bash

#!/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