Add configuration to help debug memory leaks

This commit is contained in:
Thiago de Arruda 2014-02-26 15:48:26 -03:00
parent 8b94f34ced
commit cb9a368445
7 changed files with 24 additions and 10 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@ src/testdir/test.log
src/testdir/test.ok
src/testdir/*.failed
src/testdir/X*
src/testdir/valgrind.*
# local make targets
local.mk

View File

@ -1,2 +1,2 @@
language: c
script: make cmake CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$PWD/dist" && make && make test > /dev/null 2>&1 && make install
script: ./scripts/travis.sh

View File

@ -18,6 +18,10 @@ else()
set(DEBUG 0)
endif()
if(DEFINED $ENV{VALGRIND_CHECK})
add_definitions(-DEXITFREE)
endif()
# Modules used by platform auto-detection
include(CheckLibraryExists)

View File

@ -1,9 +1,9 @@
-include local.mk
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=.deps/usr -DLibUV_USE_STATIC=YES
CMAKE_FLAGS = -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=.deps/usr -DLibUV_USE_STATIC=YES
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS :=
CMAKE_EXTRA_FLAGS =
build/bin/nvim: deps
${MAKE} -C build

7
scripts/travis.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh -e
export VALGRIND_CHECK=1
make cmake CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$PWD/dist"
make
make test > /dev/null 2>&1
make install

View File

@ -276,6 +276,7 @@ static char *(main_errors[]) =
* (MSDOS).
* Note that we may use mch_exit() before mch_init()!
*/
malloc(10323);
mch_init();
TIME_MSG("shell init");

View File

@ -4,13 +4,6 @@
VIMPROG = ../../build/bin/nvim
# Uncomment this line to use valgrind for memory leaks and extra warnings.
# The output goes into a file "valgrind.testN"
# Vim should be compiled with EXITFREE to avoid false warnings.
# This will make testing about 10 times as slow.
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$*
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out test10.out test11.out \
test12.out test13.out test14.out test15.out test17.out \
@ -34,6 +27,14 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
SCRIPTS_GUI = test16.out
ifdef VALGRIND_CHECK
VALGRIND := valgrind --leak-check=yes --error-exitcode=1 --log-file=valgrind.$*
endif
ifdef TESTNUM
SCRIPTS = test$(TESTNUM).out
endif
.SUFFIXES: .in .out
nongui: nolog $(SCRIPTS) report