Code

integration tests: Run all invocations through valgrind's memcheck.
authorSebastian Harl <sh@tokkee.org>
Wed, 30 Apr 2014 09:43:24 +0000 (11:43 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 30 Apr 2014 09:46:05 +0000 (11:46 +0200)
… covering, both, sysdb and sysdbd. For that to work, copy the binaries and
libraries to the temp directory and change the rpath to point to the temp
directory. This ensures the test is independent of any configure flags and
installation directories.

Let the tests fail if a leak (or other error) was detected by valgrind.

.travis.yml
t/integration/simple_config.sh
t/integration/simple_query.sh
t/integration/test_lib.sh

index 87badb67b5e6da759f1a72b8eb031f8740e321f5..f91c75f5387db8e0308d497b3696693a76a0312e 100644 (file)
@@ -11,6 +11,7 @@ before_install:
 install:
   - sudo apt-get install -qq check flex bison libtool libltdl-dev
   - sudo apt-get install -qq libdbi-dev libedit-dev libreadline-dev
+  - sudo apt-get install -qq valgrind chrpath
   - sudo pip install cpp-coveralls
   - pip show cpp-coveralls
 script: ./t/cibuild.sh
index ce3c4eb26d175556437bf1a50afc123504f3da0a..e6daddcf218ead9688be7aab56d1c95e28b5941b 100755 (executable)
@@ -37,7 +37,7 @@ cat <<EOF > "$SYSDBD_CONF"
 Listen "invalid://address"
 EOF
 
-if "$SYSDBD" -D -C "$SYSDBD_CONF"; then
+if $SYSDBD -D -C "$SYSDBD_CONF"; then
        echo 'SysDBd accepted invalid listen address; expected: failure' >&2
        exit 1
 fi
@@ -46,7 +46,7 @@ cat <<EOF > "$SYSDBD_CONF"
 Listen "$SOCKET_FILE"
 EOF
 
-"$SYSDBD" -D -C "$SYSDBD_CONF" &
+$SYSDBD -D -C "$SYSDBD_CONF" &
 sysdbd_pid=$!
 
 wait_for_sysdbd
index 7c6277554577510e7bb7536d0be4c121ae74d07d..76b54d66e840f8333b51bebaff7ec2eb64fc7cbf 100755 (executable)
@@ -43,7 +43,7 @@ LoadBackend mock_plugin
 </Backend>
 EOF
 
-"$SYSDBD" -D -C "$SYSDBD_CONF" &
+$SYSDBD -D -C "$SYSDBD_CONF" &
 sysdbd_pid=$!
 
 wait_for_sysdbd
index b91cb0c37edafbe939d5803bc6410cad656e8869..482b8ae52c25710bfa5f29939aa5d159f76e9bd7 100644 (file)
@@ -35,13 +35,23 @@ trap "rm -rf '$TESTDIR'" EXIT
 mkdir "$TESTDIR/backend"
 cp "$TOP_SRCDIR/t/integration/.libs/mock_plugin.so" "$TESTDIR/backend"
 
+cp src/.libs/sysdb src/.libs/sysdbd "$TESTDIR"
+cp src/.libs/libsysdb*.so* "$TESTDIR"
+chrpath -r "$TESTDIR" "$TESTDIR/sysdb" > /dev/null
+chrpath -r "$TESTDIR" "$TESTDIR/sysdbd" > /dev/null
+
+MEMCHECK="valgrind --quiet --tool=memcheck --error-exitcode=1"
+MEMCHECK="$MEMCHECK --trace-children=yes"
+MEMCHECK="$MEMCHECK --track-fds=yes"
+MEMCHECK="$MEMCHECK --leak-check=full"
+
 SYSDBD_CONF="$TESTDIR/sysdbd.conf"
 
 SOCKET_FILE="$TESTDIR/sock"
 PLUGIN_DIR="$TESTDIR"
 
-SYSDBD="$TOP_SRCDIR/src/sysdbd"
-SYSDB="$TOP_SRCDIR/src/sysdb"
+SYSDB="$MEMCHECK $TESTDIR/sysdb"
+SYSDBD="$MEMCHECK $TESTDIR/sysdbd"
 
 function wait_for_sysdbd() {
        local i