From 417d46cdb0e68b143d641847442b3d2cbafa6131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 13 Mar 2014 19:17:53 +0100 Subject: [PATCH] Add --filter, --exclude to ssl-opt.sh --- tests/ssl-opt.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index a5932fb05..51e2e0b79 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -22,16 +22,26 @@ TESTS=0 FAILS=0 MEMCHECK=0 +FILTER='.*' +EXCLUDE='SSLv2' # disabled by default, needs OpenSSL compiled with SSLv2 print_usage() { echo "Usage: $0 [options]" - echo -e " -h, --help\tPrint this help." - echo -e " -m, --memcheck\tCheck memory leaks and errors." + echo -e " -h|--help\tPrint this help." + echo -e " -m|--memcheck\tCheck memory leaks and errors." + echo -e " -f|--filter\tOnly matching tests are executed (default: '$FILTER')" + echo -e " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')" } get_options() { while [ $# -gt 0 ]; do case "$1" in + -f|--filter) + shift; FILTER=$1 + ;; + -e|--exclude) + shift; EXCLUDE=$1 + ;; -m|--memcheck) MEMCHECK=1 ;; @@ -100,6 +110,11 @@ run_test() { CLI_EXPECT="$4" shift 4 + if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : + else + return + fi + print_name "$NAME" # prepend valgrind to our commands if active