Delete the PID file on exit
[lwes-journaller.git] / tests / Makefile.am
blob48bdc8bb35f18f273b0f043a772489176e2e3c25
1 # BEGIN: Variables to change.
3 # any additional includes to add to the compile lines
5 myincludes =
7 # any additional files to add to the distribution
9 myextradist =
11 # any additional files to clean up with 'make clean'
13 mycleanfiles =
15 # any additional files to clean up with 'make maintainer-clean'
17 mymaintainercleanfiles =
19 # list of test programs, in dependency order
21 mytests =
23 # list of test scripts, in dependency order
25 myscripttests =
27 # END: Variables to change
28 # past here, hopefully, there is no need to edit anything
30 INCLUDES = -I../src ${myincludes}
32 check_PROGRAMS = ${mytests}
34 check_SCRIPTS  = ${myscripttests}
36 # globally added to all instances of valgrind calls
37 VALGRIND_OPTS = ${myextravalgrindopts}
39 # globally added to all memcheck calls
40 VALGRIND_MEM_OPTS = --tool=memcheck \
41                     --num-callers=10 \
42                     ${myextravalgrindmemopts}
44 # globally added to all leakcheck calls
45 VALGRIND_LEAK_OPTS = --tool=memcheck \
46                      --num-callers=10 \
47                      --leak-check=yes \
48                      --leak-resolution=high \
49                      --show-reachable=yes \
50                      ${myextravalgrindleakopts}
52 memcheck: $(check_PROGRAMS)
53         @for x in $(check_PROGRAMS);                                     \
54           do                                                             \
55             $(MAKE) memcheck-$$x;                                        \
56           done
58 leakcheck: $(check_PROGRAMS)
59         @for x in $(check_PROGRAMS);                                     \
60           do                                                             \
61             $(MAKE) leakcheck-$$x;                                       \
62           done
64 memcheck-%: %
65         @echo "*****************************************";                \
66         echo "MEMCHECK: $<";                                             \
67         echo "ARGS: ${VALGRIND_OPTS} ${VALGRIND_MEM_OPTS} ${$<_VALGRIND_MEM_OPTS}";\
68         $(LIBTOOL) --mode=execute                                        \
69           valgrind                                                       \
70             ${VALGRIND_OPTS}                                             \
71             ${VALGRIND_MEM_OPTS}                                         \
72             ${$<_VALGRIND_MEM_OPTS} ./$<
74 leakcheck-%: %
75         @echo "*****************************************";               \
76         echo "LEAKCHECK: $<";                                           \
77         echo "ARGS: ${VALGRIND_OPTS} ${VALGRIND_LEAK_OPTS} ${$<_VALGRIND_LEAK_OPTS}";                                           \
78         $(LIBTOOL) --mode=execute                                       \
79           valgrind                                                      \
80             ${VALGRIND_OPTS}                                            \
81             ${VALGRIND_LEAK_OPTS}                                       \
82             ${$<_VALGRIND_LEAK_OPTS}  ./$<
84 # NB: TESTS are ordered in dependency order
86 TESTS = $(patsubst %, testwrapper-%, ${mytests}) ${myscripttests}
88 testwrapper-%: % test-wrapper.sh test-wrapper.sh.in
89         @ln -sf test-wrapper.sh $@
90         @chmod +x test-wrapper.sh
92 EXTRA_DIST =                            \
93         ${myextradist}
95 CLEANFILES =                            \
96         testwrapper-*                       \
97         *.bb                                \
98         *.bbg                               \
99         *.da                                \
100         *.gcno                              \
101         *.gcda                              \
102         *.gcov                              \
103         test-wrapper.sh                     \
104         ${mycleanfiles}
106 MAINTAINERCLEANFILES =                  \
107         Makefile.in                         \
108         skeletor-tests.am                   \
109         ${mymaintainercleanfiles}
111 # Tell make to ignore these any files that match these targets.
112 .PHONY: memcheck leakcheck
114 # .BEGIN is ignored by GNU make so we can use it as a guard
115 .BEGIN:
116         @echo "error: GNU Make is required, try aliasing gmake to make"
117         @exit 1