unix_cmsg.t revision 246670
1159045Smaxim#!/bin/sh 2159045Smaxim# $FreeBSD: head/tools/regression/sockets/unix_cmsg/unix_cmsg.t 246670 2013-02-11 12:56:23Z pluknet $ 3159045Smaxim 4159045Smaximcd `dirname $0` 5159045Smaximcmd="./`basename $0 .t`" 6159045Smaxim 7159045Smaximmake ${cmd} >/dev/null 2>&1 8159045Smaxim 9159045SmaximIFS= 10159045Smaximn=0 11159045Smaxim 12159045Smaximrun() 13159045Smaxim{ 14246670Spluknet result=`${cmd} -t $2 $3 ${5%% *} 2>&1` 15246670Spluknet if [ $? -ne 0 ]; then 16246670Spluknet echo -n "not " 17159045Smaxim fi 18246670Spluknet echo "ok $1 - $4 ${5#* }" 19159045Smaxim echo ${result} | grep -E "SERVER|CLIENT" | while read line; do 20159045Smaxim echo "# ${line}" 21159045Smaxim done 22159045Smaxim} 23159045Smaxim 24246670Spluknetecho "1..47" 25159045Smaxim 26246670Spluknetfor t1 in \ 27246670Spluknet "1 Sending, receiving cmsgcred" \ 28246670Spluknet "4 Sending cmsgcred, receiving sockcred" \ 29246670Spluknet "5 Sending, receiving timeval" \ 30246670Spluknet "6 Sending, receiving bintime" \ 31246670Spluknet "7 Check cmsghdr.cmsg_len" 32159045Smaximdo 33246670Spluknet for t2 in \ 34246670Spluknet "0 " \ 35246670Spluknet "1 (no data)" \ 36246670Spluknet "2 (no array)" \ 37246670Spluknet "3 (no data, array)" 38246670Spluknet do 39246670Spluknet n=$((n + 1)) 40246670Spluknet run ${n} stream "-z ${t2%% *}" STREAM "${t1} ${t2#* }" 41246670Spluknet done 42159045Smaximdone 43159045Smaxim 44246670Spluknetfor t1 in \ 45246670Spluknet "2 Receiving sockcred (listening socket)" \ 46246670Spluknet "3 Receiving sockcred (accepted socket)" 47159045Smaximdo 48246670Spluknet for t2 in \ 49246670Spluknet "0 " \ 50246670Spluknet "1 (no data)" 51246670Spluknet do 52246670Spluknet n=$((n + 1)) 53246670Spluknet run ${n} stream "-z ${t2%% *}" STREAM "${t1} ${t2#* }" 54246670Spluknet done 55159045Smaximdone 56159045Smaxim 57246670Spluknetn=$((n + 1)) 58246670Spluknetrun ${n} stream "-z 0" STREAM "8 Check LOCAL_PEERCRED socket option" 59159045Smaxim 60246670Spluknetfor t1 in \ 61246670Spluknet "1 Sending, receiving cmsgcred" \ 62246670Spluknet "3 Sending cmsgcred, receiving sockcred" \ 63246670Spluknet "4 Sending, receiving timeval" \ 64246670Spluknet "5 Sending, receiving bintime" \ 65246670Spluknet "6 Check cmsghdr.cmsg_len" 66246670Spluknetdo 67246670Spluknet for t2 in \ 68246670Spluknet "0 " \ 69246670Spluknet "1 (no data)" \ 70246670Spluknet "2 (no array)" \ 71246670Spluknet "3 (no data, array)" 72246670Spluknet do 73246670Spluknet n=$((n + 1)) 74246670Spluknet run ${n} dgram "-z ${t2%% *}" DGRAM "${t1} ${t2#* }" 75246670Spluknet done 76246670Spluknetdone 77246670Spluknet 78246670Spluknetfor t1 in \ 79246670Spluknet "2 Receiving sockcred" 80246670Spluknetdo 81246670Spluknet for t2 in \ 82246670Spluknet "0 " \ 83246670Spluknet "1 (no data)" 84246670Spluknet do 85246670Spluknet n=$((n + 1)) 86246670Spluknet run ${n} dgram "-z ${t2%% *}" DGRAM "${t1} ${t2#* }" 87246670Spluknet done 88246670Spluknetdone 89