Extend ssl-opt.h so that run_test takes function

Extend the run_test function in ssl-opt.sh so that it accepts the -f
and -F options. These parameters take an argument which is the name of
a shell function that will be called by run_test and will be given the
client input and output debug log. The idea is that these functions are
defined by each test and they can be used to do some custom check
beyon those allowed by the pattern matching capabilities of the
run_test function.
This commit is contained in:
Andres Amaya Garcia 2017-09-06 15:38:07 +01:00 committed by Simon Butcher
parent 6bce9cb5ac
commit 93993defd1

View file

@ -357,9 +357,11 @@ detect_dtls() {
# Options: -s pattern pattern that must be present in server output
# -c pattern pattern that must be present in client output
# -u pattern lines after pattern must be unique in client output
# -f call shell function on client output
# -S pattern pattern that must be absent in server output
# -C pattern pattern that must be absent in client output
# -U pattern lines after pattern must be unique in server output
# -F call shell function on server output
run_test() {
NAME="$1"
shift 1
@ -546,6 +548,18 @@ run_test() {
return
fi
;;
"-F")
if ! $2 "$SRV_OUT"; then
fail "function call to '$2' failed on Server output"
return
fi
;;
"-f")
if ! $2 "$CLI_OUT"; then
fail "function call to '$2' failed on Client output"
return
fi
;;
*)
echo "Unknown test: $1" >&2