aboutsummaryrefslogtreecommitdiff
path: root/test/util.py
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-02 22:31:13 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-02 22:39:28 -0700
commitf270ba91215c3f14b1f44da0e5db0221226a5715 (patch)
tree479bc0aa678286a59208e5b71c2c1fea39c88690 /test/util.py
parent651f85e4a2ef100ced3235ab1827c9ec9a509c43 (diff)
Run tests under valgrind when available.
Fixes #50.
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/util.py b/test/util.py
index 48ec995..5f2f3e0 100644
--- a/test/util.py
+++ b/test/util.py
@@ -36,3 +36,16 @@ def umount(mount_process, mnt_dir):
time.sleep(0.1)
elapsed += 0.1
pytest.fail('mount process did not terminate')
+
+
+# If valgrind and libtool are available, use them
+def has_program(name):
+ return subprocess.call([name, '--version'],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL) == 0
+
+if has_program('valgrind') and has_program('libtool'):
+ base_cmdline = [ 'libtool', '--mode=execute',
+ 'valgrind', '-q', '--' ]
+else:
+ base_cmdline = []