[sheepdog] [PATCH 1/3] tests/functional: add support for specifying valgrind options

MORITA Kazutaka morita.kazutaka at gmail.com
Thu Jun 27 07:11:30 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>
---
 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 52a7e75..2fb3da4 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.7.9.5




More information about the sheepdog mailing list