@@ -12,9 +12,10 @@ error() {
1212[[ -z $_Dbg_DEBUGGER_LEVEL ]] && trap ' error $LINENO' ERR
1313
1414HERE=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
15- . $HERE /../../opt/readies/shibumi/functions
15+ export ROOT=$( cd $HERE /../..; pwd)
16+ . $ROOT /opt/readies/shibumi/functions
1617
17- export ROOT= $( realpath $ HERE/../.. )
18+ cd $ HERE
1819
1920# ----------------------------------------------------------------------------------------------
2021
@@ -34,6 +35,7 @@ help() {
3435 SLAVES=0|1 Tests with --test-slaves
3536
3637 TEST=test Run specific test (e.g. test.py:test_name)
38+ LOG=0|1 Write to log
3739 VALGRIND|VGD=1 Run with Valgrind
3840 CALLGRIND|CGD=1 Run with Callgrind
3941
@@ -69,13 +71,25 @@ valgrind_config() {
6971 VALGRIND_SUPRESSIONS=$ROOT /opt/redis_valgrind.sup
7072
7173 RLTEST_ARGS+=" \
72- --no-output-catch \
7374 --use-valgrind \
7475 --vg-no-fail-on-errors \
75- --vg-verbose \
7676 --vg-suppressions $VALGRIND_SUPRESSIONS "
7777}
7878
79+ valgrind_summary () {
80+ # Collect name of each flow log that contains leaks
81+ FILES_WITH_LEAKS=$( grep -l " definitely lost" logs/* .valgrind.log)
82+ if [[ ! -z $FILES_WITH_LEAKS ]]; then
83+ echo " Memory leaks introduced in flow tests."
84+ echo $FILES_WITH_LEAKS
85+ # Print the full Valgrind output for each leaking file
86+ echo $FILES_WITH_LEAKS | xargs cat
87+ exit 1
88+ else
89+ echo Valgrind test ok
90+ fi
91+ }
92+
7993# ----------------------------------------------------------------------------------------------
8094
8195run_tests () {
@@ -107,8 +121,11 @@ MODULE=${MODULE:-$1}
107121[[ $VALGRIND == 1 || $VGD == 1 ]] && valgrind_config
108122
109123if [[ ! -z $TEST ]]; then
110- RLTEST_ARGS+=" --test $TEST -s"
111- export PYDEBUG=${PYDEBUG:- 1}
124+ RLTEST_ARGS+=" --test $TEST "
125+ if [[ $LOG != 1 ]]; then
126+ RLTEST_ARGS+=" -s"
127+ export PYDEBUG=${PYDEBUG:- 1}
128+ fi
112129fi
113130
114131[[ $VERBOSE == 1 ]] && RLTEST_ARGS+=" -v"
@@ -124,5 +141,7 @@ check_redis_server
124141[[ ! -z $REDIS ]] && RL_TEST_ARGS+=" --env exiting-env --existing-env-addr $REDIS " run_tests " redis-server: $REDIS "
125142[[ $GEN == 1 ]] && run_tests
126143[[ $CLUSTER == 1 ]] && RLTEST_ARGS+=" --env oss-cluster --shards-count 1" run_tests " --env oss-cluster"
127- [[ $SLAVES == 1 ]] && RLTEST_ARGS+=" --use-slaves" run_tests " --use-slaves"
128- [[ $AOF == 1 ]] && RLTEST_ARGS+=" --use-aof" run_tests " --use-aof"
144+ [[ $VALGRIND != 1 && $SLAVES == 1 ]] && RLTEST_ARGS+=" --use-slaves" run_tests " --use-slaves"
145+ [[ $AOF == 1 ]] && RLTEST_ARGS+=" --use-aof" run_tests " --use-aof"
146+ [[ $VALGRIND == 1 ]] && valgrind_summary
147+ exit 0
0 commit comments