aboutsummaryrefslogtreecommitdiffstats
path: root/test/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/util.py b/test/util.py
index 48ec995..e8bb9c2 100644
--- a/test/util.py
+++ b/test/util.py
@@ -36,3 +36,20 @@ 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):
+ try:
+ ret = subprocess.call([name, '--version'],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL)
+ except FileNotFoundError:
+ return False
+ return ret == 0
+
+if has_program('valgrind') and has_program('libtool'):
+ base_cmdline = [ 'libtool', '--mode=execute',
+ 'valgrind', '-q', '--' ]
+else:
+ base_cmdline = []