1 # -*- Makefile-automake -*-
3 # Support for running programs with failmalloc preloaded. Include in other
4 # automake files and make sure the following variables are set:
6 # FAILMALLOC_START - number of first FAILMALLOC_INTERVAL
7 # FAILMALLOC_REP - how often to repeat with increasing FAILMALLOC_INTERVAL
8 # FAILMALLOC_PROG - the program to run with linfailmalloc preloaded
11 failmalloc: failmalloc-run
13 failmalloc: failmalloc-error
16 failmalloc-run: $(FAILMALLOC_PROG)
17 @(echo "Running $(FAILMALLOC_PROG) with failmalloc"; \
18 for i in $$(seq $(FAILMALLOC_START) $$(expr $(FAILMALLOC_START) + $(FAILMALLOC_REP) - 1)) ; do \
19 resp=$$(libtool --mode=execute env LD_PRELOAD=$(LIBFAILMALLOC) FAILMALLOC_INTERVAL=$$i $(FAILMALLOC_PROG)); \
21 if [ $$status -ne 0 -a $$status -ne 2 ] ; then \
22 printf "%5d FAIL %3d %s\n" $$i $$status "$$resp" ; \
23 elif [ x$(V) = x1 -o $$(( $$i % 100 )) -eq 0 ] ; then \
24 printf "%5d PASS %s\n" $$i "$$resp" ; \
29 @(echo "You need to turn on failmalloc support with --with-failmalloc"; \