Only use valgrind if requested explicitly + enable address sanitizer
authorNikolaus Rath <Nikolaus@rath.org>
Thu, 12 Jan 2017 22:26:06 +0000 (14:26 -0800)
committerNikolaus Rath <Nikolaus@rath.org>
Thu, 12 Jan 2017 23:19:04 +0000 (15:19 -0800)
test/lsan_suppress.txt [new file with mode: 0644]
test/travis-build.sh
test/util.py

diff --git a/test/lsan_suppress.txt b/test/lsan_suppress.txt
new file mode 100644 (file)
index 0000000..4352b3a
--- /dev/null
@@ -0,0 +1,11 @@
+# Suppression file for address sanitizer.
+
+# There are some leaks in command line option parsing. They should be
+# fixed at some point, but are harmless since the consume just a small,
+# constant amount of memory and do not grow.
+leak:fuse_opt_parse
+
+
+# Leaks in fusermount3 are harmless as well (it's a short-lived
+# process) - but patches are welcome!
+leak:fusermount.c
index d0b172b39e0a090b9f8f5f6ab3117c548f62a8b8..f971cbe4cc65050851511580c3ecee10df2c0f43 100755 (executable)
@@ -2,7 +2,12 @@
 
 set -e
 
+# Disable leak checking for now, there are some issues (or false positives)
+# that we still need to fix
+export ASAN_OPTIONS="detect_leaks=0"
+
 export CFLAGS="-Werror"
+export LSAN_OPTIONS="suppressions=$(pwd)/test/lsan_suppress.txt"
 export CC
 
 # Standard build
@@ -18,14 +23,14 @@ for CC in gcc gcc-6 clang; do
 
     sudo chown root:root util/fusermount3
     sudo chmod 4755 util/fusermount3
-    ninja tests
+    TEST_WITH_VALGRIND=true ninja tests
     cd ..
 done
 (cd build-$CC; sudo ninja install)
 
 # Sanitized build
 CC=clang
-for san in undefined; do
+for san in undefined address; do
     mkdir build-${san}; cd build-${san}
     # b_lundef=false is required to work around clang
     # bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
index 48670bdc3819c483907b28b3917dcf32cb4a4052..31c29a89e5812c51885abc86a2a5815ec3ac52db 100644 (file)
@@ -105,21 +105,12 @@ def fuse_test_marker():
 
     return pytest.mark.uses_fuse()
 
-# If valgrind is available, use it
-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'):
+# Use valgrind if requested
+if os.environ.get('TEST_WITH_VALGRIND', 'no').lower().strip() \
+   not in ('no', 'false', '0'):
     base_cmdline = [ 'valgrind', '-q', '--' ]
 else:
     base_cmdline = []
 
-
 # Try to use local fusermount3
 os.environ['PATH'] = '%s:%s' % (pjoin(basename, 'util'), os.environ['PATH'])