summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctest/CMakeLists.txt14
-rw-r--r--ctest/valgrind.supp11
2 files changed, 25 insertions, 0 deletions
diff --git a/ctest/CMakeLists.txt b/ctest/CMakeLists.txt
index 6ee2e10..c8cdbbb 100644
--- a/ctest/CMakeLists.txt
+++ b/ctest/CMakeLists.txt
@@ -26,6 +26,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Ctest configuration variables must be set BEFORE include(Ctest)
+
+# Check process children and give detail for each leak
+set(MEMORYCHECK_COMMAND_OPTIONS
+ "${MEMORYCHECK_COMMAND_OPTIONS} --trace-children=yes --leak-check=full")
+
+# As dash is not used to submit results, there is no way to see valgrind result.
+# Force it to log to stderr and fail in case of leak or error.
+set(MEMORYCHECK_COMMAND_OPTIONS
+ "${MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=255 --log-fd=2")
+
+# Ignore errors from third-partie libraries
+set(MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_CURRENT_LIST_DIR}/valgrind.supp")
+
# Enable tests, coverage, memcheck, ...
# See http://www.cmake.org/Wiki/CMake/Testing_With_CTest#Dashboard_Preparation
include(CTest)
diff --git a/ctest/valgrind.supp b/ctest/valgrind.supp
new file mode 100644
index 0000000..1de6188
--- /dev/null
+++ b/ctest/valgrind.supp
@@ -0,0 +1,11 @@
+# Ignore conditional jump in libz.
+# It is fixed in zlib1g v1.2.8 (ubuntu 14.04)
+# but not in v1.2.3 (ubuntu 12.04) which travis has.
+{
+ libz/inflateReset2/jump
+ Memcheck:Cond
+ fun:inflateReset2
+ fun:inflateInit2_
+ obj:/*/libz.so*
+}
+