mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 14:15:37 +00:00
Catch SERVERQUIT timeout in ssl test scripts
This commit is contained in:
parent
bc3b16c7e2
commit
32f8f4d1a0
|
@ -768,6 +768,10 @@ start_server() {
|
||||||
stop_server() {
|
stop_server() {
|
||||||
case $SERVER_NAME in
|
case $SERVER_NAME in
|
||||||
[Pp]olar*)
|
[Pp]olar*)
|
||||||
|
# start watchdog in case SERVERQUIT fails
|
||||||
|
( sleep 20; echo "SERVERQUIT TIMEOUT"; kill $MAIN_PID ) &
|
||||||
|
WATCHDOG_PID=$!
|
||||||
|
|
||||||
# we must force a PSK suite when in PSK mode (otherwise client
|
# we must force a PSK suite when in PSK mode (otherwise client
|
||||||
# auth will fail), so try every entry in $P_CIPHERS in turn (in
|
# auth will fail), so try every entry in $P_CIPHERS in turn (in
|
||||||
# case the first one is not implemented in this configuration)
|
# case the first one is not implemented in this configuration)
|
||||||
|
@ -779,12 +783,16 @@ stop_server() {
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
wait $PROCESS_ID 2>/dev/null
|
||||||
|
kill $WATCHDOG_PID 2>/dev/null
|
||||||
|
wait $WATCHDOG_PID 2>/dev/null
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
kill $PROCESS_ID 2>/dev/null
|
kill $PROCESS_ID 2>/dev/null
|
||||||
|
wait $PROCESS_ID 2>/dev/null
|
||||||
esac
|
esac
|
||||||
|
|
||||||
wait $PROCESS_ID 2>/dev/null
|
|
||||||
|
|
||||||
if [ "$MEMCHECK" -gt 0 ]; then
|
if [ "$MEMCHECK" -gt 0 ]; then
|
||||||
if is_polar "$SERVER_CMD" && has_mem_err $SRV_OUT; then
|
if is_polar "$SERVER_CMD" && has_mem_err $SRV_OUT; then
|
||||||
|
@ -952,6 +960,9 @@ for PEER in $PEERS; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# used by watchdog
|
||||||
|
MAIN_PID="$$"
|
||||||
|
|
||||||
# Pick a "unique" port in the range 10000-19999.
|
# Pick a "unique" port in the range 10000-19999.
|
||||||
PORT="0000$$"
|
PORT="0000$$"
|
||||||
PORT="1$(echo $PORT | tail -c 4)"
|
PORT="1$(echo $PORT | tail -c 4)"
|
||||||
|
|
|
@ -151,15 +151,23 @@ run_test() {
|
||||||
CLI_EXIT=$?
|
CLI_EXIT=$?
|
||||||
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
|
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
|
||||||
|
|
||||||
# psk is useful when server only has bad certs
|
|
||||||
if is_polar "$SRV_CMD"; then
|
if is_polar "$SRV_CMD"; then
|
||||||
|
# start watchdog in case SERVERQUIT fails
|
||||||
|
( sleep 10; echo "SERVERQUIT TIMEOUT"; kill $MAIN_PID ) &
|
||||||
|
WATCHDOG_PID=$!
|
||||||
|
|
||||||
|
# psk is useful when server only has bad certs
|
||||||
$P_CLI request_page=SERVERQUIT tickets=0 auth_mode=none psk=abc123 \
|
$P_CLI request_page=SERVERQUIT tickets=0 auth_mode=none psk=abc123 \
|
||||||
crt_file=data_files/cli2.crt key_file=data_files/cli2.key \
|
crt_file=data_files/cli2.crt key_file=data_files/cli2.key \
|
||||||
>/dev/null
|
>/dev/null
|
||||||
|
|
||||||
|
wait $SRV_PID
|
||||||
|
kill $WATCHDOG_PID
|
||||||
|
wait $WATCHDOG_PID
|
||||||
else
|
else
|
||||||
kill $SRV_PID
|
kill $SRV_PID
|
||||||
|
wait $SRV_PID
|
||||||
fi
|
fi
|
||||||
wait $SRV_PID
|
|
||||||
|
|
||||||
# check if the client and server went at least to the handshake stage
|
# check if the client and server went at least to the handshake stage
|
||||||
# (useful to avoid tests with only negative assertions and non-zero
|
# (useful to avoid tests with only negative assertions and non-zero
|
||||||
|
@ -276,6 +284,9 @@ if which $OPENSSL_CMD >/dev/null 2>&1; then :; else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# used by watchdog
|
||||||
|
MAIN_PID="$$"
|
||||||
|
|
||||||
# Pick a "unique" port in the range 10000-19999.
|
# Pick a "unique" port in the range 10000-19999.
|
||||||
PORT="0000$$"
|
PORT="0000$$"
|
||||||
PORT="1$(echo $PORT | tail -c 4)"
|
PORT="1$(echo $PORT | tail -c 4)"
|
||||||
|
|
Loading…
Reference in a new issue