From 93993defd1afee80cfbca5ca13039da5bd55a891 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Wed, 6 Sep 2017 15:38:07 +0100 Subject: [PATCH] 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. --- tests/ssl-opt.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 280fc6348..b349512cc 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -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