diff --git a/IntegrationTests/run-single-test.sh b/IntegrationTests/run-single-test.sh index 2a80a7d0..36501029 100755 --- a/IntegrationTests/run-single-test.sh +++ b/IntegrationTests/run-single-test.sh @@ -22,6 +22,7 @@ set -o pipefail test="$1" tmp="$2" root="$3" +g_show_info="$4" here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "$here/test_functions.sh" diff --git a/IntegrationTests/run-tests.sh b/IntegrationTests/run-tests.sh index c6241ec9..0c66578c 100755 --- a/IntegrationTests/run-tests.sh +++ b/IntegrationTests/run-tests.sh @@ -61,7 +61,8 @@ shift $plugin_opts_ind filter="." verbose=false -while getopts "f:v" opt; do +show_info=false +while getopts "f:vi" opt; do case $opt in f) filter="$OPTARG" @@ -69,6 +70,9 @@ while getopts "f:v" opt; do v) verbose=true ;; + i) + show_info=true + ;; \?) usage exit 1 @@ -104,7 +108,7 @@ for f in tests_*; do test_tmp=$(mktemp -d "$tmp/test.tmp_XXXXXX") plugins_do test_begin "$t" "$f" start=$(date +%s) - if run_test "$here/run-single-test.sh" "$here/$f/$t" "$test_tmp" "$here/.."; then + if run_test "$here/run-single-test.sh" "$here/$f/$t" "$test_tmp" "$here/.." "$show_info"; then plugins_do test_ok "$(time_diff_to_now $start)" suite_ok=$((suite_ok+1)) if $verbose; then diff --git a/IntegrationTests/test_functions.sh b/IntegrationTests/test_functions.sh index ec8c36e1..2eafeb71 100644 --- a/IntegrationTests/test_functions.sh +++ b/IntegrationTests/test_functions.sh @@ -61,6 +61,18 @@ function assert_greater_than_or_equal() { fi } +g_has_previously_infoed=false + +function info() { + if $g_show_info; then + if ! $g_has_previously_infoed; then + echo >&3 || true # echo an extra newline so it looks better + g_has_previously_infoed=true + fi + echo >&3 "info: $*" || true + fi +} + function warn() { echo >&4 "warning: $*" } diff --git a/IntegrationTests/tests_04_performance/test_01_allocation_counts_for_http1.sh b/IntegrationTests/tests_04_performance/test_01_allocation_counts_for_http1.sh index a731cbe5..9b015ef4 100644 --- a/IntegrationTests/tests_04_performance/test_01_allocation_counts_for_http1.sh +++ b/IntegrationTests/tests_04_performance/test_01_allocation_counts_for_http1.sh @@ -64,6 +64,9 @@ for test in 1000_reqs_1_conn 1_reqs_1000_conn; do not_freed_allocations=$(grep "^$test.remaining_allocations:" "$tmp/output" | cut -d: -f2 | sed 's/ //g') max_allowed_env_name="MAX_ALLOCS_ALLOWED_$test" + info "$test: allocations not freed: $not_freed_allocations" + info "$test: total number of mallocs: $total_allocations" + assert_less_than "$not_freed_allocations" 5 # allow some slack assert_greater_than "$not_freed_allocations" -5 # allow some slack assert_greater_than "$total_allocations" 1000