From 6507891e65e7f8aabc08f0e0196ebdd1f1b9891a Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 10 May 2016 10:50:43 +0100 Subject: [PATCH 1/3] Add ability to only run select numbered tests in ssl-opt.sh In order to reduce debugging time, allows you to only run interesting tests (by number) from the commandline. e.g. the command 'tests/ssl-opt.sh -n 246,258' will only run test 246 and 258 (as per the number in the log file names) --- tests/ssl-opt.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index c08af7b04..d8df4ea87 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -33,12 +33,15 @@ MEMCHECK=0 FILTER='.*' EXCLUDE='^$' +RUN_TEST_NUMBER='' + print_usage() { echo "Usage: $0 [options]" printf " -h|--help\tPrint this help.\n" printf " -m|--memcheck\tCheck memory leaks and errors.\n" printf " -f|--filter\tOnly matching tests are executed (default: '$FILTER')\n" printf " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')\n" + printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n" } get_options() { @@ -53,6 +56,9 @@ get_options() { -m|--memcheck) MEMCHECK=1 ;; + -n|--number) + shift; RUN_TEST_NUMBER=$1 + ;; -h|--help) print_usage exit 0 @@ -293,6 +299,13 @@ run_test() { print_name "$NAME" + # Do we only run numbered tests? + if [ "X$RUN_TEST_NUMBER" = "X" ]; then : + elif echo ",$RUN_TEST_NUMBER," | grep ",$TESTS," >/dev/null; then : + else + SKIP_NEXT="YES" + fi + # should we skip? if [ "X$SKIP_NEXT" = "XYES" ]; then SKIP_NEXT="NO" From 9911faa1b42dda8ec5fc8938f4e8791829a5d99c Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 10 May 2016 11:18:17 +0100 Subject: [PATCH 2/3] Add option to print test numbers in ssl-opt.sh output Allows for easy selection of tests based on numbers for use with the '-n' option --- tests/ssl-opt.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index d8df4ea87..37fad8640 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -33,6 +33,7 @@ MEMCHECK=0 FILTER='.*' EXCLUDE='^$' +SHOW_TEST_NUMBER=0 RUN_TEST_NUMBER='' print_usage() { @@ -42,6 +43,7 @@ print_usage() { printf " -f|--filter\tOnly matching tests are executed (default: '$FILTER')\n" printf " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')\n" printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n" + printf " -s|--show-numbers\tShow test numbers in front of test names\n" } get_options() { @@ -59,6 +61,9 @@ get_options() { -n|--number) shift; RUN_TEST_NUMBER=$1 ;; + -s|--show-numbers) + SHOW_TEST_NUMBER=1 + ;; -h|--help) print_usage exit 0 @@ -143,12 +148,19 @@ needs_more_time() { # print_name print_name() { - printf "$1 " - LEN=$(( 72 - `echo "$1" | wc -c` )) + TESTS=$(( $TESTS + 1 )) + LINE="" + + if [ "$SHOW_TEST_NUMBER" -gt 0 ]; then + LINE="$TESTS " + fi + + LINE="$LINE$1" + printf "$LINE " + LEN=$(( 72 - `echo "$LINE" | wc -c` )) for i in `seq 1 $LEN`; do printf '.'; done printf ' ' - TESTS=$(( $TESTS + 1 )) } # fail From 73b851d23b3d16515deca8ac0374b2df1d262d39 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 10 May 2016 11:47:13 +0100 Subject: [PATCH 3/3] Add option to preserve all logs in ssl-opt.sh Useful to also allow saving of correct logs in order to compare differences with failed logs --- tests/ssl-opt.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 37fad8640..e61025149 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -36,6 +36,8 @@ EXCLUDE='^$' SHOW_TEST_NUMBER=0 RUN_TEST_NUMBER='' +PRESERVE_LOGS=0 + print_usage() { echo "Usage: $0 [options]" printf " -h|--help\tPrint this help.\n" @@ -44,6 +46,7 @@ print_usage() { printf " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')\n" printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n" printf " -s|--show-numbers\tShow test numbers in front of test names\n" + printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n" } get_options() { @@ -64,6 +67,9 @@ get_options() { -s|--show-numbers) SHOW_TEST_NUMBER=1 ;; + -p|--preserve-logs) + PRESERVE_LOGS=1 + ;; -h|--help) print_usage exit 0 @@ -485,6 +491,11 @@ run_test() { # if we're here, everything is ok echo "PASS" + if [ "$PRESERVE_LOGS" -gt 0 ]; then + mv $SRV_OUT o-srv-${TESTS}.log + mv $CLI_OUT o-cli-${TESTS}.log + fi + rm -f $SRV_OUT $CLI_OUT $PXY_OUT }