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 --show-possibly-lost=no \
57 --leak-resolution=high --num-callers=20 \
58 ./$* 2>&1 | tee valgrind.log
59 @if grep "==" valgrind.log > /dev/null 2>&1; then \
65 # valgrind any given test and generate suppressions for it
66 %.valgrind.gen-suppressions: %
67 @$(TESTS_ENVIRONMENT) \
68 CK_DEFAULT_TIMEOUT=360 \
69 G_SLICE=always-malloc \
70 $(LIBTOOL) --mode=execute \
72 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
73 --tool=memcheck --leak-check=full --trace-children=yes \
74 --show-possibly-lost=no \
75 --leak-resolution=high --num-callers=20 \
76 --gen-suppressions=all \
77 ./$* 2>&1 | tee suppressions.log
79 # valgrind torture any given test
81 @for i in `seq 1 $(LOOPS)`; do \
82 $(MAKE) $*.valgrind || \
83 (echo "Failure after $$i runs"; exit 1) || \
86 @banner="All $(LOOPS) loops passed"; \
87 dashes=`echo "$$banner" | sed s/./=/g`; \
88 echo $$dashes; echo $$banner; echo $$dashes
90 # valgrind any given test until failure by running make test.valgrind-forever
92 @while $(MAKE) $*.valgrind; do \
95 # gdb any given test by running make test.gdb
97 @$(TESTS_ENVIRONMENT) \
99 $(LIBTOOL) --mode=execute \
104 $(MAKE) $*.lcov-report
107 $(MAKE) $*.lcov-reset
111 $(MAKE) -C $(top_builddir) lcov-clean
114 $(MAKE) $*.lcov-clean
118 $(MAKE) -C $(top_builddir) lcov-report
121 echo "Need to reconfigure with --enable-gcov"
124 echo "Need to reconfigure with --enable-gcov"
130 @echo "Torturing tests ..."
131 @for i in `seq 1 $(LOOPS)`; do \
133 (echo "Failure after $$i runs"; exit 1) || \
136 @banner="All $(LOOPS) loops passed"; \
137 dashes=`echo "$$banner" | sed s/./=/g`; \
138 echo $$dashes; echo $$banner; echo $$dashes
143 @echo "Forever tests ..."
146 (echo "Failure"; exit 1) || \
152 @echo "Valgrinding tests ..."
154 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
155 $(MAKE) $$t.valgrind; \
156 if test "$$?" -ne 0; then \
157 echo "Valgrind error for test $$t"; \
158 failed=`expr $$failed + 1`; \
159 whicht="$$whicht $$t"; \
162 if test "$$failed" -ne 0; then \
163 echo "$$failed tests had leaks or errors under valgrind:"; \
168 # valgrind all tests until failure
169 valgrind-forever: $(TESTS)
171 @echo "Forever valgrinding tests ..."
173 $(MAKE) valgrind || \
174 (echo "Failure"; exit 1) || \
178 # valgrind torture all tests
179 valgrind-torture: $(TESTS)
181 @echo "Torturing and valgrinding tests ..."
182 @for i in `seq 1 $(LOOPS)`; do \
183 $(MAKE) valgrind || \
184 (echo "Failure after $$i runs"; exit 1) || \
187 @banner="All $(LOOPS) loops passed"; \
188 dashes=`echo "$$banner" | sed s/./=/g`; \
189 echo $$dashes; echo $$banner; echo $$dashes
191 # valgrind all tests and generate suppressions
192 valgrind.gen-suppressions: $(TESTS)
193 @echo "Valgrinding tests ..."
195 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
196 $(MAKE) $$t.valgrind.gen-suppressions; \
197 if test "$$?" -ne 0; then \
198 echo "Valgrind error for test $$t"; \
199 failed=`expr $$failed + 1`; \
200 whicht="$$whicht $$t"; \
203 if test "$$failed" -ne 0; then \
204 echo "$$failed tests had leaks or errors under valgrind:"; \
209 # inspect every plugin feature
210 GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_API_VERSION)
212 @echo "Inspecting features ..."
213 @for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2 \
215 do echo Inspecting $$e; \
216 $(GST_INSPECT) $$e > /dev/null 2>&1; done
220 @echo "make check -- run all checks"
221 @echo "make torture -- run all checks $(LOOPS) times"
222 @echo "make (dir)/(test).check -- run the given check once, repeat with GST_DEBUG=*:2 if it fails"
223 @echo "make (dir)/(test).check-norepeat -- run the given check once, but don't run it again if it fails"
224 @echo "make (dir)/(test).forever -- run the given check forever"
225 @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
227 @echo "make (dir)/(test).gdb -- start up gdb for the given test"
229 @echo "make valgrind -- valgrind all tests"
230 @echo "make valgrind-forever -- valgrind all tests forever"
231 @echo "make valgrind-torture -- valgrind all tests $(LOOPS) times"
232 @echo "make valgrind.gen-suppressions -- generate suppressions for all tests"
233 @echo " and save to suppressions.log"
234 @echo "make (dir)/(test).valgrind -- valgrind the given test"
235 @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
236 @echo "make (dir)/(test).valgrind-torture -- valgrind the given test $(LOOPS) times"
237 @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
238 @echo " and save to suppressions.log"
239 @echo "make inspect -- inspect all plugin features"
242 @echo "Additionally, you can use the GST_CHECKS environment variable to"
243 @echo "specify which test(s) should be run. This is useful if you are"
244 @echo "debugging a failure in one particular test, or want to reproduce"
245 @echo "a race condition in a single test."
249 @echo " GST_CHECKS=test_this,test_that make element/foobar.check"
250 @echo " GST_CHECKS=test_many_threads make element/foobar.forever"