]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
Check for memory leaks during unittest CI using valgrind
authorŠtěpán Kotek <stepan.kotek@gmail.com>
Wed, 30 Aug 2017 09:06:11 +0000 (11:06 +0200)
committerŠtěpán Kotek <stepan.kotek@gmail.com>
Wed, 30 Aug 2017 09:16:55 +0000 (11:16 +0200)
New ci task has been added that checks for possible memory leaks when running unittests. Messages from valgrind are displayed only when leak is detected.
refs #227

.gitlab-ci.yml
tests/unit.mk

index 52d16722c4812d19239731ff1d7a7e1c606c252e..52ede0b532661692b636b3afedabccecfacc1d33 100644 (file)
@@ -28,6 +28,7 @@ test:linux:amd64:
     - linux
     - amd64
 
+
 deckard:linux:amd64:
   stage: test
   script:
@@ -44,6 +45,18 @@ deckard:linux:amd64:
     - linux
     - amd64
 
+test:linux:amd64:valgrind:
+  image: cznic/ubuntu-valgrind:16.04
+  stage: test
+  script:
+    - PREFIX=$(pwd)/.local DEBUGGER="valgrind --error-exitcode=1 --leak-check=full --trace-children=yes --quiet" make -k check
+  dependencies:
+    - build:linux:amd64
+  tags:
+    - docker
+    - linux
+    - amd64
+
 respdiff:linux:amd64:
   image: cznic/ubuntu-respdif:16.04
   stage: test
index 6ab0e6703aee3c37cd3d7bfbd7a4e41d4c3429d4..876c21d265a5295444c5277e8356556f1a6bfbd4 100644 (file)
@@ -37,7 +37,7 @@ $(1)_LIBS := $(tests_LIBS)
 $(1)_DEPEND := $(tests_DEPEND)
 $(call make_bin,$(1),tests)
 $(1): $$($(1))
-       @$(preload_syms) $$<
+       @$(preload_syms) $(DEBUGGER) $$<
 .PHONY: $(1)
 endef