Add client timeout to ssl-opt.sh and compat.sh
This commit is contained in:
parent
decaf0b182
commit
c0f6a692fb
2 changed files with 50 additions and 9 deletions
|
@ -806,6 +806,23 @@ cleanup() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# wait for client to terminate and set EXIT
|
||||||
|
# must be called right after starting the client
|
||||||
|
wait_client_done() {
|
||||||
|
CLI_PID=$!
|
||||||
|
|
||||||
|
( sleep "$DOG_DELAY"; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) &
|
||||||
|
WATCHDOG_PID=$!
|
||||||
|
|
||||||
|
wait $CLI_PID
|
||||||
|
EXIT=$?
|
||||||
|
|
||||||
|
kill $WATCHDOG_PID
|
||||||
|
wait $WATCHDOG_PID
|
||||||
|
|
||||||
|
echo "EXIT: $EXIT" >> $CLI_OUT
|
||||||
|
}
|
||||||
|
|
||||||
# run_client <name> <cipher>
|
# run_client <name> <cipher>
|
||||||
run_client() {
|
run_client() {
|
||||||
# announce what we're going to do
|
# announce what we're going to do
|
||||||
|
@ -823,8 +840,8 @@ run_client() {
|
||||||
CLIENT_CMD="$OPENSSL_CMD s_client $O_CLIENT_ARGS -cipher $2"
|
CLIENT_CMD="$OPENSSL_CMD s_client $O_CLIENT_ARGS -cipher $2"
|
||||||
log "$CLIENT_CMD"
|
log "$CLIENT_CMD"
|
||||||
echo "$CLIENT_CMD" > $CLI_OUT
|
echo "$CLIENT_CMD" > $CLI_OUT
|
||||||
( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> $CLI_OUT 2>&1
|
( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> $CLI_OUT 2>&1 &
|
||||||
EXIT=$?
|
wait_client_done
|
||||||
|
|
||||||
if [ "$EXIT" == "0" ]; then
|
if [ "$EXIT" == "0" ]; then
|
||||||
RESULT=0
|
RESULT=0
|
||||||
|
@ -841,8 +858,8 @@ run_client() {
|
||||||
CLIENT_CMD="$GNUTLS_CLI $G_CLIENT_ARGS --priority $G_PRIO_MODE:$2 localhost"
|
CLIENT_CMD="$GNUTLS_CLI $G_CLIENT_ARGS --priority $G_PRIO_MODE:$2 localhost"
|
||||||
log "$CLIENT_CMD"
|
log "$CLIENT_CMD"
|
||||||
echo "$CLIENT_CMD" > $CLI_OUT
|
echo "$CLIENT_CMD" > $CLI_OUT
|
||||||
( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> $CLI_OUT 2>&1
|
( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> $CLI_OUT 2>&1 &
|
||||||
EXIT=$?
|
wait_client_done
|
||||||
|
|
||||||
if [ "$EXIT" == "0" ]; then
|
if [ "$EXIT" == "0" ]; then
|
||||||
RESULT=0
|
RESULT=0
|
||||||
|
@ -866,8 +883,8 @@ run_client() {
|
||||||
fi
|
fi
|
||||||
log "$CLIENT_CMD"
|
log "$CLIENT_CMD"
|
||||||
echo "$CLIENT_CMD" > $CLI_OUT
|
echo "$CLIENT_CMD" > $CLI_OUT
|
||||||
$CLIENT_CMD >> $CLI_OUT 2>&1
|
$CLIENT_CMD >> $CLI_OUT 2>&1 &
|
||||||
EXIT=$?
|
wait_client_done
|
||||||
|
|
||||||
case $EXIT in
|
case $EXIT in
|
||||||
"0") RESULT=0 ;;
|
"0") RESULT=0 ;;
|
||||||
|
@ -962,6 +979,13 @@ PORT="1$(echo $PORT | tail -c 5)"
|
||||||
SRV_OUT="srv_out.$$"
|
SRV_OUT="srv_out.$$"
|
||||||
CLI_OUT="cli_out.$$"
|
CLI_OUT="cli_out.$$"
|
||||||
|
|
||||||
|
# client timeout delay: be more patient with valgrind
|
||||||
|
if [ "$MEMCHECK" -gt 0 ]; then
|
||||||
|
DOG_DELAY=30
|
||||||
|
else
|
||||||
|
DOG_DELAY=10
|
||||||
|
fi
|
||||||
|
|
||||||
trap cleanup INT TERM HUP
|
trap cleanup INT TERM HUP
|
||||||
|
|
||||||
for VERIFY in $VERIFIES; do
|
for VERIFY in $VERIFIES; do
|
||||||
|
|
|
@ -150,6 +150,23 @@ wait_server_start() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# wait for client to terminate and set CLI_EXIT
|
||||||
|
# must be called right after starting the client
|
||||||
|
wait_client_done() {
|
||||||
|
CLI_PID=$!
|
||||||
|
|
||||||
|
( sleep "$DOG_DELAY"; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) &
|
||||||
|
WATCHDOG_PID=$!
|
||||||
|
|
||||||
|
wait $CLI_PID
|
||||||
|
CLI_EXIT=$?
|
||||||
|
|
||||||
|
kill $WATCHDOG_PID
|
||||||
|
wait $WATCHDOG_PID
|
||||||
|
|
||||||
|
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: run_test name srv_cmd cli_cmd cli_exit [option [...]]
|
# Usage: run_test name srv_cmd cli_cmd cli_exit [option [...]]
|
||||||
# Options: -s pattern pattern that must be present in server output
|
# Options: -s pattern pattern that must be present in server output
|
||||||
# -c pattern pattern that must be present in client output
|
# -c pattern pattern that must be present in client output
|
||||||
|
@ -192,10 +209,10 @@ run_test() {
|
||||||
$SRV_CMD >> $SRV_OUT 2>&1 &
|
$SRV_CMD >> $SRV_OUT 2>&1 &
|
||||||
SRV_PID=$!
|
SRV_PID=$!
|
||||||
wait_server_start
|
wait_server_start
|
||||||
|
|
||||||
echo "$CLI_CMD" > $CLI_OUT
|
echo "$CLI_CMD" > $CLI_OUT
|
||||||
eval "$CLI_CMD" >> $CLI_OUT 2>&1
|
eval "$CLI_CMD" >> $CLI_OUT 2>&1 &
|
||||||
CLI_EXIT=$?
|
wait_client_done
|
||||||
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
|
|
||||||
|
|
||||||
# kill the server
|
# kill the server
|
||||||
kill $SRV_PID
|
kill $SRV_PID
|
||||||
|
|
Loading…
Reference in a new issue