From b53a9afba72265cbd4084e5dc66ffc1d4a52c9e7 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 1 Nov 2008 19:04:46 +0100 Subject: [PATCH] stabilized test IP4MULTICAST_UNIDIR; added tests OPENSSL_SCTPx_FORK; minor improvements --- CHANGES | 2 +- test.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- xiohelp.c | 10 ++++----- xioopts.h | 1 + 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index b6a155b..1b33dc8 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ new features: address chains consisting of inter and endpoint addresses, linked with '|' (pipe character) - reverting inter addresses + reverse inter addresses dual type inter addresses diff --git a/test.sh b/test.sh index f1510e6..d3d46c3 100755 --- a/test.sh +++ b/test.sh @@ -8044,10 +8044,10 @@ printf "test $F_n $TEST... " $N $CMD1 2>"${te}1" >"${tf}" & pid1="$!" waitip4proto $ts1p 1 -usleep $MICROS +usleep $((10*MICROS)) echo "$da" |$CMD2 2>>"${te}2" rc2="$?" -usleep $MICROS +usleep $((10*MICROS)) kill "$pid1" 2>/dev/null; wait; if [ "$rc2" -ne 0 ]; then $PRINTF "$FAILED: $SOCAT:\n" @@ -10139,6 +10139,65 @@ PORT=$((PORT+1)) N=$((N+1)) +while read KEYW PF LO +do +if [ -z "$KEYW" ] || [[ "$KEYW" == \#* ]]; then continue; fi +# +pf="$(echo $PF |tr A-Z a-z)" +proto="$(echo $KEYW |tr A-Z a-z)" +NAME=OPENSSL_${KEYW}_FORK +case "$TESTS" in +*%functions%*|*%openssl%*|*%sctp%*|*%$pf%*|*%$NAME%*) +TEST="$NAME: openssl over SCTP with server fork" +if ! eval $NUMCOND; then :; +elif ! testaddrs openssl >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}OPENSSL not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) +elif ! testaddrs listen sctp $pf >/dev/null || ! runs$pf >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}SCTP/$PF not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) +else +gentestcert testsrv +tf="$td/test$N.stdout" +te="$td/test$N.stderr" +tdiff="$td/test$N.diff" +da1="test$N $(date) $RANDOM" +da2="test$N $(date) $RANDOM" +CMD0="$SOCAT $opts ${KEYW}-LISTEN:$PORT,reuseaddr,fork ^OPENSSL-LISTEN,$SOCAT_EGD',cert=testsrv.crt,key=testsrv.key,verify=0|pipe'" +CMD1="$SOCAT $opts - openssl,verify=0,$SOCAT_EGD|${KEYW}:$LOCALHOST:$PORT" +printf "test $F_n $TEST... " $N +eval "$CMD0 2>\"${te}0\" &" +pid0=$! # background process id +wait${proto}port $PORT +(echo "$da1"; sleep 1) |$CMD1 >${tf}1 2>"${te}1" +(echo "$da2"; sleep 1) |$CMD1 >${tf}2 2>"${te}2" +kill $pid0 2>/dev/null +if ! echo "$da2" |diff - "${tf}2" >"$tdiff"; then + $PRINTF "$FAILED: $SOCAT:\n" + echo "$CMD0 &" + echo "$CMD1" + cat "${te}0" + cat "${te}1" + cat "${te}2" + cat "$tdiff" + numFAIL=$((numFAIL+1)) +else + $PRINTF "$OK\n" + if [ -n "$debug" ]; then cat "${te}0" "${te}1" "${te}2"; fi + numOK=$((numOK+1)) +fi +wait +fi ;; # NUMCOND, feats +esac +PORT=$((PORT+1)) +N=$((N+1)) +# +done <<<" +SCTP4 IP4 127.0.0.1 +SCTP6 IP6 [::1] +" + + echo "summary: $((N-1)) tests; $numOK ok, $numFAIL failed, $numCANT could not be performed" if [ "$numFAIL" -gt 0 ]; then diff --git a/xiohelp.c b/xiohelp.c index 4732507..a135a83 100644 --- a/xiohelp.c +++ b/xiohelp.c @@ -18,18 +18,18 @@ static const char *optiontypenames[] = { "SHORT", "SIZE_T", "SOCKADDR", "UNSIGNED-INT", "UNSIGNED-LONG","UNSIGNED-SHORT","MODE_T", "GID_T", "UID_T", "INT[3]", "STRUCT-TIMEVAL", "STRUCT-TIMESPEC", - "DOUBLE", "STRING-NULL", "LONG-LONG", "OFF_T", + "DOUBLE", "STRING-NULL", "LONG:LONG", "OFF_T", "OFF64_T", "INT:INT", "INT:INTP", "INT:BIN", "INT:STRING", "INT:INT:INT", "INT:INT:BIN", "INT:INT:STRING", - "IP4NAME", + "IP4NAME", "STRING:STRING", #if HAVE_STRUCT_LINGER - "STRUCT-LINGER", + "STRUCT-LINGER", #endif #if HAVE_STRUCT_IP_MREQN - "STRUCT-IP_MREQN", + "STRUCT-IP_MREQN", #elif HAVE_STRUCT_IP_MREQ - "STRUCT-IP_MREQ", + "STRUCT-IP_MREQ", #endif } ; diff --git a/xioopts.h b/xioopts.h index ac2d31e..6276cc8 100644 --- a/xioopts.h +++ b/xioopts.h @@ -65,6 +65,7 @@ enum e_types { TYPE_INT_INT_STRING, /* 3 params: first and second are int, 3rd is string */ TYPE_IP4NAME, /* IPv4 hostname or address */ + TYPE_STRING2, /* string:string */ #if HAVE_STRUCT_LINGER TYPE_LINGER, /* struct linger */ #endif /* HAVE_STRUCT_LINGER */