1 # keep target around, since it's referenced in the modules' Makefiles
6 # hangs spectacularly on some machines, so let's not do this by default yet
16 # run any given test by running make test.check
17 # if the test fails, run it again at at least debug level 2
19 @$(TESTS_ENVIRONMENT) \
20 CK_DEFAULT_TIMEOUT=20 \
22 $(TESTS_ENVIRONMENT) \
23 GST_DEBUG=$$GST_DEBUG,*:2 \
24 CK_DEFAULT_TIMEOUT=20 \
27 # just like 'check', but don't run it again if it fails (useful for debugging)
29 @$(TESTS_ENVIRONMENT) \
30 CK_DEFAULT_TIMEOUT=20 \
33 # run any given test in a loop
35 @for i in `seq 1 $(LOOPS)`; do \
36 $(TESTS_ENVIRONMENT) \
37 CK_DEFAULT_TIMEOUT=20 \
40 # run any given test in an infinite loop
43 $(TESTS_ENVIRONMENT) \
44 CK_DEFAULT_TIMEOUT=20 \
47 # valgrind any given test by running make test.valgrind
49 @$(TESTS_ENVIRONMENT) \
50 CK_DEFAULT_TIMEOUT=360 \
51 G_SLICE=always-malloc \
52 $(LIBTOOL) --mode=execute \
54 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
55 --tool=memcheck --leak-check=full --trace-children=yes \
56 --leak-resolution=high --num-callers=20 \
57 ./$* 2>&1 | tee valgrind.log
58 @if grep "==" valgrind.log > /dev/null 2>&1; then \
64 # valgrind any given test and generate suppressions for it
65 %.valgrind.gen-suppressions: %
66 @$(TESTS_ENVIRONMENT) \
67 CK_DEFAULT_TIMEOUT=360 \
68 G_SLICE=always-malloc \
69 $(LIBTOOL) --mode=execute \
71 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
72 --tool=memcheck --leak-check=full --trace-children=yes \
73 --leak-resolution=high --num-callers=20 \
74 --gen-suppressions=all \
75 ./$* 2>&1 | tee suppressions.log
77 # valgrind torture any given test
79 @for i in `seq 1 $(LOOPS)`; do \
80 $(MAKE) $*.valgrind || \
81 (echo "Failure after $$i runs"; exit 1) || \
84 @banner="All $(LOOPS) loops passed"; \
85 dashes=`echo "$$banner" | sed s/./=/g`; \
86 echo $$dashes; echo $$banner; echo $$dashes
88 # valgrind any given test until failure by running make test.valgrind-forever
90 @while $(MAKE) $*.valgrind; do \
93 # gdb any given test by running make test.gdb
95 @$(TESTS_ENVIRONMENT) \
97 $(LIBTOOL) --mode=execute \
102 $(MAKE) $*.lcov-report
105 $(MAKE) $*.lcov-reset
109 $(MAKE) -C $(top_builddir) lcov-clean
112 $(MAKE) $*.lcov-clean
116 $(MAKE) -C $(top_builddir) lcov-report
119 echo "Need to reconfigure with --enable-gcov"
122 echo "Need to reconfigure with --enable-gcov"
128 @echo "Torturing tests ..."
129 @for i in `seq 1 $(LOOPS)`; do \
131 (echo "Failure after $$i runs"; exit 1) || \
134 @banner="All $(LOOPS) loops passed"; \
135 dashes=`echo "$$banner" | sed s/./=/g`; \
136 echo $$dashes; echo $$banner; echo $$dashes
141 @echo "Forever tests ..."
144 (echo "Failure"; exit 1) || \
150 @echo "Valgrinding tests ..."
152 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
153 $(MAKE) $$t.valgrind; \
154 if test "$$?" -ne 0; then \
155 echo "Valgrind error for test $$t"; \
156 failed=`expr $$failed + 1`; \
157 whicht="$$whicht $$t"; \
160 if test "$$failed" -ne 0; then \
161 echo "$$failed tests had leaks or errors under valgrind:"; \
166 # valgrind all tests until failure
167 valgrind-forever: $(TESTS)
169 @echo "Forever valgrinding tests ..."
171 $(MAKE) valgrind || \
172 (echo "Failure"; exit 1) || \
176 # valgrind torture all tests
177 valgrind-torture: $(TESTS)
179 @echo "Torturing and valgrinding tests ..."
180 @for i in `seq 1 $(LOOPS)`; do \
181 $(MAKE) valgrind || \
182 (echo "Failure after $$i runs"; exit 1) || \
185 @banner="All $(LOOPS) loops passed"; \
186 dashes=`echo "$$banner" | sed s/./=/g`; \
187 echo $$dashes; echo $$banner; echo $$dashes
189 # valgrind all tests and generate suppressions
190 valgrind.gen-suppressions: $(TESTS)
191 @echo "Valgrinding tests ..."
193 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
194 $(MAKE) $$t.valgrind.gen-suppressions; \
195 if test "$$?" -ne 0; then \
196 echo "Valgrind error for test $$t"; \
197 failed=`expr $$failed + 1`; \
198 whicht="$$whicht $$t"; \
201 if test "$$failed" -ne 0; then \
202 echo "$$failed tests had leaks or errors under valgrind:"; \
207 # inspect every plugin feature
208 GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_API_VERSION)
210 @echo "Inspecting features ..."
211 @for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2 \
213 do echo Inspecting $$e; \
214 $(GST_INSPECT) $$e > /dev/null 2>&1; done
218 @echo "make check -- run all checks"
219 @echo "make torture -- run all checks $(LOOPS) times"
220 @echo "make (dir)/(test).check -- run the given check once, repeat with GST_DEBUG=*:2 if it fails"
221 @echo "make (dir)/(test).check-norepeat -- run the given check once, but don't run it again if it fails"
222 @echo "make (dir)/(test).forever -- run the given check forever"
223 @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
225 @echo "make (dir)/(test).gdb -- start up gdb for the given test"
227 @echo "make valgrind -- valgrind all tests"
228 @echo "make valgrind-forever -- valgrind all tests forever"
229 @echo "make valgrind-torture -- valgrind all tests $(LOOPS) times"
230 @echo "make valgrind.gen-suppressions -- generate suppressions for all tests"
231 @echo " and save to suppressions.log"
232 @echo "make (dir)/(test).valgrind -- valgrind the given test"
233 @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
234 @echo "make (dir)/(test).valgrind-torture -- valgrind the given test $(LOOPS) times"
235 @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
236 @echo " and save to suppressions.log"
237 @echo "make inspect -- inspect all plugin features"
240 @echo "Additionally, you can use the GST_CHECKS environment variable to"
241 @echo "specify which test(s) should be run. This is useful if you are"
242 @echo "debugging a failure in one particular test, or want to reproduce"
243 @echo "a race condition in a single test."
247 @echo " GST_CHECKS=test_this,test_that make element/foobar.check"
248 @echo " GST_CHECKS=test_many_threads make element/foobar.forever"