Simplify terminating ssl_server2 in test scripts

This commit is contained in:
Manuel Pégourié-Gonnard 2014-08-14 15:47:33 +02:00
parent db49330e08
commit 74b11702d7
2 changed files with 5 additions and 44 deletions

View File

@ -785,33 +785,8 @@ start_server() {
# terminate the running server (closing it cleanly if it is ours)
stop_server() {
case $SERVER_NAME in
[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
# auth will fail), so try every entry in $P_CIPHERS in turn (in
# case the first one is not implemented in this configuration)
for i in $P_CIPHERS; do
log "$P_CLI $P_CLIENT_ARGS request_page=SERVERQUIT auth_mode=none force_ciphersuite=$i"
"$P_CLI" $P_CLIENT_ARGS request_page=SERVERQUIT auth_mode=none \
force_ciphersuite=$i >/dev/null
if [ "$?" == 0 ]; then
break
fi
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
wait $PROCESS_ID 2>/dev/null
esac
if [ "$MEMCHECK" -gt 0 ]; then
if is_polar "$SERVER_CMD" && has_mem_err $SRV_OUT; then

View File

@ -179,23 +179,9 @@ run_test() {
CLI_EXIT=$?
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
if is_polar "$SRV_CMD"; then
# start watchdog in case SERVERQUIT fails
( sleep "$DOG_DELAY"; 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 \
crt_file=data_files/cli2.crt key_file=data_files/cli2.key \
>/dev/null 2>&1
wait $SRV_PID
kill $WATCHDOG_PID
wait $WATCHDOG_PID
else
# kill the server
kill $SRV_PID
wait $SRV_PID
fi
# check if the client and server went at least to the handshake stage
# (useful to avoid tests with only negative assertions and non-zero