[sheepdog] [PATCH stable-0.6 14/22] tests/functional: add support for specifying valgrind options

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Aug 12 16:55:18 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

This enables us to run valgrind with user defined options.

For example, to do the valgrind test on the small memory (less than 2
GB) machine, try the following command:

 # VALGRIND_OPTIONS="--freelist-vol=10000000 --freelist-big-blocks=0" ./check -valgrind

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 tests/functional/common.config | 1 +
 tests/functional/common.rc     | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/functional/common.config b/tests/functional/common.config
index ccae891..1fc2825 100644
--- a/tests/functional/common.config
+++ b/tests/functional/common.config
@@ -80,6 +80,7 @@ export SHEEP=${SHEEP:-$SHEEP_PROG}
 export SHEEP_OPTIONS=${SHEEP_OPTIONS:-"-n -y 127.0.0.1 -d"}
 export COLLIE_PROG=${COLLIE_PROG:-../../collie/collie}
 export COLLIE=${COLLIE:-$COLLIE_PROG}
+export VALGRIND_OPTIONS=${VALGRIND_OPTIONS:-"-q"}
 export MD=${MD:-false}
 
 # make sure this script returns success
diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index 1ef9992..20c8b9d 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -228,7 +228,8 @@ _valgrind_sheep()
     # Dump a core file and stop the script on the first valgrind error.
     local db_cmd="gdb -nw --ex \"generate-core-file ${dir}/core\" %f %p > /dev/null; \
             echo \"core dumped (${dir}/core)\"; kill \$PPID"
-    local opts="--db-attach=yes --db-command='${db_cmd}' --suppressions=valgrind.supp -q"
+    local opts="--db-attach=yes --db-command='${db_cmd}' \
+            --suppressions=valgrind.supp ${VALGRIND_OPTIONS}"
 
     rm -f ${dir}/lock
     sh -c "echo y | valgrind ${opts} $SHEEP_PROG $* -f -o 2>> ${dir}/sheep.log &"
@@ -249,7 +250,7 @@ _valgrind_sheep()
 _valgrind_collie()
 {
     local logfile=$(mktemp)
-    valgrind --log-file=$logfile --error-exitcode=99 -q $COLLIE_PROG $*
+    valgrind --log-file=$logfile --error-exitcode=99 ${VALGRIND_OPTIONS} $COLLIE_PROG $*
     local ret=$?
     if [ $ret == 99 ]; then
         cat $logfile 1>&2
-- 
1.8.1.2




More information about the sheepdog mailing list