aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-04-05 09:26:17 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-05 11:05:31 -0300
commitcb9afe0dc0c9bb19ad6755df5677351e1e7fbb22 (patch)
tree3aca7fbd75f586b4c6e664e3cd79eaff53e81027
parentade0c127e56ff248039c60c3b29abcac24be1949 (diff)
downloadrneovim-cb9afe0dc0c9bb19ad6755df5677351e1e7fbb22.tar.gz
rneovim-cb9afe0dc0c9bb19ad6755df5677351e1e7fbb22.tar.bz2
rneovim-cb9afe0dc0c9bb19ad6755df5677351e1e7fbb22.zip
Add helpers for debugging with valgrind
The environment variable USE_VALGRIND can be set to run tests with valgrind. If VALGRIND_GDB is set, valgrind will start it's own gdbserver for remote debugging with `target remote | vgdb`. USE_GDB can still be used, but it will be ignored if USE_VALGRIND is set.
-rw-r--r--.valgrind.supp7
-rw-r--r--src/testdir/Makefile19
2 files changed, 23 insertions, 3 deletions
diff --git a/.valgrind.supp b/.valgrind.supp
new file mode 100644
index 0000000000..a0a96518ba
--- /dev/null
+++ b/.valgrind.supp
@@ -0,0 +1,7 @@
+{
+ nss_parse_service_list
+ Memcheck:Leak
+ fun:malloc
+ fun:nss_parse_service_list
+ fun:__nss_database_lookup
+}
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 033ab732ac..85188b84b7 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -2,6 +2,8 @@
# Makefile to run all tests for Vim
#
+export SHELL := sh
+
VIMPROG := ../../build/bin/nvim
SCRIPTS := test1.out test2.out test3.out test4.out test5.out test6.out \
@@ -27,8 +29,19 @@ SCRIPTS := test1.out test2.out test3.out test4.out test5.out test6.out \
SCRIPTS_GUI := test16.out
+
+ifdef VALGRIND_GDB
+VGDB := --vgdb=yes --vgdb-error=0
+endif
+
+ifdef USE_VALGRIND
+VALGRIND_TOOL=--tool=memcheck --leak-check=yes --track-origins=yes
+# VALGRIND_TOOL=exp-sgcheck
+TOOL = valgrind -q -q $(VALGRIND_TOOL) --suppressions=../../.valgrind.supp --error-exitcode=123 --log-file=valgrind.\%p.$* $(VGDB) --trace-children=yes
+else
ifdef USE_GDB
-GDB = gdb --args
+TOOL = gdb --args
+endif
endif
ifdef TESTNUM
@@ -54,10 +67,10 @@ $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
RM_ON_RUN = test.out X* viminfo
RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok
-RUN_VIM = $(GDB) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in
+RUN_VIM = $(TOOL) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in
clean:
- -rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.*
+ -rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.* .*.swp .*.swo
test1.out: .gdbinit test1.in
-rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize