From 2e5a6400a3dfe518eaf76b4382dba10a16ac76c6 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Fri, 21 Mar 2014 08:55:56 +0100 Subject: [PATCH] improved test.sh script --- CHANGES | 2 + test.sh | 811 ++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 528 insertions(+), 285 deletions(-) diff --git a/CHANGES b/CHANGES index 81095b5..c1a754e 100644 --- a/CHANGES +++ b/CHANGES @@ -97,6 +97,8 @@ corrections: porting: Performed changes for Fedora release 19 + Adapted, improved test.sh script + Cedril Priscal ported socat to Android (using Googles cross compiler). The port includes the socat_buildscript_for_android.sh script diff --git a/test.sh b/test.sh index e009c70..885ec2f 100755 --- a/test.sh +++ b/test.sh @@ -18,9 +18,9 @@ while [ "$1" ]; do case "X$1" in X-t?*) val_t="${1#-t}" ;; X-t) shift; val_t="$1" ;; - X-n?*) NUMCOND="test \$N -eq ${1#-t}" ;; + X-n?*) NUMCOND="test \$N -eq ${1#-n}" ;; X-n) shift; NUMCOND="test \$N -eq $1" ;; - X-N?*) NUMCOND="test \$N -gt ${1#-t}" ;; + X-N?*) NUMCOND="test \$N -gt ${1#-N}" ;; X-N) shift; NUMCOND="test \$N -ge $1" ;; *) break; esac @@ -59,7 +59,12 @@ export SOCAT_OPTS="$opts" #debug="1" debug= TESTS="$@"; export TESTS -INTERFACE=eth0; # not used for function tests +# for some tests we need a network interface +if type ip >/dev/null 2>&1; then + INTERFACE=$(ip r get 8.8.8.8 |grep ' dev ' |head -n 1 |sed "s/.*dev[[:space:]][[:space:]]*\([^[:space:]][^[:space:]]*\).*/\1/") +else + INTERFACE=eth0 +fi MCINTERFACE=lo # !!! Linux only #LOCALHOST=192.168.58.1 #LOCALHOST=localhost @@ -135,6 +140,13 @@ case "$UNAME" in ;; esac +# for some tests we need an unprivileged user id to su to +if [ "$SUDO_USER" ]; then + SUBSTUSER="$SUDO_USER" +else + SUBSTUSER="$(grep -v '^[^:]*:^[^:]*:0:' /etc/passwd |tail -n 1 |cut -d: -f1)" +fi + # non-root users might miss ifconfig in their path case "$UNAME" in AIX) IFCONFIG=/usr/sbin/ifconfig ;; @@ -1504,6 +1516,7 @@ N=1 numOK=0 numFAIL=0 numCANT=0 +listFAIL= #============================================================================== # test if selected socat features work ("FUNCTIONS") @@ -1536,6 +1549,7 @@ testecho () { echo "$SOCAT $opts $arg1 $arg2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo "$da" |diff - "$tf" >"$tdiff" 2>&1; then $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -1547,6 +1561,7 @@ testecho () { echo diff: cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND set +vx @@ -1576,6 +1591,7 @@ testchain () { echo "$SOCAT $opts $arg1 $arg2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo -e "$da\n$suffix\c" |diff - "$tf" >"$tdiff" 2>&1; then $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -1587,6 +1603,7 @@ testchain () { echo diff: cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND } @@ -1616,6 +1633,7 @@ testod () { echo "$SOCAT $opts $arg1 $arg2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" # elif echo "$daout" |diff - "$tf" >"$tdiff" 2>&1; then elif diff "$tr" "$tf" >"$tdiff" 2>&1; then $PRINTF "$OK\n" @@ -1627,6 +1645,7 @@ testod () { cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND } @@ -2201,7 +2220,7 @@ gentestdsacert () { NAME=UNISTDIO case "$TESTS " in -*%functions%*|*%stdio%*|*%$NAME%*) +*%$N%*|*%functions%*|*%stdio%*|*%$NAME%*) TEST="$NAME: unidirectional throughput from stdin to stdout" testecho "$N" "$TEST" "stdin" "stdout" "$opts -u" esac @@ -2210,7 +2229,7 @@ N=$((N+1)) NAME=UNPIPESTDIO case "$TESTS" in -*%functions%*|*%stdio%*|*%$NAME%*) +*%$N%*|*%functions%*|*%stdio%*|*%$NAME%*) TEST="$NAME: stdio with simple echo via internal pipe" testecho "$N" "$TEST" "stdio" "pipe" "$opts" esac @@ -2219,7 +2238,7 @@ N=$((N+1)) NAME=UNPIPESHORT case "$TESTS" in -*%functions%*|*%stdio%*|*%$NAME%*) +*%$N%*|*%functions%*|*%stdio%*|*%$NAME%*) TEST="$NAME: short form of stdio ('-') with simple echo via internal pipe" testecho "$N" "$TEST" "-" "pipe" "$opts" esac @@ -2228,7 +2247,7 @@ N=$((N+1)) NAME=DUALSTDIO case "$TESTS" in -*%functions%*|*%stdio%*|*%$NAME%*) +*%$N%*|*%functions%*|*%stdio%*|*%$NAME%*) TEST="$NAME: splitted form of stdio ('stdout%stdin') with simple echo via internal pipe" testecho "$N" "$TEST" "stdout%stdin" "pipe" "$opts" esac @@ -2237,7 +2256,7 @@ N=$((N+1)) NAME=DUALSHORTSTDIO case "$TESTS" in -*%functions%*|*%stdio%*|*%$NAME%*) +*%$N%*|*%functions%*|*%stdio%*|*%$NAME%*) TEST="$NAME: short splitted form of stdio ('-%-') with simple echo via internal pipe" testecho "$N" "$TEST" "-%-" "pipe" "$opts" esac @@ -2246,7 +2265,7 @@ N=$((N+1)) NAME=DUALFDS case "$TESTS" in -*%functions%*|*%fd%*|*%$NAME%*) +*%$N%*|*%functions%*|*%fd%*|*%$NAME%*) TEST="$NAME: file descriptors with simple echo via internal pipe" testecho "$N" "$TEST" "1%0" "pipe" "$opts" esac @@ -2255,7 +2274,7 @@ N=$((N+1)) NAME=NAMEDPIPE case "$TESTS" in -*%functions%*|*%pipe%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pipe%*|*%$NAME%*) TEST="$NAME: simple echo via named pipe" # with MacOS, this test hangs if nonblock is not used. Is an OS bug. tp="$td/pipe$N" @@ -2268,7 +2287,7 @@ N=$((N+1)) # does not work with % #NAME=DUALPIPE #case "$TESTS" in -#*%functions%*|*%pipe%*|*%$NAME%*) +#*%$N%*|*%functions%*|*%pipe%*|*%$NAME%*) #TEST="$NAME: simple echo via named pipe, specified twice" #tp="$td/pipe$N" #testecho "$N" "$TEST" "" "pipe:$tp%pipe:$tp,nonblock" "$opts" @@ -2278,7 +2297,7 @@ N=$((N+1)) NAME=FILE case "$TESTS" in -*%functions%*|*%engine%*|*%file%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%file%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: simple echo via file" tf="$td/file$N" testecho "$N" "$TEST" "" "$tf%$tf,ignoreeof" "$opts" @@ -2295,7 +2314,7 @@ do exec="$(echo $EXEC |tr A-Z a-z)" NAME=${EXEC}$COMMTYPE case "$TESTS" in -*%functions%*|*%$commtype%*|*%$exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$commtype%*|*%$exec%*|*%$NAME%*) TEST="$NAME: simple echo via $exec() of cat using $commtype" if ! eval $NUMCOND; then :; elif [ "$feature" != . ] && ! testaddrs $feature >/dev/null; then @@ -2322,7 +2341,7 @@ socketpairs . NAME=SYSTEMPIPESFDS case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: simple echo via system() of cat with pipes, non stdio" testecho "$N" "$TEST" "" "system:$CAT>&9 <&8,pipes,fdin=8,fdout=9" "$opts" esac @@ -2331,7 +2350,7 @@ N=$((N+1)) NAME=DUALSYSTEMFDS case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: echo via dual system() of cat" #testecho "$N" "$TEST" "system:$CAT<&7,fdin=7%system:'strace -tt -o /tmp/cat.out cat'>&6,fdout=6" "" "$opts" "$T" testecho "$N" "$TEST" "system:$CAT<&7,fdin=7%system:'cat'>&6,fdout=6" "" "$opts" "0.1" "$val_t" @@ -2345,7 +2364,7 @@ NAME=EXECSOCKETFLUSH # idea: have socat exec'ing od; send data and EOF, and check if the od'ed data # arrives. case "$TESTS" in -*%functions%*|*%exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%exec%*|*%$NAME%*) TEST="$NAME: call to od via exec with socketpair" testod "$N" "$TEST" "" "exec:$OD_C" "$opts" "0.1" esac @@ -2354,7 +2373,7 @@ N=$((N+1)) NAME=SYSTEMSOCKETFLUSH case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: call to od via system() with socketpair" testod "$N" "$TEST" "" "system:$OD_C" "$opts" $val_t esac @@ -2363,7 +2382,7 @@ N=$((N+1)) NAME=EXECPIPESFLUSH case "$TESTS" in -*%functions%*|*%exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%exec%*|*%$NAME%*) TEST="$NAME: call to od via exec with pipes" testod "$N" "$TEST" "" "exec:$OD_C,pipes" "$opts" esac @@ -2372,7 +2391,7 @@ N=$((N+1)) NAME=SYSTEMPIPESFLUSH case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: call to od via system() with pipes" testod "$N" "$TEST" "" "system:$OD_C,pipes" "$opts" "$val_t" esac @@ -2382,7 +2401,7 @@ N=$((N+1)) ## LATER: #NAME=EXECPTYFLUSH #case "$TESTS" in -#*%functions%*|*%exec%*|*%pty%*|*%$NAME%*) +#*%$N%*|*%functions%*|*%exec%*|*%pty%*|*%$NAME%*) #TEST="$NAME: call to od via exec with pseudo terminal" #if ! testaddrs pty >/dev/null; then # $PRINTF "test $F_n $TEST... ${YELLOW}PTY not available${NORMAL}\n" $N @@ -2397,7 +2416,7 @@ N=$((N+1)) ## LATER: #NAME=SYSTEMPTYFLUSH #case "$TESTS" in -#*%functions%*|*%system%*|*%pty%*|*%$NAME%*) +#*%$N%*|*%functions%*|*%system%*|*%pty%*|*%$NAME%*) #TEST="$NAME: call to od via system() with pseudo terminal" #if ! testaddrs pty >/dev/null; then # $PRINTF "test $F_n $TEST... ${YELLOW}PTY not available${NORMAL}\n" $N @@ -2411,7 +2430,7 @@ N=$((N+1)) NAME=SYSTEMPIPESFDSFLUSH case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: call to od via system() with pipes, non stdio" testod "$N" "$TEST" "" "system:$OD_C>&9 <&8,pipes,fdin=8,fdout=9" "$opts" "$val_t" esac @@ -2420,7 +2439,7 @@ N=$((N+1)) NAME=DUALSYSTEMFDSFLUSH case "$TESTS" in -*%functions%*|*%system%*|*%$NAME%*) +*%$N%*|*%functions%*|*%system%*|*%$NAME%*) TEST="$NAME: call to od via dual system()" testod "$N" "$TEST" "system:$CAT<&7,fdin=7%system:$OD_C>&6,fdout=6" "pipe" "$opts" "$val_t" esac @@ -2435,7 +2454,7 @@ esac NAME=RAWIP4SELF case "$TESTS" in -*%functions%*|*%ip4%*|*%rawip%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%rawip%*|*%root%*|*%$NAME%*) TEST="$NAME: simple echo via self receiving raw IPv4 protocol" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4) || ! runsip4 >/dev/null; then @@ -2455,7 +2474,7 @@ N=$((N+1)) NAME=RAWIPX4SELF case "$TESTS" in -*%functions%*|*%ip4%*|*%rawip%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%rawip%*|*%root%*|*%$NAME%*) TEST="$NAME: simple echo via self receiving raw IP protocol, v4 by target" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4) || ! runsip4 >/dev/null; then @@ -2475,7 +2494,7 @@ N=$((N+1)) NAME=RAWIP6SELF case "$TESTS" in -*%functions%*|*%ip6%*|*%rawip%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%rawip%*|*%root%*|*%$NAME%*) TEST="$NAME: simple echo via self receiving raw IPv6 protocol" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6) || ! runsip6 >/dev/null; then @@ -2495,7 +2514,7 @@ N=$((N+1)) NAME=RAWIPX6SELF case "$TESTS" in -*%functions%*|*%ip%*|*%ip6%*|*%rawip%*|*%rawip6%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip%*|*%ip6%*|*%rawip%*|*%rawip6%*|*%root%*|*%$NAME%*) TEST="$NAME: simple echo via self receiving raw IP protocol, v6 by target" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6) || ! runsip6 >/dev/null; then @@ -2516,7 +2535,7 @@ N=$((N+1)) NAME=TCPSELF case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: echo via self connection of TCP IPv4 socket" if ! eval $NUMCOND; then :; elif [ "$UNAME" != Linux ]; then @@ -2535,7 +2554,7 @@ N=$((N+1)) NAME=UDPSELF if ! eval $NUMCOND; then :; else case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: echo via self connection of UDP IPv4 socket" if [ "$UNAME" != Linux ]; then $PRINTF "test $F_n $TEST... ${YELLOW}only on Linux$NORMAL\n" $N @@ -2551,7 +2570,7 @@ N=$((N+1)) NAME=UDP6SELF case "$TESTS" in -*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: echo via self connection of UDP IPv6 socket" if ! eval $NUMCOND; then :; elif [ "$UNAME" != Linux ]; then @@ -2572,7 +2591,7 @@ N=$((N+1)) NAME=DUALUDPSELF if ! eval $NUMCOND; then :; else case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: echo via two unidirectional UDP IPv4 sockets" tf="$td/file$N" p1=$PORT @@ -2592,7 +2611,7 @@ N=$((N+1)) NAME=UNIXSTREAM if ! eval $NUMCOND; then :; else case "$TESTS" in -*%functions%*|*%unix%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%$NAME%*) TEST="$NAME: echo via connection to UNIX domain socket" tf="$td/test$N.stdout" te="$td/test$N.stderr" @@ -2612,10 +2631,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2630,7 +2651,7 @@ N=$((N+1)) NAME=TCP4 if ! eval $NUMCOND; then :; else case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP V4 socket" tf="$td/test$N.stdout" te="$td/test$N.stderr" @@ -2652,10 +2673,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2671,7 +2694,7 @@ N=$((N+1)) NAME=TCP6 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP V6 socket" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip6 >/dev/null || ! runsip6 >/dev/null; then @@ -2697,9 +2720,11 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" + listFAIL="$listFAIL $N" numFAIL=$((numFAIL+1)) else $PRINTF "$OK\n" @@ -2715,7 +2740,7 @@ N=$((N+1)) NAME=TCPX4 case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP socket, v4 by target" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2744,10 +2769,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2762,7 +2789,7 @@ N=$((N+1)) NAME=TCPX6 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP socket, v6 by target" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2791,10 +2818,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2808,7 +2837,7 @@ N=$((N+1)) NAME=IPV6ONLY0 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: option ipv6-v6only=0 listens on IPv4" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2840,10 +2869,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2857,7 +2888,7 @@ N=$((N+1)) NAME=IPV6ONLY1 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: option ipv6-v6only=1 does not listen on IPv4" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2887,10 +2918,12 @@ if [ $? -eq 0 ]; then $PRINTF "$FAILED:\n" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED:\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -2903,7 +2936,7 @@ N=$((N+1)) NAME=ENV_LISTEN_4 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: env SOCAT_DEFAULT_LISTEN_IP for IPv4 preference on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2935,10 +2968,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2952,7 +2987,7 @@ N=$((N+1)) NAME=ENV_LISTEN_6 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: env SOCAT_DEFAULT_LISTEN_IP for IPv6 preference on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -2981,10 +3016,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -2998,7 +3035,7 @@ N=$((N+1)) NAME=LISTEN_OPTION_4 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: option -4 for IPv4 preference on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -3030,10 +3067,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3047,7 +3086,7 @@ N=$((N+1)) NAME=LISTEN_OPTION_6 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: option -6 for IPv6 preference on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -3076,10 +3115,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3094,7 +3135,7 @@ N=$((N+1)) NAME=LISTEN_PF_IP4 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: pf=4 overrides option -6 on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -3126,10 +3167,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3143,7 +3186,7 @@ N=$((N+1)) NAME=LISTEN_PF_IP6 case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: pf=6 overrides option -4 on listen" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip4 >/dev/null || ! runsip4 >/dev/null; then @@ -3172,10 +3215,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3190,7 +3235,7 @@ N=$((N+1)) NAME=UDP4STREAM case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%udp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udp%*|*%$NAME%*) TEST="$NAME: echo via connection to UDP V4 socket" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -3214,6 +3259,7 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" echo "$CMD1 &" @@ -3222,6 +3268,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3235,7 +3282,7 @@ N=$((N+1)) NAME=UDP6STREAM case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%udp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%udp%*|*%$NAME%*) TEST="$NAME: echo via connection to UDP V6 socket" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -3263,10 +3310,12 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3280,7 +3329,7 @@ N=$((N+1)) NAME=GOPENFILE case "$TESTS" in -*%functions%*|*%engine%*|*%gopen%*|*%file%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%gopen%*|*%file%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: file opening with gopen" if ! eval $NUMCOND; then :; else tf1="$td/test$N.1.stdout" @@ -3297,10 +3346,12 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! diff "$tf1" "$tf2" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3313,7 +3364,7 @@ N=$((N+1)) NAME=GOPENPIPE case "$TESTS" in -*%functions%*|*%engine%*|*%gopen%*|*%pipe%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%gopen%*|*%pipe%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: pipe opening with gopen for reading" if ! eval $NUMCOND; then :; else tp="$td/pipe$N" @@ -3334,6 +3385,7 @@ if [ ! -p "$tp" ]; then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else #echo "$da" >"$tp" # might hang forever echo "$da" >"$tp" & export pid=$!; (sleep 1; kill $pid 2>/dev/null) & @@ -3350,6 +3402,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "$tdiff" fi numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3364,7 +3417,7 @@ N=$((N+1)) NAME=GOPENUNIXSTREAM case "$TESTS" in -*%functions%*|*%gopen%*|*%unix%*|*%listen%*|*%$NAME%*) +*%$N%*|*%functions%*|*%gopen%*|*%unix%*|*%listen%*|*%$NAME%*) TEST="$NAME: GOPEN on UNIX stream socket" if ! eval $NUMCOND; then :; else ts="$td/test$N.socket" @@ -3389,6 +3442,7 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then kill "$pids" 2>/dev/null $PRINTF "$FAILED:\n" @@ -3398,6 +3452,7 @@ elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3411,7 +3466,7 @@ N=$((N+1)) NAME=GOPENUNIXDGRAM case "$TESTS" in -*%functions%*|*%gopen%*|*%unix%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%gopen%*|*%unix%*|*%dgram%*|*%$NAME%*) TEST="$NAME: GOPEN on UNIX datagram socket" if ! eval $NUMCOND; then :; else ts="$td/test$N.socket" @@ -3436,6 +3491,7 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da1" |diff - "${tf}" >"$tdiff"; then $PRINTF "$FAILED:\n" echo "$SRV &" @@ -3444,6 +3500,7 @@ elif ! echo "$da1" |diff - "${tf}" >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3459,7 +3516,7 @@ N=$((N+1)) #set -vx NAME=IGNOREEOF case "$TESTS" in -*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: ignoreeof on file" if ! eval $NUMCOND; then :; else ti="$td/test$N.file" @@ -3480,6 +3537,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3494,7 +3552,7 @@ N=$((N+1)) NAME=EXECIGNOREEOF case "$TESTS" in -*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: exec against address with ignoreeof" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -3507,6 +3565,7 @@ if [ -s "$te" ]; then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3519,7 +3578,7 @@ N=$((N+1)) NAME=FAKEPTY case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: generation of pty for other processes" if ! eval $NUMCOND; then :; elif ! testaddrs pty >/dev/null; then @@ -3551,6 +3610,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3565,7 +3625,7 @@ N=$((N+1)) NAME=O_TRUNC case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: option o-trunc" if ! eval $NUMCOND; then :; else ff="$td/test$N.file" @@ -3583,6 +3643,7 @@ if ! echo "$da" |$CMD >$tf 2>"$te" || cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3595,7 +3656,7 @@ N=$((N+1)) NAME=FTRUNCATE case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: option ftruncate" if ! eval $NUMCOND; then :; else ff="$td/test$N.file" @@ -3613,6 +3674,7 @@ if ! echo "$da" |$CMD >$tf 2>"$te" || cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -3625,7 +3687,7 @@ N=$((N+1)) NAME=RIGHTTOLEFT case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: unidirectional throughput from stdin to stdout, right to left" testecho "$N" "$TEST" "stdout" "stdin" "$opts -U" esac @@ -3634,7 +3696,7 @@ N=$((N+1)) NAME=CHILDDEFAULT case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) if ! eval $NUMCOND; then :; else TEST="$NAME: child process default properties" tf="$td/test$N.stdout" @@ -3654,6 +3716,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -3665,7 +3728,7 @@ N=$((N+1)) NAME=CHILDSETSID case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: child process with setsid" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -3686,6 +3749,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -3697,7 +3761,7 @@ N=$((N+1)) NAME=MAINSETSID case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: main process with setsid" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -3718,6 +3782,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -3729,7 +3794,7 @@ N=$((N+1)) NAME=CHAIN case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: stdio to test+pipe" testchain "$N" "$TEST" "stdio" "test|pipe" "$opts" "><" esac @@ -3737,7 +3802,7 @@ N=$((N+1)) NAME=REVCHAIN case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: stdio to rev.test+pipe" testchain "$N" "$TEST" "stdio" "^test|pipe" "$opts" "<>" esac @@ -3745,7 +3810,7 @@ N=$((N+1)) NAME=TWOCHAINS case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: test+stdio vs. test+pipe" testchain "$N" "$TEST" "test|stdio" "test|pipe" "$opts" "<><>" esac @@ -3753,7 +3818,7 @@ N=$((N+1)) NAME=TWOREVCHAINS case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: rev.test+stdio vs. rev.test+pipe" testchain "$N" "$TEST" "^test|stdio" "^test|pipe" "$opts" "><><" esac @@ -3761,7 +3826,7 @@ N=$((N+1)) NAME=LONGCHAIN case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: stdio vs. four-tests+pipe" testchain "$N" "$TEST" "stdio" "test|^test|test|^test|pipe" "$opts" "><><><><" esac @@ -3769,7 +3834,7 @@ N=$((N+1)) NAME=LONGLEFTCHAIN case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: four-tests+pipe vs. stdio" testchain "$N" "$TEST" "test|^test|test|^test|test|^test|test|^test|stdio" "pipe" "$opts" "><><><><><><><><" esac @@ -3777,7 +3842,7 @@ N=$((N+1)) NAME=TOWLONGCHAINS case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: four-tests+stdio vs. four-tests+pipe" testchain "$N" "$TEST" "^test|test|^test|test|stdio" "test|^test|test|^test|pipe" "$opts" "<><>><><><><<><>" esac @@ -3785,7 +3850,7 @@ N=$((N+1)) NAME=CHAINSPACES case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: lot of test with spaces" testchain "$N" "$TEST" " ^ test | test | ^ test | test | stdio " " test | ^ test | test | ^ test | pipe " "$opts" "<><>><><><><<><>" esac @@ -3793,7 +3858,7 @@ N=$((N+1)) NAME=CHAINUNIDIR case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: two unidirectional chains" # on Linux (Debian lenny/sid) we need MISCDELAY due to a weakness/bug testchain "$N" "$TEST" "test|stdin" "test|stdout" "-u $opts" "<>" "$val_t" @@ -3802,7 +3867,7 @@ N=$((N+1)) NAME=CHAINREVDIR case "$TESTS" in -*%functions%*|*%chain%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$NAME%*) TEST="$NAME: two unidirectional chains, right to left" testchain "$N" "$TEST" "^test|stdout" "^test|stdin" "-U $opts" "><" "$val_t" esac @@ -3810,7 +3875,7 @@ N=$((N+1)) NAME=CHAINDUAL case "$TESTS" in -*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) TEST="$NAME: bidirectional dual chain (uni/rev)" testchain "$N" "$TEST" "stdio" "testuni%testrev|pipe" "$opts" "><" esac @@ -3818,7 +3883,7 @@ N=$((N+1)) NAME=CHAINDUAL2 case "$TESTS" in -*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) TEST="$NAME: bidirectional dual chain (bi/rev)" testchain "$N" "$TEST" "stdio" "test%testrev|pipe" "$opts" "><" esac @@ -3826,7 +3891,7 @@ N=$((N+1)) NAME=CHAINDUAL3 case "$TESTS" in -*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) TEST="$NAME: bidirectional dual chain (uni/bi)" testchain "$N" "$TEST" "stdio" "testuni%^test|pipe" "$opts" "><" esac @@ -3834,7 +3899,7 @@ N=$((N+1)) NAME=CHAINDUAL4 case "$TESTS" in -*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) TEST="$NAME: bidirectional dual chain (bi/bi)" testchain "$N" "$TEST" "stdio" "test%^test|pipe" "$opts" "><" esac @@ -3842,7 +3907,7 @@ N=$((N+1)) NAME=CHAINDUAL5 case "$TESTS" in -*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%dual%*|*%$NAME%*) TEST="$NAME: bidirectional mixed normal and dual chains" testchain "$N" "$TEST" "test|test%^test|^test|stdio" "^test|testuni%testrev|test|pipe" "$opts" "><<<>><<>>><" esac @@ -3851,7 +3916,7 @@ N=$((N+1)) NAME=OPENSSL_TCP4 case "$TESTS" in -*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: openssl connect" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -3889,6 +3954,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3904,7 +3970,7 @@ N=$((N+1)) NAME=OPENSSLLISTEN_TCP4 case "$TESTS" in -*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: openssl listen" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -3936,6 +4002,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -3950,7 +4017,7 @@ N=$((N+1)) NAME=OPENSSLLISTEN_TCP6 case "$TESTS" in -*%functions%*|*%openssl%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: openssl listen" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -3980,6 +4047,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4006,7 +4074,7 @@ TESTKEYW=${TESTADDR%%:*} # does our address implementation support halfclose? NAME=${NAMEKEYW}_HALFCLOSE case "$TESTS" in -*%functions%*|*%socket%*|*%halfclose%*|*%$NAME%*) +*%$N%*|*%functions%*|*%socket%*|*%halfclose%*|*%$NAME%*) TEST="$NAME: $TESTKEYW half close" # have a "peer" socat "peer" that executes "$OD_C" and see if EOF on the # connecting socat brings the result of od @@ -4037,6 +4105,7 @@ if ! echo "$da" |$OD_C |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4067,7 +4136,7 @@ OPENSSL6SERVER OPENSSL tcp6 OPENSSL-LISTEN:\$PORT,pf=ip6,$SOCAT_EGD,cert=tests NAME=OPENSSL_SERVERAUTH case "$TESTS" in -*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: openssl server authentication" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -4098,6 +4167,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4112,7 +4182,7 @@ N=$((N+1)) NAME=OPENSSL_CLIENTAUTH case "$TESTS" in -*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: openssl client authentication" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -4143,6 +4213,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4157,7 +4228,7 @@ N=$((N+1)) NAME=OPENSSL_FIPS_BOTHAUTH case "$TESTS" in -*%functions%*|*%openssl%*|*%fips%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%fips%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: OpenSSL+FIPS client and server authentication" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -4191,6 +4262,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4206,7 +4278,7 @@ N=$((N+1)) NAME=OPENSSL_COMPRESS case "$TESTS" in -*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: OpenSSL compression" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -4249,6 +4321,7 @@ else cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4262,7 +4335,7 @@ N=$((N+1)) NAME=SOCKS4CONNECT_TCP4 case "$TESTS" in -*%functions%*|*%chain%*|*%socks%*|*%socks4%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%socks%*|*%socks4%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: socks4 connect over TCP/IPv4" if ! eval $NUMCOND; then :; elif ! testaddrs socks4 >/dev/null; then @@ -4293,6 +4366,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4307,7 +4381,7 @@ N=$((N+1)) NAME=SOCKS4CONNECT_TCP6 case "$TESTS" in -*%functions%*|*%socks%*|*%socks4%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%socks%*|*%socks4%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: socks4 connect over TCP/IPv6" if ! eval $NUMCOND; then :; elif ! testaddrs socks4 >/dev/null; then @@ -4337,6 +4411,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4352,7 +4427,7 @@ N=$((N+1)) NAME=SOCKS4ACONNECT_TCP4 case "$TESTS" in -*%functions%*|*%chain%*|*%socks%*|*%socks4a%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%socks%*|*%socks4a%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: socks4a connect over TCP/IPv4" if ! eval $NUMCOND; then :; elif ! testaddrs socks4a >/dev/null; then @@ -4383,6 +4458,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4397,7 +4473,7 @@ N=$((N+1)) NAME=SOCKS4ACONNECT_TCP6 case "$TESTS" in -*%functions%*|*%socks%*|*%socks4a%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%socks%*|*%socks4a%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: socks4a connect over TCP/IPv6" if ! eval $NUMCOND; then :; elif ! testaddrs socks4a >/dev/null; then @@ -4427,6 +4503,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4442,7 +4519,7 @@ N=$((N+1)) NAME=PROXYCONNECT_TCP4 case "$TESTS" in -*%functions%*|*%chain%*|*%proxyconnect%*|*%proxy%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%proxyconnect%*|*%proxy%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: proxy connect over TCP/IPv4" if ! eval $NUMCOND; then :; elif ! testaddrs proxy >/dev/null; then @@ -4474,6 +4551,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4488,7 +4566,7 @@ N=$((N+1)) NAME=PROXYCONNECT_TCP6 case "$TESTS" in -*%functions%*|*%proxyconnect%*|*%proxy%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%proxyconnect%*|*%proxy%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: proxy connect over TCP/IPv6" if ! eval $NUMCOND; then :; elif ! testaddrs proxy >/dev/null; then @@ -4519,6 +4597,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4534,7 +4613,7 @@ N=$((N+1)) NAME=TCP4NOFORK case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP V4 socket with nofork'ed exec" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -4558,10 +4637,12 @@ if [ $? -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4575,7 +4656,7 @@ N=$((N+1)) NAME=EXECCATNOFORK case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: simple echo via exec of cat with nofork" testecho "$N" "$TEST" "" "exec:$CAT,nofork" "$opts" esac @@ -4584,7 +4665,7 @@ N=$((N+1)) NAME=SYSTEMCATNOFORK case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: simple echo via system() of cat with nofork" testecho "$N" "$TEST" "" "system:$CAT,nofork" "$opts" esac @@ -4593,7 +4674,7 @@ N=$((N+1)) NAME=NOFORKSETSID case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: simple echo via exec() of cat with nofork and setsid" testecho "$N" "$TEST" "" "system:$CAT,nofork,setsid" "$opts" esac @@ -4615,6 +4696,7 @@ N=$((N+1)) #else # $ECHO "*** test $N $FAILED" # numFAIL=$((numFAIL+1)) +# listFAIL="$listFAIL $N" #fi #fi ;; # NUMCOND #N=$((N+1)) @@ -4633,6 +4715,7 @@ N=$((N+1)) #else # $ECHO "*** test $N $FAILED" # numFAIL=$((numFAIL+1)) +# listFAIL="$listFAIL $N" #fi #fi ;; # NUMCOND @@ -4640,7 +4723,7 @@ N=$((N+1)) NAME=TOTALTIMEOUT case "$TESTS" in -*%functions%*|*%engine%*|*%timeout%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%$NAME%*) TEST="$NAME: socat inactivity timeout" if ! eval $NUMCOND; then :; else #set -vx @@ -4663,6 +4746,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4679,7 +4763,7 @@ N=$((N+1)) NAME=IGNOREEOF+TOTALTIMEOUT case "$TESTS" in -*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: ignoreeof and inactivity timeout" if ! eval $NUMCOND; then :; else #set -vx @@ -4705,6 +4789,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -4718,7 +4803,7 @@ N=$((N+1)) NAME=PROXY2SPACES case "$TESTS" in -*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) TEST="$NAME: proxy connect accepts status with multiple spaces" if ! eval $NUMCOND; then :; elif ! testaddrs proxy >/dev/null; then @@ -4747,6 +4832,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -4762,7 +4848,7 @@ N=$((N+1)) NAME=BUG-UNISTDIO case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: for bug with address options on both stdin/out in unidirectional mode" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -4782,6 +4868,7 @@ else echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "${YELLOW}failed (don't care)${NORMAL}\n" numCANT=$((numCANT+1)) @@ -4794,7 +4881,7 @@ N=$((N+1)) NAME=SINGLEEXECOUTSOCKETPAIR case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: inheritance of stdout to single exec with socketpair" testecho "$N" "$TEST" "exec:cat%-" "" "$opts" 1 esac @@ -4802,7 +4889,7 @@ N=$((N+1)) NAME=SINGLEEXECOUTPIPE case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: inheritance of stdout to single exec with pipe" testecho "$N" "$TEST" "exec:cat,pipes%-" "" "$opts" 1 esac @@ -4810,7 +4897,7 @@ N=$((N+1)) NAME=SINGLEEXECOUTPTY case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: inheritance of stdout to single exec with pty" if ! eval $NUMCOND; then :; elif ! testaddrs pty >/dev/null; then @@ -4824,7 +4911,7 @@ N=$((N+1)) NAME=SINGLEEXECINSOCKETPAIR case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: inheritance of stdin to single exec with socketpair" testecho "$N" "$TEST" "-%exec:cat" "" "$opts" esac @@ -4832,7 +4919,7 @@ N=$((N+1)) NAME=SINGLEEXECINPIPE case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: inheritance of stdin to single exec with pipe" testecho "$N" "$TEST" "-%exec:cat,pipes" "" "$opts" esac @@ -4840,7 +4927,7 @@ N=$((N+1)) NAME=SINGLEEXECINPTYDELAY case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: inheritance of stdin to single exec with pty, with delay" if ! eval $NUMCOND; then :; elif ! testaddrs pty >/dev/null; then @@ -4854,7 +4941,7 @@ N=$((N+1)) NAME=SINGLEEXECINPTY case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: inheritance of stdin to single exec with pty" if ! eval $NUMCOND; then :; elif ! testaddrs pty >/dev/null; then @@ -4870,7 +4957,7 @@ N=$((N+1)) NAME=READLINE #set -vx case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: readline with password and sigint" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs readline pty); then @@ -4944,6 +5031,7 @@ if ! tr "$($ECHO '\r \c')" "% " <$tpo |sed 's/%$//g' |sed 's/.*%//g' |diff "$tr" cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -4961,7 +5049,7 @@ N=$((N+1)) NAME=GENDERCHANGER case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: TCP4 \"gender changer\"" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -4996,6 +5084,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}1" "${te}2" "${te}3" "${te}4" echo "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2" "${te}3" "${te}4"; fi @@ -5014,7 +5103,7 @@ N=$((N+1)) #! NAME=OUTBOUNDIN case "$TESTS" in -*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) TEST="$NAME: gender changer via SSL through HTTP proxy, oneshot" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs openssl proxy); then @@ -5077,6 +5166,7 @@ if ! (echo "$da"; sleep 2) |diff - "$tf" >"$tdiff"; then cat "${te}4" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2" "${te}3" "${te}4" "${te}5" "${te}6"; fi @@ -5101,7 +5191,7 @@ PORT=$((RANDOM+16184)) #! NAME=INTRANETRIPPER case "$TESTS" in -*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%proxy%*|*%$NAME%*) TEST="$NAME: gender changer via SSL through HTTP proxy, daemons" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs openssl proxy); then @@ -5189,6 +5279,7 @@ if test -s "${tdiff}1" -o -s "${tdiff}2" -o -s "${tdiff}3"; then cat "${te}6_3" cat "${tdiff}3" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK ${YELLOW}(partial failure)${NORMAL}\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2" "${te}3" "${te}4" "${te}5" ${te}6*; fi @@ -5338,14 +5429,16 @@ testserversec () { echo "$SOCAT $opts - $arg2" cat "${te}4" cat "$tdiff2" - numFAIL=$((numFAIL+1)) ;; + numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" ;; X2) $PRINTF "$FAILED: diff:\n" echo "$SOCAT $opts $arg echo" cat "${te}3" echo "$SOCAT $opts - $arg2" cat "${te}4" cat "$tdiff2" - numFAIL=$((numFAIL+1)) ;; + numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" ;; esac else $PRINTF "$OK\n" @@ -5359,7 +5452,7 @@ testserversec () { NAME=TCP4RANGEBITS case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with RANGE option" if ! eval $NUMCOND; then :; elif [ -z "$SECONDADDR" ]; then @@ -5375,7 +5468,7 @@ N=$((N+1)) NAME=TCP4RANGEMASK case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with RANGE option" if ! eval $NUMCOND; then :; elif [ -z "$SECONDADDR" ]; then @@ -5392,7 +5485,7 @@ N=$((N+1)) # like TCP4RANGEMASK, but the "bad" address is within the same class A network NAME=TCP4RANGEMASKHAIRY case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with RANGE option" if ! eval $NUMCOND; then :; else testserversec "$N" "$TEST" "$opts -s" "tcp4-l:$PORT,reuseaddr,fork,retry=1" "" "range=127.0.0.0:255.255.0.0" "tcp4:$SECONDADDR:$PORT,bind=$SECONDADDR" 4 tcp $PORT 0 @@ -5404,7 +5497,7 @@ N=$((N+1)) NAME=TCP4SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with SOURCEPORT option" if ! eval $NUMCOND; then :; else testserversec "$N" "$TEST" "$opts -s" "tcp4-l:$PORT,reuseaddr,fork,retry=1" "" "sp=$PORT" "tcp4:127.0.0.1:$PORT" 4 tcp $PORT 0 @@ -5415,7 +5508,7 @@ N=$((N+1)) NAME=TCP4LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with LOWPORT option" if ! eval $NUMCOND; then :; else testserversec "$N" "$TEST" "$opts -s" "tcp4-l:$PORT,reuseaddr,fork,retry=1" "" "lowport" "tcp4:127.0.0.1:$PORT" 4 tcp $PORT 0 @@ -5426,7 +5519,7 @@ N=$((N+1)) NAME=TCP4WRAPPERS_ADDR case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip4 libwrap) || ! runsip4 >/dev/null; then @@ -5445,7 +5538,7 @@ N=$((N+1)) NAME=TCP4WRAPPERS_NAME case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of TCP4-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip4 libwrap) || ! runsip4 >/dev/null; then @@ -5465,7 +5558,7 @@ N=$((N+1)) NAME=TCP6RANGE case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%range%*|*%$NAME%*) TEST="$NAME: security of TCP6-L with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -5480,7 +5573,7 @@ N=$((N+1)) NAME=TCP6SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of TCP6-L with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -5495,7 +5588,7 @@ N=$((N+1)) NAME=TCP6LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of TCP6-L with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -5510,7 +5603,7 @@ N=$((N+1)) NAME=TCP6TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of TCP6-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6 libwrap) || ! runsip6 >/dev/null; then @@ -5530,7 +5623,7 @@ N=$((N+1)) NAME=UDP4RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP4-L with RANGE option" if ! eval $NUMCOND; then :; else #testserversec "$N" "$TEST" "$opts -s" "udp4-l:$PORT,reuseaddr,fork" "" "range=$SECONDADDR/32" "udp4:127.0.0.1:$PORT" 4 udp $PORT 0 @@ -5542,7 +5635,7 @@ N=$((N+1)) NAME=UDP4SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP4-L with SOURCEPORT option" if ! eval $NUMCOND; then :; else testserversec "$N" "$TEST" "$opts -s" "udp4-l:$PORT,reuseaddr" "" "sp=$PORT" "udp4:127.0.0.1:$PORT" 4 udp $PORT 0 @@ -5553,7 +5646,7 @@ N=$((N+1)) NAME=UDP4LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP4-L with LOWPORT option" if ! eval $NUMCOND; then :; else testserversec "$N" "$TEST" "$opts -s" "udp4-l:$PORT,reuseaddr" "" "lowport" "udp4:127.0.0.1:$PORT" 4 udp $PORT 0 @@ -5564,7 +5657,7 @@ N=$((N+1)) NAME=UDP4TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP4-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4 libwrap) || ! runsip4 >/dev/null; then @@ -5584,7 +5677,7 @@ N=$((N+1)) NAME=UDP6RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP6-L with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -5600,7 +5693,7 @@ N=$((N+1)) NAME=UDP6SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP6-L with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -5615,7 +5708,7 @@ N=$((N+1)) NAME=UDP6LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP6-L with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -5630,7 +5723,7 @@ N=$((N+1)) NAME=UDP6TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP6-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6 libwrap) || ! runsip6 >/dev/null; then @@ -5650,7 +5743,7 @@ N=$((N+1)) NAME=OPENSSLTCP4_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%range%*|*%$NAME%*) TEST="$NAME: security of SSL-L over TCP/IPv4 with RANGE option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5666,7 +5759,7 @@ N=$((N+1)) NAME=OPENSSLTCP4_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of SSL-L with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5682,7 +5775,7 @@ N=$((N+1)) NAME=OPENSSLTCP4_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of SSL-L with LOWPORT option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5698,7 +5791,7 @@ N=$((N+1)) NAME=OPENSSLTCP4_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of SSL-L with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 tcp libwrap openssl); then @@ -5718,7 +5811,7 @@ N=$((N+1)) NAME=OPENSSLCERTSERVER case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%$NAME%*) TEST="$NAME: security of SSL-L with client certificate" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5735,7 +5828,7 @@ N=$((N+1)) NAME=OPENSSLCERTCLIENT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%openssl%*|*%$NAME%*) TEST="$NAME: security of SSL with server certificate" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5753,7 +5846,7 @@ N=$((N+1)) NAME=OPENSSLTCP6_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%range%*|*%$NAME%*) TEST="$NAME: security of SSL-L over TCP/IPv6 with RANGE option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5772,7 +5865,7 @@ N=$((N+1)) NAME=OPENSSLTCP6_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of SSL-L over TCP/IPv6 with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5791,7 +5884,7 @@ N=$((N+1)) NAME=OPENSSLTCP6_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of SSL-L over TCP/IPv6 with LOWPORT option" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5810,7 +5903,7 @@ N=$((N+1)) NAME=OPENSSLTCP6_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%openssl%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of SSL-L over TCP/IPv6 with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 tcp libwrap openssl) || ! runsip6 >/dev/null; then @@ -5831,7 +5924,7 @@ N=$((N+1)) NAME=OPENSSL_FIPS_SECURITY case "$TESTS" in -*%functions%*|*%security%*|*%openssl%*|*%fips%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%openssl%*|*%fips%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: OpenSSL restrictions by FIPS" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -5856,7 +5949,7 @@ N=$((N+1)) NAME=UNIEXECEOF case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: give exec'd write-only process a chance to flush (-u)" testod "$N" "$TEST" "" exec:"$OD_C" "$opts -u" esac @@ -5865,7 +5958,7 @@ N=$((N+1)) NAME=REVEXECEOF case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: give exec'd write-only process a chance to flush (-U)" testod "$N" "$TEST" exec:"$OD_C" "-" "$opts -U" esac @@ -5887,6 +5980,7 @@ else $PRINTF "$FAILED\n" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi ;; # NUMCOND esac @@ -5914,6 +6008,7 @@ else cat "$te1" cat "$te2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi kill $spid 2>/dev/null wait @@ -5971,7 +6066,7 @@ fi NAME=PTMXWAITSLAVE PTYTYPE=ptmx case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection" if ! eval $NUMCOND; then :; else if ! feat=$(testaddrs pty); then @@ -5990,7 +6085,7 @@ N=$((N+1)) NAME=OPENPTYWAITSLAVE PTYTYPE=openpty case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: test if master pty ($PTYTYPE) waits for slave connection" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs pty); then @@ -6008,7 +6103,7 @@ N=$((N+1)) NAME=CONNECTTIMEOUT case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%timeout%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%timeout%*|*%$NAME%*) TEST="$NAME: test the connect-timeout option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp); then @@ -6048,6 +6143,7 @@ if kill $pid2 2>"$tk2"; then cat "$te1" cat "$te2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -6065,7 +6161,7 @@ N=$((N+1)) NAME=CONNECTTIMEOUT_CONN if ! eval $NUMCOND; then :; else case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%timeout%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%timeout%*|*%$NAME%*) TEST="$NAME: TCP4 connect-timeout option when server replies" # just try a connection that is expected to succeed with the usual data # transfer; with the bug it will fail @@ -6089,10 +6185,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -6108,7 +6206,7 @@ N=$((N+1)) NAME=OPENSSLLISTENDSA case "$TESTS" in -*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%openssl%*|*%tcp%*|*%$NAME%*) TEST="$NAME: openssl listen with DSA certificate" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -6138,6 +6236,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat ${te}1 ${te}2; fi @@ -6172,7 +6271,7 @@ signum () { for signam in TERM ILL; do NAME=EXITCODESIG$signam case "$TESTS" in -*%functions%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%$NAME%*) TEST="$NAME: exit status when dying on SIG$signam" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs pty); then @@ -6205,6 +6304,7 @@ else $PRINTF "$FAILED\n" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi wait fi ;; # NUMCOND, feats @@ -6216,7 +6316,7 @@ done NAME=READBYTES #set -vx case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: restrict reading from file with bytes option" if ! eval $NUMCOND; then :; elif false; then @@ -6246,6 +6346,7 @@ if ! diff "$tr" "$to" >"$tdiff" 2>&1; then cat "$te" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6258,7 +6359,7 @@ N=$((N+1)) NAME=UDPLISTENFORK case "$TESTS" in -*%functions%*|*%ip4%*|*%udp%*|*%listen%*|*%fork%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%udp%*|*%listen%*|*%fork%*|*%$NAME%*) TEST="$NAME: UDP socket rebinds after first connection" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -6298,10 +6399,12 @@ if [ $rc -ne 0 ]; then echo "$CLI" cat "${te}s" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da2" |diff - "${tf}2" >"$tdiff"; then $PRINTF "$FAILED: diff\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -6323,7 +6426,7 @@ protov="$(echo "$PROTOV" |tr A-Z a-z)" proto="${protov%%[0-9]}" NAME=${PROTOV}LISTENFORK case "$TESTS" in -*%functions%*|*%$protov%*|*%$proto%*|*%listen%*|*%fork%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$protov%*|*%$proto%*|*%listen%*|*%fork%*|*%$NAME%*) TEST="$NAME: $PROTOV listen handles 2 concurrent connections" # have a listening address with fork option. connect with client1, send a piece # of data, wait 1s, connect with client2, send another piece of data, wait 1s, @@ -6383,6 +6486,7 @@ if ! diff "$tref" "$tf" >"$tdiff"; then cat "${te}0" "${te}1" "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -6404,7 +6508,7 @@ UNIX FILE , NAME=UNIXTOSTREAM case "$TESTS" in -*%functions%*|*%unix%*|*%listen%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%listen%*|*%$NAME%*) TEST="$NAME: generic UNIX client connects to stream socket" if ! eval $NUMCOND; then :; else ts="$td/test$N.socket" @@ -6428,11 +6532,13 @@ if [ $? -ne 0 ]; then echo "$CLI" cat "${te}s" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then kill "$pids" 2>/dev/null $PRINTF "$FAILED; diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -6445,7 +6551,7 @@ N=$((N+1)) NAME=UNIXTODGRAM case "$TESTS" in -*%functions%*|*%engine%*|*%unix%*|*%recv%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%unix%*|*%recv%*|*%$NAME%*) TEST="$NAME: generic UNIX client connects to datagram socket" if ! eval $NUMCOND; then :; else ts1="$td/test$N.socket1" @@ -6474,6 +6580,7 @@ if [ $rc -ne 0 ]; then echo "$CLI" cat "${te}1" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then kill "$pids" 2>/dev/null $PRINTF "$FAILED:\n" @@ -6483,6 +6590,7 @@ elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -6495,7 +6603,7 @@ N=$((N+1)) # there was an error in address EXEC with options pipes,stderr NAME=EXECPIPESSTDERR case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: simple echo via exec of cat with pipes,stderr" # this test is known to fail when logging is enabled with OPTS/opts env var. SAVE_opts="$opts" @@ -6508,7 +6616,7 @@ N=$((N+1)) # EXEC and SYSTEM with stderr injected socat messages into the data stream. NAME=EXECSTDERRLOG case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: simple echo via exec of cat with pipes,stderr" SAVE_opts="$opts" # make sure at least two -d are there @@ -6525,7 +6633,7 @@ N=$((N+1)) NAME=SIMPLEPARSE case "$TESTS" in -*%functions%*|*%PARSE%*|*%$NAME%*) +*%$N%*|*%functions%*|*%PARSE%*|*%$NAME%*) TEST="$NAME: invoke socat from socat" testecho "$N" "$TEST" "" exec:"$SOCAT - exec\:$CAT,pipes" "$opts" esac @@ -6534,7 +6642,7 @@ N=$((N+1)) NAME=FULLPARSE case "$TESTS" in -*%functions%*|*%parse%*|*%$NAME%*) +*%$N%*|*%functions%*|*%parse%*|*%$NAME%*) TEST="$NAME: correctly parse special chars" if ! eval $NUMCOND; then :; else $PRINTF "test $F_n $TEST... " $N @@ -6553,12 +6661,14 @@ if [ "$rc" -ne 0 ]; then echo "$SOCAT" -u "exec:echo $da" - cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif [ -s "$tdiff" ]; then $PRINTF "$FAILED: $SOCAT:\n" echo diff: cat "$tdiff" if [ -n "$debug" ]; then cat $te; fi numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6570,7 +6680,7 @@ N=$((N+1)) NAME=NESTEDSOCATEXEC case "$TESTS" in -*%parse%*|*%functions%*|*%$NAME%*) +*%parse%*|*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: does lexical analysis work sensibly (exec)" testecho "$N" "$TEST" "" "exec:'$SOCAT - exec:$CAT,pipes'" "$opts" 1 esac @@ -6578,7 +6688,7 @@ N=$((N+1)) NAME=NESTEDSOCATSYSTEM case "$TESTS" in -*%parse%*|*%functions%*|*%$NAME%*) +*%parse%*|*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: does lexical analysis work sensibly (system)" testecho "$N" "$TEST" "" "system:\"$SOCAT - exec:$CAT,pipes\"" "$opts" 1 esac @@ -6587,7 +6697,7 @@ N=$((N+1)) NAME=TCP6BYTCP4 case "$TESTS" in -*%functions%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) +*%$N%*|*%functions%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%$NAME%*) TEST="$NAME: TCP4 mapped into TCP6 address space" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip6 >/dev/null || ! runsip6 >/dev/null; then @@ -6614,10 +6724,12 @@ if [ $? -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6633,7 +6745,7 @@ N=$((N+1)) # test the UDP4-SENDTO and UDP4-RECVFROM addresses together NAME=UDP4DGRAM case "$TESTS" in -*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%$NAME%*) TEST="$NAME: UDP/IPv4 sendto and recvfrom" # start a UDP4-RECVFROM process that echoes data, and send test data using # UDP4-SENDTO. The sent data should be returned. @@ -6663,6 +6775,7 @@ if [ "$rc2" -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -6671,6 +6784,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6685,7 +6799,7 @@ N=$((N+1)) NAME=UDP6DGRAM case "$TESTS" in -*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%$NAME%*) TEST="$NAME: UDP/IPv6 datagram" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -6714,10 +6828,12 @@ if [ $? -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat ${te}1 ${te}2; fi @@ -6731,7 +6847,7 @@ N=$((N+1)) NAME=RAWIP4RECVFROM case "$TESTS" in -*%functions%*|*%ip%*|*%ip4%*|*%rawip%*|*%rawip4%*|*%dgram%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip%*|*%ip4%*|*%rawip%*|*%rawip4%*|*%dgram%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv4 datagram" if ! eval $NUMCOND; then :; elif [ $(id -u) -ne 0 -a "$withroot" -eq 0 ]; then @@ -6763,10 +6879,12 @@ if [ $rc2 -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6780,7 +6898,7 @@ N=$((N+1)) if false; then NAME=RAWIP6RECVFROM case "$TESTS" in -*%functions%*|*%ip%*|*%ip6%*|*%rawip%*|*%rawip6%*|*%dgram%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip%*|*%ip6%*|*%rawip%*|*%rawip6%*|*%dgram%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv6 datagram by self addressing" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip) || ! runsip6 >/dev/null; then @@ -6811,10 +6929,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -6828,7 +6948,7 @@ fi #false NAME=UNIXDGRAM case "$TESTS" in -*%functions%*|*%engine%*|*%unix%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%unix%*|*%dgram%*|*%$NAME%*) TEST="$NAME: UNIX datagram" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -6853,10 +6973,12 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6870,7 +6992,7 @@ N=$((N+1)) NAME=UDP4RECV case "$TESTS" in -*%functions%*|*%engine%*|*%ip4%*|*%dgram%*|*%udp%*|*%udp4%*|*%recv%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%ip4%*|*%dgram%*|*%udp%*|*%udp4%*|*%recv%*|*%$NAME%*) TEST="$NAME: UDP/IPv4 receive" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -6898,6 +7020,7 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -6906,6 +7029,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6919,7 +7043,7 @@ N=$((N+1)) NAME=UDP6RECV case "$TESTS" in -*%functions%*|*%ip6%*|*%dgram%*|*%udp%*|*%udp6%*|*%recv%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%dgram%*|*%udp%*|*%udp6%*|*%recv%*|*%$NAME%*) TEST="$NAME: UDP/IPv6 receive" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -6951,10 +7075,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -6967,7 +7093,7 @@ N=$((N+1)) NAME=RAWIP4RECV case "$TESTS" in -*%functions%*|*%ip4%*|*%dgram%*|*%rawip%*|*%rawip4%*|*%recv%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%dgram%*|*%rawip%*|*%rawip4%*|*%recv%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv4 receive" if ! eval $NUMCOND; then :; elif [ $(id -u) -ne 0 -a "$withroot" -eq 0 ]; then @@ -6999,10 +7125,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -7015,7 +7143,7 @@ N=$((N+1)) NAME=RAWIP6RECV case "$TESTS" in -*%functions%*|*%ip6%*|*%dgram%*|*%rawip%*|*%rawip6%*|*%recv%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%dgram%*|*%rawip%*|*%rawip6%*|*%recv%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv6 receive" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip) || ! runsip6 >/dev/null; then @@ -7049,10 +7177,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -7065,7 +7195,7 @@ N=$((N+1)) NAME=UNIXRECV case "$TESTS" in -*%functions%*|*%unix%*|*%dgram%*|*%recv%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%dgram%*|*%recv%*|*%$NAME%*) TEST="$NAME: UNIX receive" if ! eval $NUMCOND; then :; else ts="$td/test$N.socket" @@ -7091,10 +7221,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -7108,7 +7240,7 @@ N=$((N+1)) NAME=UDP4RECVFROM_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECVFROM with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4) || ! runsip4 >/dev/null; then @@ -7123,7 +7255,7 @@ N=$((N+1)) NAME=UDP4RECVFROM_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECVFROM with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4) || ! runsip4 >/dev/null; then @@ -7138,7 +7270,7 @@ N=$((N+1)) NAME=UDP4RECVFROM_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECVFROM with RANGE option" #testserversec "$N" "$TEST" "$opts -s" "udp4-recvfrom:$PORT,reuseaddr,fork" "" "range=$SECONDADDR/32" "udp4-sendto:127.0.0.1:$PORT" 4 udp $PORT 0 if ! eval $NUMCOND; then :; else @@ -7150,7 +7282,7 @@ N=$((N+1)) NAME=UDP4RECVFROM_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECVFROM with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 udp libwrap) || ! runsip4 >/dev/null; then @@ -7171,7 +7303,7 @@ N=$((N+1)) NAME=UDP4RECV_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECV with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4) || ! runsip4 >/dev/null; then @@ -7191,7 +7323,7 @@ N=$((N+1)) NAME=UDP4RECV_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECV with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4) || ! runsip4 >/dev/null; then @@ -7210,7 +7342,7 @@ N=$((N+1)) NAME=UDP4RECV_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECV with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4) || ! runsip4 >/dev/null; then @@ -7229,7 +7361,7 @@ N=$((N+1)) NAME=UDP4RECV_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP4-RECV with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip4 libwrap) || ! runsip4 >/dev/null; then @@ -7253,7 +7385,7 @@ N=$((N+1)) NAME=UDP6RECVFROM_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECVFROM with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -7268,7 +7400,7 @@ N=$((N+1)) NAME=UDP6RECVFROM_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECVFROM with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -7283,7 +7415,7 @@ N=$((N+1)) NAME=UDP6RECVFROM_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECVFROM with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6) || ! runsip6 >/dev/null; then @@ -7299,7 +7431,7 @@ N=$((N+1)) NAME=UDP6RECVFROM_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECVFROM with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6 libwrap) || ! runsip6 >/dev/null; then @@ -7319,7 +7451,7 @@ N=$((N+1)) NAME=UDP6RECV_SOURCEPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%sourceport%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECV with SOURCEPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -7339,7 +7471,7 @@ N=$((N+1)) NAME=UDP6RECV_LOWPORT case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%lowport%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECV with LOWPORT option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -7358,7 +7490,7 @@ N=$((N+1)) NAME=UDP6RECV_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%range%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECV with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -7377,7 +7509,7 @@ N=$((N+1)) NAME=UDP6RECV_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: security of UDP6-RECV with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6 libwrap) || ! runsip6 >/dev/null; then @@ -7401,7 +7533,7 @@ N=$((N+1)) NAME=IP4RECVFROM_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%range%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%range%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP4-RECVFROM with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip) || ! runsip4 >/dev/null; then @@ -7421,7 +7553,7 @@ N=$((N+1)) NAME=IP4RECVFROM_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%tcpwrap%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%tcpwrap%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP4-RECVFROM with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip libwrap) || ! runsip4 >/dev/null; then @@ -7447,7 +7579,7 @@ N=$((N+1)) NAME=IP4RECV_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%range%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%range%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP4-RECV with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip) || ! runsip4 >/dev/null; then @@ -7470,7 +7602,7 @@ N=$((N+1)) NAME=IP4RECV_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%tcpwrap%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip4%*|*%tcpwrap%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP4-RECV with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip libwrap) || ! runsip4 >/dev/null; then @@ -7497,7 +7629,7 @@ N=$((N+1)) NAME=IP6RECVFROM_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%range%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%range%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP6-RECVFROM with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip) || ! runsip6 >/dev/null; then @@ -7517,7 +7649,7 @@ N=$((N+1)) NAME=IP6RECVFROM_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%tcpwrap%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%tcpwrap%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP6-RECVFROM with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip libwrap) || ! runsip6 >/dev/null; then @@ -7542,7 +7674,7 @@ N=$((N+1)) NAME=IP6RECV_RANGE case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%range%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%range%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP6-RECV with RANGE option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip) || ! runsip6 >/dev/null; then @@ -7564,7 +7696,7 @@ N=$((N+1)) NAME=IP6RECV_TCPWRAP case "$TESTS" in -*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%tcpwrap%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%ip%*|*%ip6%*|*%tcpwrap%*|*%root%*|*%$NAME%*) TEST="$NAME: security of IP6-RECV with TCPWRAP option" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 rawip libwrap) || ! runsip6 >/dev/null; then @@ -7591,7 +7723,7 @@ N=$((N+1)) NAME=O_NOATIME_FILE case "$TESTS" in -*%functions%*|*%open%*|*%noatime%*|*%$NAME%*) +*%$N%*|*%functions%*|*%open%*|*%noatime%*|*%$NAME%*) TEST="$NAME: option O_NOATIME on file" # idea: create a file with o-noatime option; one second later create a file # without this option (using touch); one second later read from the first file. @@ -7621,6 +7753,7 @@ if [ $? -ne 0 ]; then # command failed echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else # check which file has a later atime stamp if [ $(ls -ltu "${tf}1" "${tf}2" |head -1 |sed 's/.* //') != "${tf}2" ]; @@ -7629,6 +7762,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -7641,7 +7775,7 @@ N=$((N+1)) NAME=O_NOATIME_FD case "$TESTS" in -*%functions%*|*%noatime%*|*%$NAME%*) +*%$N%*|*%functions%*|*%noatime%*|*%$NAME%*) TEST="$NAME: option O_NOATIME on file descriptor" # idea: use a fd of a file with o-noatime option; one second later create a file # without this option (using touch); one second later read from the first file. @@ -7672,6 +7806,7 @@ if [ $? -ne 0 ]; then # command failed echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else # check which file has a later atime stamp if [ $(ls -ltu "${tf}1" "${tf}2" |head -1 |sed 's/.* //') != "${tf}2" ]; @@ -7680,6 +7815,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -7692,7 +7828,7 @@ N=$((N+1)) NAME=EXT2_NOATIME case "$TESTS" in -*%functions%*|*%ext2%*|*%noatime%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ext2%*|*%noatime%*|*%$NAME%*) TEST="$NAME: extended file system options using ext2fs noatime option" # idea: create a file with ext2-noatime option; one second later create a file # without this option (using touch); one second later read from the first file. @@ -7740,6 +7876,7 @@ then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -7754,7 +7891,7 @@ N=$((N+1)) NAME=COOLWRITE case "$TESTS" in -*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) TEST="$NAME: option cool-write" if ! eval $NUMCOND; then :; elif ! testoptions cool-write >/dev/null; then @@ -7782,6 +7919,7 @@ if [ $rc -ne 0 ]; then echo "$CMD &" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -7796,7 +7934,7 @@ N=$((N+1)) # this failed up to socat 1.6.0.0 NAME=COOLSTDIO case "$TESTS" in -*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%timeout%*|*%ignoreeof%*|*%coolwrite%*|*%$NAME%*) TEST="$NAME: option cool-write on bidirectional stdio" # this test starts a socat reader that terminates after receiving one+ # bytes (option readbytes); and a test process that sends two bytes via @@ -7830,6 +7968,7 @@ if [ $rc -ne 0 ]; then echo "$CMD &" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "$te"; fi @@ -7849,7 +7988,7 @@ N=$((N+1)) # open for the other processes. NAME=TCP4ENDCLOSE case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: shut-none keeps TCP V4 socket open" # this is how we test the shut-none option: # we have some tcp service (CMD3) that accepts one connection and only receives @@ -7891,11 +8030,13 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1a" "${te}1b" "${te}2" "${te}3" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! $ECHO "$da1a\n$da1b" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" cat "${te}1a" "${te}1b" "${te}2" "${te}3" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1a" "${te}1b" "${te}2" "${te}3"; fi @@ -7910,7 +8051,7 @@ N=$((N+1)) # sub process (socketpair) NAME=EXECENDCLOSE case "$TESTS" in -*%functions%*|*%exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%exec%*|*%$NAME%*) TEST="$NAME: end-close keeps EXEC child running" # this is how we test the shut-none option: # we have a server process (CMD) that runs a program (cat); the process accepts @@ -7946,6 +8087,7 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "${te}1a" "${te}1b" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! $ECHO "$da1a\n$da1b" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" echo "$CMD1 &" @@ -7953,6 +8095,7 @@ elif ! $ECHO "$da1a\n$da1b" |diff - "$tf" >"$tdiff"; then cat "$tdiff" cat "${te}1a" "${te}1b" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1a" "${te}1b" "${te}2"; fi @@ -7967,7 +8110,7 @@ N=$((N+1)) # bad internal handling. here we check it for address PTY NAME=PTYENDCLOSE case "$TESTS" in -*%functions%*|*%bugs%*|*%pty%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%pty%*|*%$NAME%*) TEST="$NAME: PTY handles option end-close" # with the bug, socat exits with error. we invoke socat in a no-op mode and # check its return status. @@ -7987,6 +8130,7 @@ else echo "$CMD" cat "${te}" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -7997,7 +8141,7 @@ N=$((N+1)) # test the shut-null and null-eof options NAME=SHUTNULLEOF case "$TESTS" in -*%functions%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%socket%*|*%$NAME%*) TEST="$NAME: options shut-null and null-eof" # run a receiving background process with option null-eof. # start a sending process with option shut-null that sends a test record to the @@ -8028,6 +8172,7 @@ if [ $rc1 != 0 -o $rc2 != 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo "$da" |diff - "${tf}" >"$tdiff"; then $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -8039,6 +8184,7 @@ else cat "${te}1" cat "${tdiff}" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -8050,7 +8196,7 @@ NAME=UDP6LISTENBIND # this tests for a bug in (up to) 1.5.0.0: # with udp*-listen, the bind option supported only IPv4 case "$TESTS" in -*%functions%*|*%bugs%*|*%ip6%*|*%ipapp%*|*%udp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%ip6%*|*%ipapp%*|*%udp%*|*%$NAME%*) TEST="$NAME: UDP6-LISTEN with bind" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs udp ip6) || ! runsip6 >/dev/null; then @@ -8078,10 +8224,12 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -8097,7 +8245,7 @@ NAME=TCPWRAPPERS_MULTIOPTS # this tests for a bug in 1.5.0.0 that let socat fail when more than one # tcp-wrappers related option was specified in one address case "$TESTS" in -*%functions%*|*%bugs%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: use of multiple tcpwrapper enabling options" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip4 libwrap) || ! runsip4 >/dev/null; then @@ -8123,10 +8271,12 @@ if [ $? -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -8142,7 +8292,7 @@ NAME=TCPWRAPPERS_TCP6ADDR # this tests for a bug in 1.5.0.0 that brought false results with tcp-wrappers # and IPv6 when case "$TESTS" in -*%functions%*|*%bugs%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%tcp%*|*%tcp6%*|*%ip6%*|*%tcpwrap%*|*%$NAME%*) TEST="$NAME: specification of TCP6 address in hosts.allow" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs tcp ip6 libwrap) || ! runsip6 >/dev/null; then @@ -8157,7 +8307,7 @@ ha="$td/hosts.allow" hd="$td/hosts.deny" $ECHO "socat : [::1] : allow" >"$ha" $ECHO "ALL : ALL : deny" >"$hd" -CMD1="$SOCAT $opts TCP6-LISTEN:$PORT,reuseaddr,tcpwrap-etc=$td pipe" +CMD1="$SOCAT $opts TCP6-LISTEN:$PORT,reuseaddr,tcpwrap-etc=$td,tcpwrappers=socat pipe" CMD2="$SOCAT $opts - TCP6:[::1]:$PORT" printf "test $F_n $TEST... " $N $CMD1 2>"${te}1" & @@ -8172,10 +8322,12 @@ if [ $? -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -8189,7 +8341,7 @@ N=$((N+1)) NAME=UDP4BROADCAST case "$TESTS" in -*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%$NAME%*) TEST="$NAME: UDP/IPv4 broadcast" if ! eval $NUMCOND; then :; elif [ -z "$BCADDR" ]; then @@ -8222,10 +8374,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$tut" ]; then @@ -8245,7 +8399,7 @@ NAME=IP4BROADCAST # because we receive - in addition to the regular reply - our own broadcast, # we use a token XXXX that is changed to YYYY in the regular reply packet. case "$TESTS" in -*%functions%*|*%engine%*|*%rawip%*|*%rawip4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%rawip%*|*%rawip4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv4 broadcast" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip) || ! runsip4 >/dev/null; then @@ -8286,10 +8440,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" | sed 's/XXXX/YYYY/'|diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8303,7 +8459,7 @@ N=$((N+1)) #NAME=UDP4BROADCAST_RANGE #case "$TESTS" in -#*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%range%*|*%$NAME%*) +#*%$N%*|*%functions%*|*%security%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%broadcast%*|*%range%*|*%$NAME%*) #TEST="$NAME: security of UDP4-BROADCAST with RANGE option" #if ! eval $NUMCOND; then :; #elif [ -z "$BCADDR" ]; then @@ -8318,7 +8474,7 @@ N=$((N+1)) NAME=UDP4MULTICAST_UNIDIR case "$TESTS" in -*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%multicast%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%multicast%*|*%$NAME%*) TEST="$NAME: UDP/IPv4 multicast, send only" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 udp) || ! runsip4 >/dev/null; then @@ -8349,10 +8505,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8364,7 +8522,7 @@ N=$((N+1)) NAME=IP4MULTICAST_UNIDIR case "$TESTS" in -*%functions%*|*%rawip%*|*%ip4%*|*%dgram%*|*%multicast%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%rawip%*|*%ip4%*|*%dgram%*|*%multicast%*|*%root%*|*%$NAME%*) TEST="$NAME: IPv4 multicast" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip) || ! runsip4 >/dev/null; then @@ -8400,10 +8558,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8417,7 +8577,7 @@ N=$((N+1)) if false; then NAME=UDP6MULTICAST_UNIDIR case "$TESTS" in -*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%multicast%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp6%*|*%ip6%*|*%dgram%*|*%multicast%*|*%$NAME%*) TEST="$NAME: UDP/IPv6 multicast" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip6 udp) || ! runsip6 >/dev/null; then @@ -8448,10 +8608,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8464,7 +8626,7 @@ fi # false NAME=UDP4MULTICAST_BIDIR case "$TESTS" in -*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%multicast%*|*%$NAME%*) +*%$N%*|*%functions%*|*%udp%*|*%udp4%*|*%ip4%*|*%dgram%*|*%multicast%*|*%$NAME%*) TEST="$NAME: UDP/IPv4 multicast, with reply" if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" @@ -8493,10 +8655,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$tut" ]; then @@ -8512,7 +8676,7 @@ N=$((N+1)) NAME=IP4MULTICAST_BIDIR case "$TESTS" in -*%functions%*|*%rawip%*|*%ip4%*|*%dgram%*|*%multicast%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%rawip%*|*%ip4%*|*%dgram%*|*%multicast%*|*%root%*|*%$NAME%*) TEST="$NAME: IPv4 multicast, with reply" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs ip4 rawip) || ! runsip4 >/dev/null; then @@ -8547,10 +8711,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$tut" ]; then @@ -8568,7 +8734,7 @@ N=$((N+1)) NAME=TUNREAD case "$TESTS" in -*%functions%*|*%tun%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%tun%*|*%root%*|*%$NAME%*) TEST="$NAME: reading data sent through tun interface" #idea: create a TUN interface and send a datagram to one of the addresses of # its virtual network. On the tunnel side, read the packet and compare its last @@ -8604,11 +8770,13 @@ if [ $? -ne 0 ]; then echo "$CMD1" cat "${te}" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" cat "${te}" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}" "${te}1"; fi @@ -8624,7 +8792,7 @@ N=$((N+1)) # transparent NAME=TUNINTERFACE case "$TESTS" in -*%functions%*|*%tun%*|*%interface%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%tun%*|*%interface%*|*%root%*|*%$NAME%*) TEST="$NAME: pass data through tun interface using INTERFACE" #idea: create a TUN interface and send a raw packet on the interface side. # It should arrive unmodified on the tunnel side. @@ -8660,11 +8828,13 @@ if [ $? -ne 0 ]; then echo "$CMD1" cat "${te}" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" cat "${te}" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}" "${te}1"; fi @@ -8678,7 +8848,7 @@ N=$((N+1)) NAME=ABSTRACTSTREAM case "$TESTS" in -*%functions%*|*%unix%*|*%abstract%*|*%connect%*|*%listen%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%abstract%*|*%connect%*|*%listen%*|*%$NAME%*) TEST="$NAME: abstract UNIX stream socket, listen and connect" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs abstract-unixsocket); then @@ -8709,6 +8879,7 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then kill "$pids" 2>/dev/null $PRINTF "$FAILED:\n" @@ -8718,6 +8889,7 @@ elif ! echo "$da1" |diff - "${tf}1" >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8731,7 +8903,7 @@ N=$((N+1)) NAME=ABSTRACTDGRAM case "$TESTS" in -*%functions%*|*%unix%*|*%abstract%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%abstract%*|*%dgram%*|*%$NAME%*) TEST="$NAME: abstract UNIX datagram" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs abstract-unixsocket); then @@ -8762,10 +8934,12 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8778,7 +8952,7 @@ N=$((N+1)) NAME=ABSTRACTRECV case "$TESTS" in -*%functions%*|*%unix%*|*%abstract%*|*%dgram%*|*%recv%*|*%$NAME%*) +*%$N%*|*%functions%*|*%unix%*|*%abstract%*|*%dgram%*|*%recv%*|*%$NAME%*) TEST="$NAME: abstract UNIX datagram receive" if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs abstract-unixsocket); then @@ -8810,10 +8984,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8834,7 +9010,7 @@ NAME=OPENSSLREAD # keeps there and is not transferred by socat until the socket indicates more # data or EOF. case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: socat handles data buffered by openssl" #idea: have a socat process (server) that gets an SSL block that is larger than # socat transfer block size; keep the socket connection open and kill the @@ -8868,6 +9044,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8887,7 +9064,7 @@ N=$((N+1)) NAME=READBYTES_EOF #set -vx case "$TESTS" in -*%functions%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$NAME%*) TEST="$NAME: trigger EOF after that many bytes, even when socket idle" #idea: we deliver that many bytes to socat; the process should terminate then. # we try to transfer data in the other direction then; if transfer succeeds, @@ -8910,6 +9087,7 @@ if test -s "$to"; then $PRINTF "$FAILED: $SOCAT:\n" echo "$CMD" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -8924,7 +9102,7 @@ N=$((N+1)) # process under some circumstances. NAME=EXECPTYKILL case "$TESTS" in -*%functions%*|*%bugs%*|*%exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%exec%*|*%$NAME%*) TEST="$NAME: exec:...,pty explicitely kills sub process" # we want to check if the exec'd sub process is killed in time # for this we have a shell script that generates a file after two seconds; @@ -8958,10 +9136,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif [ -f "$tda" ]; then $PRINTF "$FAILED\n" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -8976,7 +9156,7 @@ N=$((N+1)) # test if service name resolution works; this was buggy in 1.5 and 1.6.0.0 NAME=TCP4SERVICE case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$NAME%*) TEST="$NAME: echo via connection to TCP V4 socket" # select a tcp entry from /etc/services, have a server listen on the port # number and connect using the service name; with the bug, connection will to a @@ -9007,10 +9187,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -9040,7 +9222,7 @@ N=$((N+1)) # SunOS 8: 20 1024 NAME=EXCEED_FOPEN_MAX case "$TESTS" in -*%functions%*|*%maxfds%*|*%$NAME%*) +*%$N%*|*%functions%*|*%maxfds%*|*%$NAME%*) TEST="$NAME: more than FOPEN_MAX FDs in use" # this test opens a number of FDs before socat is invoked. socat will have to # allocate higher FD numbers and thus hang if it cannot handle them. @@ -9072,7 +9254,7 @@ N=$((N+1)) # zombies because the master process did not catch SIGCHLD NAME=UDP4LISTEN_SIGCHLD case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%udp%*|*%zombie%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%udp%*|*%zombie%*|*%$NAME%*) TEST="$NAME: test if UDP4-LISTEN child becomes zombie" # idea: run a udp-listen process with fork and -T. Connect once, so a sub # process is forked off. Make some transfer and wait until the -T timeout is @@ -9109,6 +9291,7 @@ elif $(isdefunct "$l"); then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -9124,7 +9307,7 @@ N=$((N+1)) # zombies because the master process caught SIGCHLD but did not wait() NAME=UDP4RECVFROM_SIGCHLD case "$TESTS" in -*%functions%*|*%ip4%*|*%udp%*|*%dgram%*|*%zombie%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%udp%*|*%dgram%*|*%zombie%*|*%$NAME%*) TEST="$NAME: test if UDP4-RECVFROM child becomes zombie" # idea: run a udp-recvfrom process with fork and -T. Send it one packet, so a # sub process is forked off. Make some transfer and wait until the -T timeout @@ -9161,6 +9344,7 @@ elif $(isdefunct "$l"); then echo "$CMD2" cat "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -9178,7 +9362,7 @@ N=$((N+1)) # occurred NAME=RAWIP4RECVBIND case "$TESTS" in -*%functions%*|*%ip4%*|*%dgram%*|*%rawip%*|*%rawip4%*|*%recv%*|*%root%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%dgram%*|*%rawip%*|*%rawip4%*|*%recv%*|*%root%*|*%$NAME%*) TEST="$NAME: raw IPv4 receive with bind" # idea: start a socat process with ip4-recv:...,bind=... and send it a packet # if the packet passes the test succeeded @@ -9212,10 +9396,12 @@ if [ "$rc2" -ne 0 ]; then cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9232,7 +9418,7 @@ N=$((N+1)) # child process. NAME=UDP4RECVFROM_FORK case "$TESTS" in -*%functions%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) TEST="$NAME: test if UDP4-RECVFROM handles more than one packet" # idea: run a UDP4-RECVFROM process with fork and -T. Send it one packet; # send it a second packet and check if this is processed properly. If yes, the @@ -9266,6 +9452,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}1" "${te}2" "${te}3" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2" "${te}3"; fi @@ -9281,7 +9468,7 @@ N=$((N+1)) # in additional empty arguments NAME=EXECSPACES case "$TESTS" in -*%functions%*|*%exec%*|*%parse%*|*%$NAME%*) +*%$N%*|*%functions%*|*%exec%*|*%parse%*|*%$NAME%*) TEST="$NAME: correctly parse exec with consecutive spaces" if ! eval $NUMCOND; then :; else $PRINTF "test $F_n $TEST... " $N @@ -9298,12 +9485,14 @@ if [ "$rc" -ne 0 ]; then $PRINTF "$FAILED: $SOCAT:\n" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif [ -s "$tdiff" ]; then $PRINTF "$FAILED: $SOCAT:\n" echo diff: cat "$tdiff" if [ -n "$debug" ]; then cat $te; fi numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9319,7 +9508,7 @@ N=$((N+1)) # range option, the old listen socket would not be closed but a new one created. NAME=UDP4LISTENCONT case "$TESTS" in -*%functions%*|*%bugs%*|*%ip4%*|*%udp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%ip4%*|*%udp%*|*%$NAME%*) TEST="$NAME: let range drop a packet and see if old socket is closed" # idea: run a UDP4-LISTEN process with range option. Send it one packet from an # address outside range and check if two listening sockets are open then @@ -9358,6 +9547,7 @@ elif [ $nsocks -ne 1 ]; then echo "$CMD1" cat "${te}0" "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}0" "${te}1" "${te}2"; fi @@ -9373,7 +9563,7 @@ N=$((N+1)) # the reverse direction NAME=IGNOREEOFNOBLOCK case "$TESTS" in -*%functions%*|*%engine%*|*%socket%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%socket%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: ignoreeof does not block other direction" # have socat poll in ignoreeof mode. while it waits one second for next check, # we send data in the reverse direction and then the total timeout fires. @@ -9394,6 +9584,7 @@ if [ $rc0 != 0 ]; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo "$da" |diff - "$tf" >/dev/null; then $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -9403,6 +9594,7 @@ else echo "$CMD1" cat "${te}0" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi ;; # NUMCOND esac @@ -9412,7 +9604,7 @@ N=$((N+1)) # test the escape option NAME=ESCAPE case "$TESTS" in -*%functions%*|*%engine%*|*%escape%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%escape%*|*%$NAME%*) TEST="$NAME: escape character triggers EOF" # idea: start socat just echoing input, but apply escape option. send a string # containing the escape character and check if the output is truncated @@ -9429,10 +9621,12 @@ if [ $? -ne 0 ]; then echo "$CMD" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9445,7 +9639,7 @@ N=$((N+1)) # test the escape option combined with ignoreeof NAME=ESCAPE_IGNOREEOF case "$TESTS" in -*%functions%*|*%engine%*|*%ignoreeof%*|*%escape%*|*%$NAME%*) +*%$N%*|*%functions%*|*%engine%*|*%ignoreeof%*|*%escape%*|*%$NAME%*) TEST="$NAME: escape character triggers EOF" # idea: start socat just echoing input, but apply escape option. send a string # containing the escape character and check if the output is truncated @@ -9466,6 +9660,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "$tdiff" cat "$te" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9485,7 +9680,7 @@ pf="$(echo "$PF" |tr A-Z a-z)" proto="$(echo "$KEYW" |tr A-Z a-z)" NAME=${KEYW}SCM_$SCM_TYPE case "$TESTS" in -*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%$ROOT%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%$ROOT%*|*%$NAME%*) TEST="$NAME: $KEYW log ancillary message $SCM_TYPE $SCM_NAME" # idea: start a socat process with *-RECV:..,... , ev. with ancillary message # enabling option and send it a packet, ev. with some option. check the info log @@ -9556,6 +9751,7 @@ elif ! grep "ancillary message: $SCM_TYPE: $SCM_NAME=" ${te}0 >/dev/null; then grep " $LEVELS " "${te}1" echo "variable $SCM_TYPE: $SCM_NAME not set" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! grep "ancillary message: $SCM_TYPE: $SCM_NAME=$SCM_VALUE" ${te}0 >/dev/null; then $PRINTF "$FAILED\n" echo "$CMD0 &" @@ -9565,6 +9761,7 @@ elif ! grep "ancillary message: $SCM_TYPE: $SCM_NAME=$SCM_VALUE" ${te}0 >/dev/nu badval="$(grep "ancillary message: $SCM_TYPE: $SCM_NAME" ${te}0 |sed 's/.*=//g')" echo "variable $SCM_TYPE: $SCM_NAME has value \"$badval\" instead of \"$SCM_VALUE\"" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then @@ -9624,7 +9821,7 @@ if [ -z "$KEYW" ] || [[ "$KEYW" == \#* ]]; then continue; fi test_proto="$(echo "$KEYW" |tr A-Z a-z)" NAME=${KEYW}LISTENENV case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$test_proto%*|*%envvar%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$test_proto%*|*%envvar%*|*%$NAME%*) TEST="$NAME: $KEYW-LISTEN fills environment variables with socket addresses" # have a server accepting a connection and invoking some shell code. The shell # code extracts and prints the SOCAT related environment vars. @@ -9656,7 +9853,7 @@ if [ "$tcp" != ',' ]; then tca="$tca:$tcp" fi #CMD0="$SOCAT $opts -u $KEYW-LISTEN:$tsa1 system:\"export -p\"" -CMD0="$SOCAT $opts -u $KEYW-LISTEN:$tsa1 system:\"echo SOCAT_SOCKADDR=\\\$SOCAT_SOCKADDR; echo SOCAT_PEERADDR=\\\$SOCAT_PEERADDR; echo SOCAT_SOCKPORT=\\\$SOCAT_SOCKPORT; echo SOCAT_PEERPORT=\\\$SOCAT_PEERPORT; sleep 1\"" +CMD0="$SOCAT $opts -u -lpsocat $KEYW-LISTEN:$tsa1 system:\"echo SOCAT_SOCKADDR=\\\$SOCAT_SOCKADDR; echo SOCAT_PEERADDR=\\\$SOCAT_PEERADDR; echo SOCAT_SOCKPORT=\\\$SOCAT_SOCKPORT; echo SOCAT_PEERPORT=\\\$SOCAT_PEERPORT; sleep 1\"" CMD1="$SOCAT $opts -u - $KEYW-CONNECT:$tsa,bind=$tca" printf "test $F_n $TEST... " $N eval "$CMD0 2>\"${te}0\" >\"$tf\" &" @@ -9694,6 +9891,7 @@ else echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND, feats ;; @@ -9722,9 +9920,9 @@ pf="$(echo "$PF" |tr A-Z a-z)" proto="$(echo "$KEYW" |tr A-Z a-z)" NAME=${KEYW}ENV_$SCM_ENVNAME case "$TESTS" in -*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%envvar%*|*%$ROOT%*|*%$NAME%*) +*%$N%*|*%functions%*|*%$pf%*|*%dgram%*|*%udp%*|*%$proto%*|*%recv%*|*%ancillary%*|*%envvar%*|*%$ROOT%*|*%$NAME%*) #set -vx -TEST="$NAME: $KEYW ancillary message brings $SCM_ENVNAME into environment" +TEST="$NAME: $KEYW ancillary message sets env SOCAT_$SCM_ENVNAME" # idea: start a socat process with *-RECVFROM:..,... , ev. with ancillary # message enabling option and send it a packet, ev. with some option. write # the resulting environment to a file and check its contents for the @@ -9753,7 +9951,7 @@ case "X$IPPORT" in tsa="$tra" esac #CMD0="$SOCAT $opts -u $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV system:\"export -p\"" -CMD0="$SOCAT $opts -u $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV system:\"echo \\\$SOCAT_$SCM_ENVNAME\"" +CMD0="$SOCAT $opts -u -lpsocat $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV system:\"echo \\\$SOCAT_$SCM_ENVNAME\"" CMD1="$SOCAT $opts -u - $KEYW-SENDTO:$tsa,$SCM_ENABLE" printf "test $F_n $TEST... " $N # is this option supported? @@ -9787,6 +9985,7 @@ elif ! expr "$(cat "$tf")" : "$(eval echo "\$SCM_VALUE")" >/dev/null; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then @@ -9835,7 +10034,7 @@ IP6 IP6 [::1] PROTO ipv6-tclass=0xaa ipv6-recvtclass IPV6_TCLASS # test the SOCKET-CONNECT address (against TCP4-LISTEN) NAME=SOCKET_CONNECT_TCP4 case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%$NAME%*) TEST="$NAME: socket connect with TCP/IPv4" # start a TCP4-LISTEN process that echoes data, and send test data using # SOCKET-CONNECT, selecting TCP/IPv4. The sent data should be returned. @@ -9866,6 +10065,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -9874,6 +10074,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9890,7 +10091,7 @@ PF_INET6="$($PROCAN -c |grep "^#define[[:space:]]*PF_INET6[[:space:]]" |cut -d' # test the SOCKET-CONNECT address (against TCP6-LISTEN) NAME=SOCKET_CONNECT_TCP6 case "$TESTS" in -*%functions%*|*%generic%*|*%tcp6%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%tcp6%*|*%socket%*|*%$NAME%*) TEST="$NAME: socket connect with TCP/IPv6" if ! eval $NUMCOND; then :; elif ! testaddrs tcp ip6 >/dev/null || ! runsip6 >/dev/null; then @@ -9925,6 +10126,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -9933,6 +10135,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9946,7 +10149,7 @@ N=$((N+1)) # test the SOCKET-CONNECT address (against UNIX-LISTEN) NAME=SOCKET_CONNECT_UNIX case "$TESTS" in -*%functions%*|*%generic%*|*%unix%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%unix%*|*%socket%*|*%$NAME%*) TEST="$NAME: socket connect with UNIX domain" # start a UNIX-LISTEN process that echoes data, and send test data using # SOCKET-CONNECT, selecting UNIX socket. The sent data should be returned. @@ -9973,6 +10176,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -9981,6 +10185,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -9993,7 +10198,7 @@ N=$((N+1)) # test the SOCKET-LISTEN address (with TCP4-CONNECT) NAME=SOCKET_LISTEN case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%$NAME%*) TEST="$NAME: socket recvfrom with TCP/IPv4" # start a SOCKET-LISTEN process that uses TCP/IPv4 and echoes data, and # send test data using TCP4-CONNECT. The sent data should be returned. @@ -10026,6 +10231,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -10034,6 +10240,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -10049,7 +10256,7 @@ SOCK_DGRAM="$($PROCAN -c |grep "^#define[[:space:]]*SOCK_DGRAM[[:space:]]" |cut # test the SOCKET-SENDTO address (against UDP4-RECVFROM) NAME=SOCKET_SENDTO case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) TEST="$NAME: socket sendto with UDP/IPv4" # start a UDP4-RECVFROM process that echoes data, and send test data using # SOCKET-SENDTO, selecting UDP/IPv4. The sent data should be returned. @@ -10080,6 +10287,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -10088,6 +10296,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -10101,7 +10310,7 @@ N=$((N+1)) # test the SOCKET-RECVFROM address (with UDP4-SENDTO) NAME=SOCKET_RECVFROM case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) TEST="$NAME: socket recvfrom with UDP/IPv4" # start a SOCKET-RECVFROM process that uses UDP/IPv4 and echoes data, and # send test data using UDP4-SENDTO. The sent data should be returned. @@ -10133,6 +10342,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -10141,6 +10351,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -10155,7 +10366,7 @@ N=$((N+1)) # test the SOCKET-RECV address (with UDP4-SENDTO) NAME=SOCKET_RECV case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) TEST="$NAME: socket recv with UDP/IPv4" # start a SOCKET-RECV process that uses UPD/IPv4 and writes received data to file, and # send test data using UDP4-SENDTO. @@ -10188,6 +10399,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -10196,6 +10408,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -10209,7 +10422,7 @@ N=$((N+1)) # test SOCKET-DATAGRAM (with UDP4-DATAGRAM) NAME=SOCKET_DATAGRAM case "$TESTS" in -*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) +*%$N%*|*%functions%*|*%generic%*|*%socket%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*) TEST="$NAME: socket datagram via UDP/IPv4" # start a UDP4-DATAGRAM process that echoes data, and send test data using # SOCKET-DATAGRAM, selecting UDP/IPv4. The sent data should be returned. @@ -10242,6 +10455,7 @@ if [ "$rc1" -ne 0 ]; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" @@ -10250,6 +10464,7 @@ elif ! echo "$da" |diff - "$tf" >"$tdiff"; then echo "$CMD1" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat $te; fi @@ -10262,7 +10477,7 @@ N=$((N+1)) NAME=SOCKETRANGEMASK case "$TESTS" in -*%functions%*|*%security%*|*%generic%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%socket%*|*%range%*|*%$NAME%*) +*%$N%*|*%functions%*|*%security%*|*%generic%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%socket%*|*%range%*|*%$NAME%*) TEST="$NAME: security of generic socket-listen with RANGE option" if ! eval $NUMCOND; then :; elif [ -z "$SECONDADDR" ]; then @@ -10283,7 +10498,7 @@ TIOCEXCL="$($PROCAN -c |grep "^#define[[:space:]]*TIOCEXCL[[:space:]]" |cut -d' # test the generic ioctl-void option NAME=IOCTL_VOID case "$TESTS" in -*%functions%*|*%pty%*|*%generic%*|*%$NAME%*) +*%$N%*|*%functions%*|*%pty%*|*%generic%*|*%$NAME%*) TEST="$NAME: test the ioctl-void option" # there are not many ioctls that apply to non global resources and do not # require root. TIOCEXCL seems to fit: @@ -10328,6 +10543,7 @@ elif [ $rc2 -eq 0 ]; then echo "$CMD2" cat "${te}0" "${te}1" "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}0" "${te}1" "${te}2"; fi @@ -10345,7 +10561,7 @@ SO_REUSEADDR="$($PROCAN -c |grep "^#define[[:space:]]*SO_REUSEADDR[[:space:]]" | # test the generic setsockopt-int option NAME=SETSOCKOPT_INT case "$TESTS" in -*%functions%*|*%ip4%*|*%tcp%*|*%generic%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%tcp%*|*%generic%*|*%$NAME%*) TEST="$NAME: test the setsockopt-int option" # there are not many socket options that apply to non global resources, do not # require root, do not require a network connection, and can easily be @@ -10395,6 +10611,7 @@ elif [ $rc3 -ne 0 ]; then echo "$CMD3" cat "${te}2" "${te}3" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "${tf}3"; then $PRINTF "$FAILED: $SOCAT:\n" echo "$CMD2 &" @@ -10415,7 +10632,7 @@ N=$((N+1)) NAME=SCTP4STREAM case "$TESTS" in -*%functions%*|*%ip4%*|*%ipapp%*|*%sctp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%sctp%*|*%$NAME%*) TEST="$NAME: echo via connection to SCTP V4 socket" PORT="$((PORT+1))" if ! eval $NUMCOND; then :; @@ -10449,10 +10666,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -10468,7 +10687,7 @@ N=$((N+1)) NAME=SCTP6STREAM case "$TESTS" in -*%functions%*|*%ip6%*|*%ipapp%*|*%sctp%*|*%$NAME%*) +*%$N%*|*%functions%*|*%ip6%*|*%ipapp%*|*%sctp%*|*%$NAME%*) TEST="$NAME: echo via connection to SCTP V6 socket" PORT="$((PORT+1))" if ! eval $NUMCOND; then :; @@ -10500,10 +10719,12 @@ if [ $? -ne 0 ]; then echo "$CMD2" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: diff:\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -10521,8 +10742,8 @@ N=$((N+1)) # performed a renegotiation. Test if this is fixed. NAME=OPENSSLRENEG1 case "$TESTS" in -*%functions%*|*%bugs%*|*%openssl%*|*%socket%*|*%$NAME%*) -TEST="$NAME: OpenSSL connections survives renogotiation" +*%$N%*|*%functions%*|*%bugs%*|*%openssl%*|*%socket%*|*%$NAME%*) +TEST="$NAME: OpenSSL connections survive renogotiation" # connect with s_client to socat ssl-l; force a renog, then transfer data. When # data is passed the test succeeded if ! eval $NUMCOND; then :; else @@ -10550,6 +10771,7 @@ else # cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -10562,7 +10784,7 @@ N=$((N+1)) # leave socat in a blocking ssl-read state. Test if this has been fixed. NAME=OPENSSLRENEG2 case "$TESTS" in -*%functions%*|*%bugs%*|*%openssl%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%openssl%*|*%socket%*|*%$NAME%*) TEST="$NAME: OpenSSL connections do not block after renogotiation" # connect with s_client to socat ssl-l; force a renog, then transfer data from # socat to the peer. When data is passed this means that the former ssl read no @@ -10592,6 +10814,7 @@ else # cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -10607,7 +10830,7 @@ pf="$(echo $PF |tr A-Z a-z)" proto="$(echo $KEYW |tr A-Z a-z)" NAME=OPENSSL_${KEYW}_FORK case "$TESTS" in -*%functions%*|*%chain%*|*%openssl%*|*%sctp%*|*%$pf%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%openssl%*|*%sctp%*|*%$pf%*|*%$NAME%*) TEST="$NAME: openssl over SCTP with server fork" if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -10641,6 +10864,7 @@ if ! echo "$da2" |diff - "${tf}2" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}0" "${te}1" "${te}2"; fi @@ -10670,7 +10894,7 @@ EXEC="$(echo $exec |tr 'a-z' 'A-Z')" NAME=${EXEC}2_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) TEST="$NAME: bidirectional $exec in simple chain ($commname)" testecho "$N" "$TEST" "STDIO" "$EXEC:bin/cat2.sh|PIPE" "$opts -c$c" "$val_t" esac @@ -10678,7 +10902,7 @@ N=$((N+1)) NAME=${EXEC}2UNI_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%{exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%{exec}2%*|*%$NAME%*) TEST="$NAME: unidirectional $exec in simple chain ($commname)" testecho "$N" "$TEST" "STDIO" "$EXEC:bin/cat2.sh|STDIO" "$opts -u -c$c" "$val_t" esac @@ -10686,7 +10910,7 @@ N=$((N+1)) NAME=${EXEC}2CHAIN_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) TEST="$NAME: $exec in chain with endpoint $exec ($commname)" testecho "$N" "$TEST" "STDIO" "$EXEC:bin/predialog.sh|$EXEC:./proxyecho.sh" "$opts -c$c" "$val_t" esac @@ -10694,7 +10918,7 @@ N=$((N+1)) NAME=${EXEC}1BI_FORWARD_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, forward ($commname)" testecho "$N" "$TEST" "STDIO" "${EXEC}1:cat%NOP|PIPE" "$opts -c$c" "$val_t" esac @@ -10702,7 +10926,7 @@ N=$((N+1)) NAME=${EXEC}1UNI_FORWARD_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in unrectional chain, forward ($commname)" testecho "$N" "$TEST" "STDIN" "${EXEC}1:cat|STDOUT" "$opts -u -c$c" "$val_t" esac @@ -10710,7 +10934,7 @@ N=$((N+1)) NAME=${EXEC}1UNI_BACKWARD_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in unrectional chain, backward ($commname)" testecho "$N" "$TEST" "STDOUT" "^${EXEC}1:cat|STDIN" "$opts -U -c$c" "$val_t" esac @@ -10721,7 +10945,7 @@ case "$commname" in *) NAME=${EXEC}1BI_FORWARD_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, forward ($commname)" testod "$N" "$TEST" "STDIO" "${EXEC}1:$OD_C%NOP|PIPE" "$opts -c$c" "$val_t" esac @@ -10734,7 +10958,7 @@ case "$commname" in *) NAME=${EXEC}1UNI_FORWARD_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in unrectional chain, forward ($commname)" testod "$N" "$TEST" "STDIN" "${EXEC}1:$OD_C|STDOUT" "$opts -u -c$c" "$val_t" esac @@ -10747,7 +10971,7 @@ case "$commname" in *) NAME=${EXEC}1UNI_BACKWARD_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in unrectional chain, backward ($commname)" testod "$N" "$TEST" "STDOUT" "^${EXEC}1:$OD_C|STDIN" "$opts -U -c$c" "$val_t" esac @@ -10758,7 +10982,7 @@ esac if [ "$commname" != "pipes" ]; then NAME=${EXEC}2REV_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) TEST="$NAME: bidirectional reverse $exec in simple chain ($commname)" testecho "$N" "$TEST" "STDIO" "^$EXEC:bin/cat2.sh|PIPE" "$opts -c$c" "$val_t" esac @@ -10768,7 +10992,7 @@ fi # ! pipes if [ "$commname" != "pipes" ]; then NAME=${EXEC}2UNIREV_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) TEST="$NAME: unidirectional reverse $exec in simple chain ($commname)" testecho "$N" "$TEST" "STDIO" "^$EXEC:bin/cat2.sh|STDIO" "$opts -u -c$c" "$val_t" esac @@ -10781,7 +11005,7 @@ case "$commname" in *) NAME=${EXEC}2DUAL_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}2%*|*%$NAME%*) TEST="$NAME: dual $exec in simple chain ($commname)" testecho "$N" "$TEST" "STDIO" "$EXEC:bin/cat2.sh%$EXEC:bin/cat2.sh|PIPE" "$opts -c$c" esac @@ -10796,7 +11020,7 @@ case "$commname" in *) NAME=${EXEC}1BI_BACKWARD_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, backward ($commname)" testecho "$N" "$TEST" "STDIO" "NOP%${EXEC}1:cat|PIPE" "$opts -c$c" "$val_t" esac @@ -10818,7 +11042,7 @@ case "$commname" in *) NAME=${EXEC}1BI_BACKWARD_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, backward ($commname)" testod "$N" "$TEST" "STDIO" "NOP%${EXEC}1:$OD_C|PIPE" "$opts -c$c" "$val_t" esac @@ -10833,7 +11057,7 @@ case "$commname" in # single fd communication has an implicit half close problem NAME=${EXEC}1BI_CAT_OD_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, both directions ($commname)" testod "$N" "$TEST" "STDIO" "${EXEC}1:$SOCAT -u - -%${EXEC}1:$OD_C|PIPE" "$opts -c$c" "$val_t" esac @@ -10843,7 +11067,7 @@ esac NAME=${EXEC}1BI_BOTH_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, both directions ($commname)" testecho "$N" "$TEST" "STDIO" "${EXEC}1:cat%${EXEC}1:cat|PIPE" "$opts -c$c" "$val_t" esac @@ -10854,7 +11078,7 @@ case "$commname" in *) NAME=${EXEC}1BI_OD_CAT_HALFCLOSE_$COMMNAME case "$TESTS" in -*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) +*%$N%*|*%functions%*|*%chain%*|*%$exec%*|*%${exec}1%*|*%$NAME%*) TEST="$NAME: ${exec}1 in birectional chain, both directions ($commname)" testod "$N" "$TEST" "STDIO" "${EXEC}1:$OD_C%${EXEC}1:cat|PIPE" "$opts -c$c" "$val_t" esac @@ -10883,7 +11107,7 @@ t TCP # than 512 bytes. NAME=HOSTNAMEOVFL case "$TESTS" in -*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) TEST="$NAME: stack overflow on overly long host name" # provide a long host name to TCP-CONNECT and check socats exit code if ! eval $NUMCOND; then :; else @@ -10906,6 +11130,7 @@ else echo "$CMD0" cat "${te}0" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -10919,7 +11144,7 @@ N=$((N+1)) # than 512 bytes. NAME=FILENAMEOVFL case "$TESTS" in -*%functions%*|*%bugs%*|*%security%*|*%openssl%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%openssl%*|*%$NAME%*) TEST="$NAME: stack overflow on overly long file name" # provide a 600 bytes long key file option to SSL-CONNECT and check socats exit code if ! eval $NUMCOND; then :; else @@ -10940,6 +11165,7 @@ else echo "$CMD0" cat "${te}0" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -10952,7 +11178,7 @@ N=$((N+1)) # domain socket with GOPEN NAME=GOPEN_UNIX_CRASH case "$TESTS" in -*%functions%*|*%bugs%*|*%gopen%*|*%unix%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%gopen%*|*%unix%*|*%socket%*|*%$NAME%*) TEST="$NAME: check crash when connecting to a unix domain socket using address GOPEN" # a unix domain server is started in background. the check process connects to # its socket. when this process crashes or issues a warning the bug is present. @@ -10981,6 +11207,7 @@ if [ $rc1 -ne 0 ]; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif grep -q ' W ' "${te}1"; then $PRINTF "$FAILED\n" echo "$CMD0 &" @@ -10988,6 +11215,7 @@ elif grep -q ' W ' "${te}1"; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif ! echo "$da" |diff - ${tf}1 >"$tdiff"; then $PRINTF "$FAILED\n" echo "$CMD0 &" @@ -10996,6 +11224,7 @@ elif ! echo "$da" |diff - ${tf}1 >"$tdiff"; then cat "${te}1" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -11009,7 +11238,7 @@ N=$((N+1)) # test if socat keeps an existing file where it wanted to create a UNIX socket NAME=UNIXLISTEN_KEEPFILE case "$TESTS" in -*%functions%*|*%bugs%*|*%unix%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%unix%*|*%socket%*|*%$NAME%*) TEST="$NAME: socat keeps an existing file where it wanted to create a UNIX socket" # we create a file and start socat with UNIX-LISTEN on this file. expected # behaviour: socat exits immediately with error, but keeps the file @@ -11030,6 +11259,7 @@ else echo "$CMD0" cat "${te}0" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11040,7 +11270,7 @@ N=$((N+1)) # incomplete writes were reported but led to data loss NAME=INCOMPLETE_WRITE case "$TESTS" in -*%functions%*|*%bugs%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%$NAME%*) TEST="$NAME: check if incomplete writes are handled properly" # write to a nonblocking fd a block that is too large for atomic write # and check if all data arrives @@ -11075,6 +11305,7 @@ else $PRINTF "$FAILED\n" echo "transferred only $(cat $tw) of $bytes bytes" >&2 numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11084,7 +11315,7 @@ N=$((N+1)) NAME=OPENSSL_ANULL case "$TESTS" in -*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +*%$N%*|*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) TEST="$NAME: OpenSSL server with cipher aNULL " if ! eval $NUMCOND; then :; elif ! testaddrs openssl >/dev/null; then @@ -11113,6 +11344,7 @@ if ! echo "$da" |diff - "$tf" >"$tdiff"; then cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" else $PRINTF "$OK\n" if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi @@ -11129,7 +11361,7 @@ N=$((N+1)) # test the max-children option NAME=MAXCHILDREN case "$TESTS" in -*%functions%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%socket%*|*%$NAME%*) TEST="$NAME: max-children option" # start a listen process with max-children=1; connect with a client, let it # sleep some time before sending data; connect with second client that sends @@ -11167,6 +11399,7 @@ else cat "${te}2" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11180,7 +11413,7 @@ N=$((N+1)) # problem reported by Johan Thillemann NAME=READLINE_OVFL case "$TESTS" in -*%functions%*|*%bugs%*|*%security%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%$NAME%*) TEST="$NAME: test for buffer overflow in readline prompt handling" # address 1 is the readline where write data was handled erroneous # address 2 provides data to trigger the buffer overflow @@ -11208,6 +11441,7 @@ else echo "$CMD0" grep -v ^rc= "${te}0" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11221,7 +11455,7 @@ N=$((N+1)) # This file descriptor leak could be used for a denial of service attack. NAME=FDLEAK case "$TESTS" in -*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) TEST="$NAME: file descriptor leak with range option" # have a TCP-LISTEN with range option; connect with wrong source address until # "open files" limit would exceed. When server continues operation the bug is @@ -11255,6 +11489,7 @@ if [ $rc2 -ne 0 ]; then echo "$CMD2 &" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif [ -f "$tdiff" -a ! -s "$tdiff" ]; then $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -11267,6 +11502,7 @@ else cat "${te}1" cat "${te}2" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # ulimit -n fi # NUMCOND @@ -11280,7 +11516,7 @@ if false; then # this overflow is not reliably reproducable # socat up to 1.7.2.2 did not check the length of the PROXY-CONNECT command line paramters when copying them into the HTTP request buffer. This could lead to a buffer overflow. NAME=PROXY_ADDR_OVFL case "$TESTS" in -*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%socket%*|*%$NAME%*) TEST="$NAME: proxy address parameters overflow" # invoke socat PROXY-CONNECT with long proxy server and target server names. If it terminates with exit code >= 128 it is vulnerable # However, even if vulnerable it often does not crash. Therefore we try to use a boundary check program like ElectricFence; only with its help we can tell that clean run proofs absence of vulnerability @@ -11316,6 +11552,7 @@ else echo "$CMD1" cat "${te}" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;; @@ -11375,6 +11612,7 @@ if [ $rc1 -ne 0 ]; then cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" elif echo "$da" |diff - "$tf" >$tdiff; then $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -11382,6 +11620,7 @@ else $PRINTF "$FAILED\n" cat "$tdiff" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi if ! ls -l $f |diff "$td/test$N.$F.ls-l" -; then $PRINTF "${RED}this test changed properties of $f!${NORMAL}\n" @@ -11393,9 +11632,10 @@ esac N=$((N+1)) -echo "summary: $((N-1)) tests; $numOK ok, $numFAIL failed, $numCANT could not be performed" +echo "summary: $((N-1)) tests, $((numOK+numFAILD+numCANT)) chosen; $numOK ok, $numFAIL failed, $numCANT could not be performed" if [ "$numFAIL" -gt 0 ]; then + echo "FAILED: $listFAIL" exit 1 fi exit 0 @@ -11420,7 +11660,7 @@ exit # give a description of what is tested (a bugfix, a new feature...) NAME=SHORT_UNIQUE_TESTNAME case "$TESTS" in -*%functions%*|*%bugs%*|*%socket%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$NAME%*) TEST="$NAME: give a one line description of test" # describe how the test is performed, and what's the success criteria if ! eval $NUMCOND; then :; else @@ -11447,6 +11687,7 @@ else cat "${te}0" cat "${te}1" numFAIL=$((numFAIL+1)) + listFAIL="$listFAIL $N" fi fi # NUMCOND ;;