Commit fff09308 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs[t:2673] check how valgrind detects memory leaks

git-svn-id: file:///svn/toku/tokudb@20751 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0033b646
...@@ -32,9 +32,6 @@ INVERTER=;test $$? -ne 0 ...@@ -32,9 +32,6 @@ INVERTER=;test $$? -ne 0
all: $(TARGETS) all: $(TARGETS)
%: %.c %: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
test-gettime: test-gettime.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) -lrt $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) -lrt
.PHONY: check build .PHONY: check build
...@@ -47,7 +44,7 @@ test-pwrite4g.tdbrun: TEST_EXTRA_ARGS=. ...@@ -47,7 +44,7 @@ test-pwrite4g.tdbrun: TEST_EXTRA_ARGS=.
ifeq ($(VGRIND),) ifeq ($(VGRIND),)
./$< $(TEST_EXTRA_ARGS) $(SUMMARIZE_CMD) ./$< $(TEST_EXTRA_ARGS) $(SUMMARIZE_CMD)
else else
$(VGRIND) --error-exitcode=1 --quiet --leak-check=full --log-file=$<.check.valgrind ./$< $(TEST_EXTRA_ARGS) >$<.check.output 2>&1; \ $(VGRIND) --error-exitcode=1 --quiet --leak-check=full -show-reachable=yes --log-file=$<.check.valgrind ./$< $(TEST_EXTRA_ARGS) >$<.check.output 2>&1; \
if [ $$? = 0 ] ; then \ if [ $$? = 0 ] ; then \
lines=`cat $<.check.valgrind | wc -l`; \ lines=`cat $<.check.valgrind | wc -l`; \
if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi \ if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi \
...@@ -58,11 +55,26 @@ else ...@@ -58,11 +55,26 @@ else
endif endif
# check to see if that logic makes an error when there is a leak. # check to see if that logic makes an error when there is a leak.
try-leak.tdbrun: try-leak try-leak-lost.tdbrun: try-leak-lost
ifeq ($(VGRIND),)
./$< $(SUMMARIZE_SHOULD_FAIL)
else
$(VGRIND) --error-exitcode=1 --quiet --leak-check=full --show-reachable=yes --log-file=$<.check.valgrind ./$< >$<.check.output 2>&1; \
if [ $$? = 0 ] ; then \
lines=`cat $<.check.valgrind | wc -l`; \
if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi \
else \
test 0 = 1; \
fi \
$(INVERTER) \
$(SUMMARIZE_SHOULD_FAIL)
endif
try-leak-reachable.tdbrun: try-leak-reachable
ifeq ($(VGRIND),) ifeq ($(VGRIND),)
./$< $(SUMMARIZE_CMD) ./$< $(SUMMARIZE_SHOULD_FAIL)
else else
$(VGRIND) --error-exitcode=1 --quiet --leak-check=full --log-file=$<.check.valgrind ./$< >$<.check.output 2>&1; \ $(VGRIND) --error-exitcode=1 --quiet --leak-check=full --show-reachable=yes --log-file=$<.check.valgrind ./$< >$<.check.output 2>&1; \
if [ $$? = 0 ] ; then \ if [ $$? = 0 ] ; then \
lines=`cat $<.check.valgrind | wc -l`; \ lines=`cat $<.check.valgrind | wc -l`; \
if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi \ if [ $$lines -ne 0 ] ; then cat $<.check.valgrind; test 0 = 1; fi \
......
#include <stdlib.h>
static void *vp;
int main(void) {
vp = malloc(42);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment