nbdkit/0006-Add-support-for-testing-under-valgrind.patch

897 lines
33 KiB
Diff
Raw Normal View History

From 271150d19fb222949763a5d562a4139c82f322b8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 9 Jul 2016 21:15:46 +0100
Subject: [PATCH 06/11] Add support for testing under valgrind.
Use 'make check-valgrind' to run all the tests under valgrind.
---
Makefile.am | 3 +++
README | 11 ++++++++++
configure.ac | 12 +++++++++++
tests/Makefile.am | 50 ++++++++++++++++++++++++++++++--------------
tests/test-captive.sh | 2 +-
tests/test-connect.sh | 34 ++++++++++++++++++++++++++++++
tests/test-dump-config.sh | 2 +-
tests/test-dump-plugin.sh | 2 +-
tests/test-file.sh | 34 ++++++++++++++++++++++++++++++
tests/test-foreground.sh | 2 +-
tests/test-gzip.sh | 34 ++++++++++++++++++++++++++++++
tests/test-help-plugin.sh | 2 +-
tests/test-help.sh | 2 +-
tests/test-ipv4.sh | 2 +-
tests/test-newstyle.sh | 34 ++++++++++++++++++++++++++++++
tests/test-ocaml.sh | 34 ++++++++++++++++++++++++++++++
tests/test-oldstyle.sh | 34 ++++++++++++++++++++++++++++++
tests/test-perl.sh | 34 ++++++++++++++++++++++++++++++
tests/test-python.sh | 34 ++++++++++++++++++++++++++++++
tests/test-random-sock.sh | 2 +-
tests/test-ruby.sh | 34 ++++++++++++++++++++++++++++++
tests/test-single.sh | 2 +-
tests/test-start.sh | 2 +-
tests/test-streaming.sh | 34 ++++++++++++++++++++++++++++++
tests/test-version-plugin.sh | 2 +-
tests/test-version.sh | 2 +-
tests/test-xz.sh | 34 ++++++++++++++++++++++++++++++
valgrind-suppressions | 32 ++++++++++++++++++++++++++++
28 files changed, 478 insertions(+), 28 deletions(-)
create mode 100755 tests/test-connect.sh
create mode 100755 tests/test-file.sh
create mode 100755 tests/test-gzip.sh
create mode 100755 tests/test-newstyle.sh
create mode 100755 tests/test-ocaml.sh
create mode 100755 tests/test-oldstyle.sh
create mode 100755 tests/test-perl.sh
create mode 100755 tests/test-python.sh
create mode 100755 tests/test-ruby.sh
create mode 100755 tests/test-streaming.sh
create mode 100755 tests/test-xz.sh
create mode 100644 valgrind-suppressions
diff --git a/Makefile.am b/Makefile.am
index aade60d..3c5c650 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,3 +40,6 @@ EXTRA_DIST = \
SUBDIRS = docs plugins include src tests
CLEANFILES = *~
+
+check-valgrind:
+ $(MAKE) -C tests check-valgrind
diff --git a/README b/README
index 4ea812c..135c8d5 100644
--- a/README
+++ b/README
@@ -78,6 +78,16 @@ For the OCaml plugin:
- OCaml >= 4.02.2 which has support for shared libraries, see:
http://caml.inria.fr/mantis/view.php?id=6693
+To test for memory leaks ('make check-valgrind'):
+
+ - valgrind
+
+For non-essential enhancements to the test suite:
+
+ - socat
+
+ - ss (from iproute package)
+
After installing any dependencies:
To build from tarball: To build from git:
@@ -86,6 +96,7 @@ After installing any dependencies:
./configure ./configure
make make
make check make check
+ make check-valgrind make check-valgrind
Optionally run this as root to install everything:
diff --git a/configure.ac b/configure.ac
index 3c75397..c064420 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,18 @@ or the configure test may be wrong.
The code will still compile, but is likely to leak memory and other
resources when it runs.])])
+dnl Check for valgrind.
+AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
+AS_IF([test "x$VALGRIND" != "xno"],[
+ # Substitute the whole valgrind command.
+ VG='$(VALGRIND) --vgdb=no --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no'
+],[
+ # Valgrind is not installed, substitute something which will break.
+ VG=VALGRIND_IS_NOT_INSTALLED
+])
+AC_SUBST([VG])
+AM_SUBST_NOTMAKE([VG])
+
dnl Check for Perl POD.
AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [no])
AM_CONDITIONAL([HAVE_POD2MAN], [test "x$POD2MAN" != "xno"])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6f6cfa2..afb9975 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,22 +36,38 @@ MAINTAINERCLEANFILES =
EXTRA_DIST = \
README.tests \
test-captive.sh \
+ test-connect.sh \
test-dump-config.sh \
test-dump-plugin.sh \
+ test-file.sh \
test-foreground.sh \
+ test-gzip.sh \
test-help.sh \
test-help-plugin.sh \
test-ipv4.sh \
- test.pl \
- test.py \
+ test-newstyle.sh \
test_ocaml_plugin.ml \
test-ocaml.c \
+ test-ocaml.sh \
+ test-oldstyle.sh \
+ test.pl \
+ test-perl.sh \
+ test.py \
+ test-python.sh \
test.rb \
test-single.sh \
test-start.sh \
test-random-sock.sh \
+ test-ruby.sh \
+ test-streaming.sh \
test-version.sh \
- test-version-plugin.sh
+ test-version-plugin.sh \
+ test-xz.sh
+
+# Use 'make check' to run the ordinary tests. To run all the tests
+# under valgrind, use the following rule:
+check-valgrind:
+ $(MAKE) VG="@VG@" check
# Basic server command line and start-up tests.
@@ -87,19 +103,21 @@ check_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test.c test.h
libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
-# Basic connection test.
-check_PROGRAMS = test-connect
-TESTS += test-connect
+check_PROGRAMS =
check_DATA =
check_SCRIPTS =
+# Basic connection test.
+check_PROGRAMS += test-connect
+TESTS += test-connect.sh
+
test_connect_SOURCES = test-connect.c test.h
test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
test_connect_LDADD = libtest.la $(LIBGUESTFS_LIBS)
# file plugin test.
check_PROGRAMS += test-file
-TESTS += test-file
+TESTS += test-file.sh
check_DATA += file-data
MAINTAINERCLEANFILES += file-data
@@ -114,7 +132,7 @@ file-data:
# newstyle protocol test.
check_PROGRAMS += test-newstyle
-TESTS += test-newstyle
+TESTS += test-newstyle.sh
test_newstyle_SOURCES = test-newstyle.c test.h
test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
@@ -122,7 +140,7 @@ test_newstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS)
# oldstyle protocol test.
check_PROGRAMS += test-oldstyle
-TESTS += test-oldstyle
+TESTS += test-oldstyle.sh
test_oldstyle_SOURCES = test-oldstyle.c test.h
test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
@@ -133,7 +151,7 @@ if HAVE_ZLIB
if HAVE_GUESTFISH
check_PROGRAMS += test-gzip
-TESTS += test-gzip
+TESTS += test-gzip.sh
check_DATA += disk disk.gz
MAINTAINERCLEANFILES += disk disk.gz
@@ -158,7 +176,7 @@ if HAVE_LIBLZMA
if HAVE_GUESTFISH
check_PROGRAMS += test-xz
-TESTS += test-xz
+TESTS += test-xz.sh
check_DATA += disk.xz
MAINTAINERCLEANFILES += disk.xz
@@ -177,7 +195,7 @@ endif
if HAVE_PERL
check_PROGRAMS += test-perl
-TESTS += test-perl
+TESTS += test-perl.sh
test_perl_SOURCES = test-lang-plugins.c test.h
test_perl_CFLAGS = \
@@ -191,7 +209,7 @@ endif
if HAVE_PYTHON
check_PROGRAMS += test-python
-TESTS += test-python
+TESTS += test-python.sh
test_python_SOURCES = test-lang-plugins.c test.h
test_python_CFLAGS = \
@@ -205,7 +223,7 @@ endif
if HAVE_OCAML
check_PROGRAMS += test-ocaml
-TESTS += test-ocaml
+TESTS += test-ocaml.sh
# This is somewhat different from the other tests because we have
# to build an actual plugin here.
@@ -227,7 +245,7 @@ endif
if HAVE_RUBY
check_PROGRAMS += test-ruby
-TESTS += test-ruby
+TESTS += test-ruby.sh
test_ruby_SOURCES = test-lang-plugins.c test.h
test_ruby_CFLAGS = \
@@ -240,7 +258,7 @@ endif
# streaming plugin test.
check_PROGRAMS += test-streaming
# Doesn't work:
-#TESTS += test-streaming
+#TESTS += test-streaming.sh
test_streaming_SOURCES = test-streaming.c test.h
test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
diff --git a/tests/test-captive.sh b/tests/test-captive.sh
index 098024b..1ac0844 100755
--- a/tests/test-captive.sh
+++ b/tests/test-captive.sh
@@ -39,7 +39,7 @@ source ./functions.sh
rm -f captive.sock captive.out
-../src/nbdkit -U captive.sock `nbdkit_plugin example1` --run '
+$VG ../src/nbdkit -U captive.sock `nbdkit_plugin example1` --run '
sleep 5; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
' > captive.out
diff --git a/tests/test-connect.sh b/tests/test-connect.sh
new file mode 100755
index 0000000..37b1e32
--- /dev/null
+++ b/tests/test-connect.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-connect
diff --git a/tests/test-dump-config.sh b/tests/test-dump-config.sh
index 6c01adb..7910e11 100755
--- a/tests/test-dump-config.sh
+++ b/tests/test-dump-config.sh
@@ -33,7 +33,7 @@
set -e
-output="$(../src/nbdkit --dump-config)"
+output="$($VG ../src/nbdkit --dump-config)"
if [[ ! ( "$output" =~ ^bindir= ) ]]; then
echo "$0: unexpected output from nbdkit --dump-config"
echo "$output"
diff --git a/tests/test-dump-plugin.sh b/tests/test-dump-plugin.sh
index 2517689..8d9b8fd 100755
--- a/tests/test-dump-plugin.sh
+++ b/tests/test-dump-plugin.sh
@@ -34,7 +34,7 @@
set -e
source ./functions.sh
-output="$(../src/nbdkit `nbdkit_plugin example1` --dump-plugin)"
+output="$($VG ../src/nbdkit `nbdkit_plugin example1` --dump-plugin)"
if [[ ! ( "$output" =~ name\=example1 ) ]]; then
echo "$0: unexpected output from nbdkit --dump-plugin"
echo "$output"
diff --git a/tests/test-file.sh b/tests/test-file.sh
new file mode 100755
index 0000000..f5012a8
--- /dev/null
+++ b/tests/test-file.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-file
diff --git a/tests/test-foreground.sh b/tests/test-foreground.sh
index 6d23bf4..e76b52d 100755
--- a/tests/test-foreground.sh
+++ b/tests/test-foreground.sh
@@ -39,7 +39,7 @@ source ./functions.sh
rm -f foreground.pid foreground.sock
-../src/nbdkit \
+$VG ../src/nbdkit \
-f -P foreground.pid -U foreground.sock `nbdkit_plugin example1` &
bg_pid=$!
diff --git a/tests/test-gzip.sh b/tests/test-gzip.sh
new file mode 100755
index 0000000..085798e
--- /dev/null
+++ b/tests/test-gzip.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-gzip
diff --git a/tests/test-help-plugin.sh b/tests/test-help-plugin.sh
index 92bb277..94359c2 100755
--- a/tests/test-help-plugin.sh
+++ b/tests/test-help-plugin.sh
@@ -34,7 +34,7 @@
set -e
source ./functions.sh
-output="$(../src/nbdkit `nbdkit_plugin file` --help)"
+output="$($VG ../src/nbdkit `nbdkit_plugin file` --help)"
if [[ ! ( "$output" =~ "nbdkit file plugin" ) ]]; then
echo "$0: unexpected output from nbdkit file --help"
echo "$output"
diff --git a/tests/test-help.sh b/tests/test-help.sh
index 299480b..c98e7d7 100755
--- a/tests/test-help.sh
+++ b/tests/test-help.sh
@@ -33,7 +33,7 @@
set -e
-output="$(../src/nbdkit --help)"
+output="$($VG ../src/nbdkit --help)"
if [[ ! ( "$output" =~ dump-config ) ]]; then
echo "$0: unexpected output from nbdkit --help"
echo "$output"
diff --git a/tests/test-ipv4.sh b/tests/test-ipv4.sh
index 8eda61c..024d2ee 100755
--- a/tests/test-ipv4.sh
+++ b/tests/test-ipv4.sh
@@ -56,7 +56,7 @@ for port in `seq 49152 65535`; do
done
echo picked unused port $port
-../src/nbdkit -P ipv4.pid -p $port `nbdkit_plugin example1`
+$VG ../src/nbdkit -P ipv4.pid -p $port `nbdkit_plugin example1`
# We may have to wait a short time for the pid file to appear.
for i in `seq 1 10`; do
diff --git a/tests/test-newstyle.sh b/tests/test-newstyle.sh
new file mode 100755
index 0000000..62176aa
--- /dev/null
+++ b/tests/test-newstyle.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-newstyle
diff --git a/tests/test-ocaml.sh b/tests/test-ocaml.sh
new file mode 100755
index 0000000..e90c9c5
--- /dev/null
+++ b/tests/test-ocaml.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-ocaml
diff --git a/tests/test-oldstyle.sh b/tests/test-oldstyle.sh
new file mode 100755
index 0000000..db2705a
--- /dev/null
+++ b/tests/test-oldstyle.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-oldstyle
diff --git a/tests/test-perl.sh b/tests/test-perl.sh
new file mode 100755
index 0000000..44af3ee
--- /dev/null
+++ b/tests/test-perl.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-perl
diff --git a/tests/test-python.sh b/tests/test-python.sh
new file mode 100755
index 0000000..4738cc1
--- /dev/null
+++ b/tests/test-python.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-python
diff --git a/tests/test-random-sock.sh b/tests/test-random-sock.sh
index a4c58d3..7b0293b 100755
--- a/tests/test-random-sock.sh
+++ b/tests/test-random-sock.sh
@@ -37,4 +37,4 @@ source ./functions.sh
# Test nbdkit -U - + captive nbdkit.
-../src/nbdkit -U - `nbdkit_plugin example1` --run 'sleep 5'
+$VG ../src/nbdkit -U - `nbdkit_plugin example1` --run 'sleep 5'
diff --git a/tests/test-ruby.sh b/tests/test-ruby.sh
new file mode 100755
index 0000000..50a6e7c
--- /dev/null
+++ b/tests/test-ruby.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-ruby
diff --git a/tests/test-single.sh b/tests/test-single.sh
index a06ea5d..ec83e2f 100755
--- a/tests/test-single.sh
+++ b/tests/test-single.sh
@@ -38,4 +38,4 @@ source ./functions.sh
# Test nbdkit -s option.
# XXX Not sure what is a really good test of this.
-../src/nbdkit -s `nbdkit_plugin example1` </dev/null
+$VG ../src/nbdkit -s `nbdkit_plugin example1` </dev/null
diff --git a/tests/test-start.sh b/tests/test-start.sh
index 6041cd4..8df7ab4 100755
--- a/tests/test-start.sh
+++ b/tests/test-start.sh
@@ -40,7 +40,7 @@ source ./functions.sh
rm -f start.pid start.sock
-../src/nbdkit -P start.pid -U start.sock `nbdkit_plugin example1`
+$VG ../src/nbdkit -P start.pid -U start.sock `nbdkit_plugin example1`
# We may have to wait a short time for the pid file to appear.
for i in `seq 1 10`; do
diff --git a/tests/test-streaming.sh b/tests/test-streaming.sh
new file mode 100755
index 0000000..1ed0d9d
--- /dev/null
+++ b/tests/test-streaming.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-streaming
diff --git a/tests/test-version-plugin.sh b/tests/test-version-plugin.sh
index da99dbf..6d058a3 100755
--- a/tests/test-version-plugin.sh
+++ b/tests/test-version-plugin.sh
@@ -34,7 +34,7 @@
set -e
source ./functions.sh
-output="$(../src/nbdkit `nbdkit_plugin file` --version)"
+output="$($VG ../src/nbdkit `nbdkit_plugin file` --version)"
if [[ ! ( "$output" =~ file\ ) ]]; then
echo "$0: unexpected output from nbdkit file --version"
echo "$output"
diff --git a/tests/test-version.sh b/tests/test-version.sh
index 9a2e356..ebd4242 100755
--- a/tests/test-version.sh
+++ b/tests/test-version.sh
@@ -33,7 +33,7 @@
set -e
-output="$(../src/nbdkit --version)"
+output="$($VG ../src/nbdkit --version)"
if [[ ! ( "$output" =~ ^nbdkit\ 1\. ) ]]; then
echo "$0: unexpected output from nbdkit --version"
echo "$output"
diff --git a/tests/test-xz.sh b/tests/test-xz.sh
new file mode 100755
index 0000000..a8cbcfd
--- /dev/null
+++ b/tests/test-xz.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+exec $VG ./test-xz
diff --git a/valgrind-suppressions b/valgrind-suppressions
new file mode 100644
index 0000000..068465f
--- /dev/null
+++ b/valgrind-suppressions
@@ -0,0 +1,32 @@
+# nbdkit valgrind suppressions
+# Copyright (C) 2016 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
--
2.7.4