summaryrefslogtreecommitdiffstats
path: root/ctest/CMakeLists.txt
diff options
context:
space:
mode:
authorKevin Rocard <kevin.rocard@intel.com>2015-04-11 23:26:37 +0200
committerEric Laurent <elaurent@google.com>2015-04-24 13:39:14 -0700
commit2085e0e59a7c1d3d731ad1ffbce4c9434ea9e602 (patch)
treec3040b11a7b3b1452b4c16b602024d31dbaae610 /ctest/CMakeLists.txt
parent4c18b3a9a3bc1a8fc4317f0076716ebdc81af917 (diff)
downloadexternal_parameter-framework-2085e0e59a7c1d3d731ad1ffbce4c9434ea9e602.zip
external_parameter-framework-2085e0e59a7c1d3d731ad1ffbce4c9434ea9e602.tar.gz
external_parameter-framework-2085e0e59a7c1d3d731ad1ffbce4c9434ea9e602.tar.bz2
Fail memcheck target on leak or memory errors
Some unit test were checked using valgrind, but if an error was detected it was only logged: the build was not failed. Fail to build all *MemCheck targets if a leak or an error is reported by valgrind. Signed-off-by: Kevin Rocard <kevin.rocard@intel.com>
Diffstat (limited to 'ctest/CMakeLists.txt')
-rw-r--r--ctest/CMakeLists.txt14
1 files changed, 14 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)