mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Fixed regression: use of ^^ or ,, in test.sh
This commit is contained in:
parent
12f7833a8f
commit
e310bb1cfd
2 changed files with 35 additions and 17 deletions
3
CHANGES
3
CHANGES
|
@ -30,6 +30,9 @@ Corrections:
|
||||||
multiple times.
|
multiple times.
|
||||||
Test: MULTIPLE_EOF
|
Test: MULTIPLE_EOF
|
||||||
|
|
||||||
|
Newer parts of test.sh used substitutions ${x,,*} or ${x^^*} that are
|
||||||
|
not implemented in older bash versions.
|
||||||
|
|
||||||
####################### V 1.7.3.3:
|
####################### V 1.7.3.3:
|
||||||
|
|
||||||
Corrections:
|
Corrections:
|
||||||
|
|
49
test.sh
49
test.sh
|
@ -67,6 +67,7 @@ export SOCAT_OPTS="$opts"
|
||||||
#debug="1"
|
#debug="1"
|
||||||
debug=
|
debug=
|
||||||
TESTS="$@"; export TESTS
|
TESTS="$@"; export TESTS
|
||||||
|
|
||||||
# for some tests we need a network interface
|
# for some tests we need a network interface
|
||||||
if type ip >/dev/null 2>&1; then
|
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/")
|
INTERFACE=$(ip r get 8.8.8.8 |grep ' dev ' |head -n 1 |sed "s/.*dev[[:space:]][[:space:]]*\([^[:space:]][^[:space:]]*\).*/\1/")
|
||||||
|
@ -148,6 +149,20 @@ rm -f testsrv6.{crt,key,pem}
|
||||||
CAT=cat
|
CAT=cat
|
||||||
OD_C="od -c"
|
OD_C="od -c"
|
||||||
|
|
||||||
|
toupper () {
|
||||||
|
case ${BASH_VERSION:0:1} in
|
||||||
|
[1-3]) echo "$@" |tr a-z A-Z ;;
|
||||||
|
[4-9]) echo "${@^^*}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
tolower () {
|
||||||
|
case ${BASH_VERSION:0:1} in
|
||||||
|
[1-3]) echo "$@" |tr A-Z a-z ;;
|
||||||
|
[4-9]) echo "${@,,*}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# precision sleep; takes seconds with fractional part
|
# precision sleep; takes seconds with fractional part
|
||||||
psleep () {
|
psleep () {
|
||||||
local T="$1"
|
local T="$1"
|
||||||
|
@ -215,7 +230,7 @@ else
|
||||||
SUBSTUSER="$(grep -v '^[^:]*:^[^:]*:0:' /etc/passwd |tail -n 1 |cut -d: -f1)"
|
SUBSTUSER="$(grep -v '^[^:]*:^[^:]*:0:' /etc/passwd |tail -n 1 |cut -d: -f1)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type ip >/dev/null; then
|
if type ip >/dev/null 2>&1; then
|
||||||
if ip -V |grep -q "^ip utility, iproute2-ss"; then
|
if ip -V |grep -q "^ip utility, iproute2-ss"; then
|
||||||
IP=$(which ip)
|
IP=$(which ip)
|
||||||
else
|
else
|
||||||
|
@ -223,7 +238,7 @@ if type ip >/dev/null; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type ss >/dev/null; then
|
if type ss >/dev/null 2>&1; then
|
||||||
if ss -V |grep -q "^ss utility, iproute2-ss"; then
|
if ss -V |grep -q "^ss utility, iproute2-ss"; then
|
||||||
SS=$(which ss)
|
SS=$(which ss)
|
||||||
else
|
else
|
||||||
|
@ -11393,7 +11408,7 @@ N=$((N+1))
|
||||||
|
|
||||||
while read KEYW FEAT ADDR IPPORT; do
|
while read KEYW FEAT ADDR IPPORT; do
|
||||||
if [ -z "$KEYW" ]|| [[ "$KEYW" == \#* ]]; then continue; fi
|
if [ -z "$KEYW" ]|| [[ "$KEYW" == \#* ]]; then continue; fi
|
||||||
RUNS=${KEYW,,*}
|
RUNS=$(tolower $KEYW)
|
||||||
PROTO=$KEYW
|
PROTO=$KEYW
|
||||||
proto="$(echo "$PROTO" |tr A-Z a-z)"
|
proto="$(echo "$PROTO" |tr A-Z a-z)"
|
||||||
# test the max-children option on really connection oriented sockets
|
# test the max-children option on really connection oriented sockets
|
||||||
|
@ -11410,7 +11425,7 @@ elif ! testaddrs "$FEAT" >/dev/null; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$FEAT not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$FEAT not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
elif ! runs$RUNS >/dev/null; then
|
elif ! runs$RUNS >/dev/null; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}${RUNS^^*} not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(toupper $RUNS) not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
case "X$IPPORT" in
|
case "X$IPPORT" in
|
||||||
|
@ -11475,7 +11490,7 @@ UNIX unix $td/test\$N.server -
|
||||||
|
|
||||||
while read KEYW FEAT ADDR IPPORT SHUT; do
|
while read KEYW FEAT ADDR IPPORT SHUT; do
|
||||||
if [ -z "$KEYW" ]|| [[ "$KEYW" == \#* ]]; then continue; fi
|
if [ -z "$KEYW" ]|| [[ "$KEYW" == \#* ]]; then continue; fi
|
||||||
RUNS=${KEYW,,*}
|
RUNS=$(tolower $KEYW)
|
||||||
PROTO=$KEYW
|
PROTO=$KEYW
|
||||||
proto="$(echo "$PROTO" |tr A-Z a-z)"
|
proto="$(echo "$PROTO" |tr A-Z a-z)"
|
||||||
# test the max-children option on pseudo connected sockets
|
# test the max-children option on pseudo connected sockets
|
||||||
|
@ -11493,7 +11508,7 @@ elif ! testaddrs "$FEAT" >/dev/null; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}$FEAT not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$FEAT not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
elif ! runs$RUNS >/dev/null; then
|
elif ! runs$RUNS >/dev/null; then
|
||||||
$PRINTF "test $F_n $TEST... ${YELLOW}${RUNS^^*} not available${NORMAL}\n" $N
|
$PRINTF "test $F_n $TEST... ${YELLOW}$(toupper $RUNS) not available${NORMAL}\n" $N
|
||||||
numCANT=$((numCANT+1))
|
numCANT=$((numCANT+1))
|
||||||
else
|
else
|
||||||
case "X$IPPORT" in
|
case "X$IPPORT" in
|
||||||
|
@ -11877,7 +11892,7 @@ N=$((N+1))
|
||||||
while read ssldist MODE MODULE FIELD TESTADDRESS PEERADDRESS VALUE; do
|
while read ssldist MODE MODULE FIELD TESTADDRESS PEERADDRESS VALUE; do
|
||||||
if [ -z "$ssldist" ] || [[ "$ssldist" == \#* ]]; then continue; fi
|
if [ -z "$ssldist" ] || [[ "$ssldist" == \#* ]]; then continue; fi
|
||||||
#
|
#
|
||||||
SSLDIST=${ssldist^^*}
|
SSLDIST=$(toupper $ssldist)
|
||||||
NAME="ENV_${SSLDIST}_${MODE}_${MODULE}_${FIELD}"
|
NAME="ENV_${SSLDIST}_${MODE}_${MODULE}_${FIELD}"
|
||||||
case "$TESTS" in
|
case "$TESTS" in
|
||||||
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$ssldist%*|*%envvar%*|*%$NAME%*)
|
*%$N%*|*%functions%*|*%ip4%*|*%ipapp%*|*%tcp%*|*%$ssldist%*|*%envvar%*|*%$NAME%*)
|
||||||
|
@ -11974,9 +11989,9 @@ while read addr fileopt addropts proto diropt ADDR2; do
|
||||||
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
||||||
# some passive (listening...) filesystem based addresses did not implement the
|
# some passive (listening...) filesystem based addresses did not implement the
|
||||||
# umask option
|
# umask option
|
||||||
ADDR=${addr^^*}
|
ADDR=$(toupper $addr)
|
||||||
ADDR_=${ADDR/-/_}
|
ADDR_=${ADDR/-/_}
|
||||||
PROTO=${proto^^*}
|
PROTO=$(toupper $proto)
|
||||||
if [ "$diropt" = "." ]; then diropt=; fi
|
if [ "$diropt" = "." ]; then diropt=; fi
|
||||||
if [ "$fileopt" = "." ]; then fileopt=; fi
|
if [ "$fileopt" = "." ]; then fileopt=; fi
|
||||||
if [ "$addropts" = "." ]; then addropts=; fi
|
if [ "$addropts" = "." ]; then addropts=; fi
|
||||||
|
@ -12047,9 +12062,9 @@ pipe . . file -u FILE:/dev/null
|
||||||
while read addr fileopt addropts proto diropt; do
|
while read addr fileopt addropts proto diropt; do
|
||||||
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
||||||
# test if passive (listening...) filesystem based addresses implement option perm
|
# test if passive (listening...) filesystem based addresses implement option perm
|
||||||
ADDR=${addr^^*}
|
ADDR=$(toupper $addr)
|
||||||
ADDR_=${ADDR/-/_}
|
ADDR_=${ADDR/-/_}
|
||||||
PROTO=${proto^^*}
|
PROTO=$(toupper $proto)
|
||||||
if [ "$diropt" = "." ]; then diropt=; fi
|
if [ "$diropt" = "." ]; then diropt=; fi
|
||||||
if [ "$fileopt" = "." ]; then fileopt=; fi
|
if [ "$fileopt" = "." ]; then fileopt=; fi
|
||||||
if [ "$addropts" = "." ]; then addropts=; fi
|
if [ "$addropts" = "." ]; then addropts=; fi
|
||||||
|
@ -12119,9 +12134,9 @@ pty link . file .
|
||||||
while read addr fileopt addropts proto diropt; do
|
while read addr fileopt addropts proto diropt; do
|
||||||
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
||||||
# test if passive (listening...) filesystem based addresses implement option user
|
# test if passive (listening...) filesystem based addresses implement option user
|
||||||
ADDR=${addr^^*}
|
ADDR=$(toupper $addr)
|
||||||
ADDR_=${ADDR/-/_}
|
ADDR_=${ADDR/-/_}
|
||||||
PROTO=${proto^^*}
|
PROTO=$(toupper $proto)
|
||||||
if [ "$diropt" = "." ]; then diropt=; fi
|
if [ "$diropt" = "." ]; then diropt=; fi
|
||||||
if [ "$fileopt" = "." ]; then fileopt=; fi
|
if [ "$fileopt" = "." ]; then fileopt=; fi
|
||||||
if [ "$addropts" = "." ]; then addropts=; fi
|
if [ "$addropts" = "." ]; then addropts=; fi
|
||||||
|
@ -12196,9 +12211,9 @@ while read addr fileopt addropts proto diropt crit ADDR2; do
|
||||||
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
||||||
# some passive (listening...) filesystem based addresses did not remove the file
|
# some passive (listening...) filesystem based addresses did not remove the file
|
||||||
# system entry at the end
|
# system entry at the end
|
||||||
ADDR=${addr^^*}
|
ADDR=$(toupper $addr)
|
||||||
ADDR_=${ADDR/-/_}
|
ADDR_=${ADDR/-/_}
|
||||||
PROTO=${proto^^*}
|
PROTO=$(toupper $proto)
|
||||||
if [ "$diropt" = "." ]; then diropt=; fi
|
if [ "$diropt" = "." ]; then diropt=; fi
|
||||||
if [ "$fileopt" = "." ]; then fileopt=; fi
|
if [ "$fileopt" = "." ]; then fileopt=; fi
|
||||||
if [ "$addropts" = "." ]; then addropts=; fi
|
if [ "$addropts" = "." ]; then addropts=; fi
|
||||||
|
@ -12264,9 +12279,9 @@ while read addr fileopt addropts proto diropt crit ADDR2; do
|
||||||
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi
|
||||||
# some passive (listening...) filesystem based addresses with fork did not remove
|
# some passive (listening...) filesystem based addresses with fork did not remove
|
||||||
# the file system entry at the end
|
# the file system entry at the end
|
||||||
ADDR=${addr^^*}
|
ADDR=$(toupper $addr)
|
||||||
ADDR_=${ADDR/-/_}
|
ADDR_=${ADDR/-/_}
|
||||||
PROTO=${proto^^*}
|
PROTO=$(toupper $proto)
|
||||||
if [ "$diropt" = "." ]; then diropt=; fi
|
if [ "$diropt" = "." ]; then diropt=; fi
|
||||||
if [ "$fileopt" = "." ]; then fileopt=; fi
|
if [ "$fileopt" = "." ]; then fileopt=; fi
|
||||||
if [ "$addropts" = "." ]; then addropts=; fi
|
if [ "$addropts" = "." ]; then addropts=; fi
|
||||||
|
|
Loading…
Reference in a new issue