test.sh: stderr; option -v (verbose); FDOUT_ERROR description

This commit is contained in:
Gerhard Rieger 2016-12-09 21:37:24 +01:00
parent 38ce0b9b46
commit 36f2afce7c
2 changed files with 17 additions and 8 deletions

View file

@ -2,6 +2,8 @@
testing: testing:
socks4echo.sh and socks4a-echo.sh hung with new bash with read -n socks4echo.sh and socks4a-echo.sh hung with new bash with read -n
test.sh: stderr; option -v (verbose); FDOUT_ERROR description
####################### V 1.7.3.1: ####################### V 1.7.3.1:
security: security:

23
test.sh
View file

@ -14,10 +14,12 @@
val_t=0.1 val_t=0.1
NUMCOND=true NUMCOND=true
#NUMCOND="test \$N -gt 70" #NUMCOND="test \$N -gt 70"
VERBOSE=
while [ "$1" ]; do while [ "$1" ]; do
case "X$1" in case "X$1" in
X-t?*) val_t="${1#-t}" ;; X-t?*) val_t="${1#-t}" ;;
X-t) shift; val_t="$1" ;; X-t) shift; val_t="$1" ;;
X-v) VERBOSE=1 ;; # show commands
X-n?*) NUMCOND="test \$N -eq ${1#-n}" ;; X-n?*) NUMCOND="test \$N -eq ${1#-n}" ;;
X-n) shift; NUMCOND="test \$N -eq $1" ;; X-n) shift; NUMCOND="test \$N -eq $1" ;;
X-N?*) NUMCOND="test \$N -gt ${1#-N}" ;; X-N?*) NUMCOND="test \$N -gt ${1#-N}" ;;
@ -1610,20 +1612,21 @@ testecho () {
# kill $rc2 2>/dev/null # kill $rc2 2>/dev/null
if [ "$(cat "$td/test$N.rc")" != 0 ]; then if [ "$(cat "$td/test$N.rc")" != 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n" $PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$TRACE $SOCAT $opts $arg1 $arg2" echo "$TRACE $SOCAT $opts $arg1 $arg2" >&2
cat "$te" cat "$te" >&2
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif echo "$da" |diff - "$tf" >"$tdiff" 2>&1; then elif echo "$da" |diff - "$tf" >"$tdiff" 2>&1; then
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ -n "$debug" ]; then cat $te; fi if [ "$verbose" ]; then echo "$SOCAT $opts $arg1 $arg2" >&2; fi
if [ -n "$debug" ]; then cat $te >&2; fi
numOK=$((numOK+1)) numOK=$((numOK+1))
else else
$PRINTF "$FAILED:\n" $PRINTF "$FAILED:\n"
echo "$TRACE $SOCAT $opts $arg1 $arg2" echo "$TRACE $SOCAT $opts $arg1 $arg2" >&2
cat "$te" cat "$te" >&2
echo diff: echo diff: >&2
cat "$tdiff" cat "$tdiff" >&2
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
fi fi
@ -12176,6 +12179,10 @@ kill $pid0 2>/dev/null; wait
if echo "$da" |diff - "${tf}1"; then if echo "$da" |diff - "${tf}1"; then
$PRINTF "$OK\n" $PRINTF "$OK\n"
numOK=$((numOK+1)) numOK=$((numOK+1))
if [ "$VERBOSE" ]; then
echo " $CMD0"
echo " echo \"$da\" |$CMD1"
fi
else else
$PRINTF "$FAILED\n" $PRINTF "$FAILED\n"
echo "$CMD0 &" echo "$CMD0 &"
@ -12194,7 +12201,7 @@ N=$((N+1))
done done
# give a description of what is tested (a bugfix, a new feature...) # test if option fdout in write only context issues an error
NAME=FDOUT_ERROR NAME=FDOUT_ERROR
case "$TESTS" in case "$TESTS" in
*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$NAME%*) *%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$NAME%*)