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 any given test until failure by running make test.valgrind-forever
79 @while $(MAKE) $*.valgrind; do \
82 # gdb any given test by running make test.gdb
84 @$(TESTS_ENVIRONMENT) \
86 $(LIBTOOL) --mode=execute \
92 @echo "Torturing tests ..."
93 @for i in `seq 1 $(LOOPS)`; do \
95 (echo "Failure after $$i runs"; exit 1) || \
98 @banner="All $(LOOPS) loops passed"; \
99 dashes=`echo "$$banner" | sed s/./=/g`; \
100 echo $$dashes; echo $$banner; echo $$dashes
104 -rm test-registry.xml
105 @echo "Forever tests ..."
108 (echo "Failure"; exit 1) || \
114 @echo "Valgrinding tests ..."
116 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
117 $(MAKE) $$t.valgrind; \
118 if test "$$?" -ne 0; then \
119 echo "Valgrind error for test $$t"; \
120 failed=`expr $$failed + 1`; \
121 whicht="$$whicht $$t"; \
124 if test "$$failed" -ne 0; then \
125 echo "$$failed tests had leaks or errors under valgrind:"; \
130 # valgrind all tests and generate suppressions
131 valgrind.gen-suppressions: $(TESTS)
132 @echo "Valgrinding tests ..."
134 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
135 $(MAKE) $$t.valgrind.gen-suppressions; \
136 if test "$$?" -ne 0; then \
137 echo "Valgrind error for test $$t"; \
138 failed=`expr $$failed + 1`; \
139 whicht="$$whicht $$t"; \
142 if test "$$failed" -ne 0; then \
143 echo "$$failed tests had leaks or errors under valgrind:"; \
148 # inspect every plugin feature
149 GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_API_VERSION)
151 @echo "Inspecting features ..."
152 @for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2 \
154 do echo Inspecting $$e; \
155 $(GST_INSPECT) $$e > /dev/null 2>&1; done
159 @echo "make check -- run all checks"
160 @echo "make torture -- run all checks $(LOOPS) times"
161 @echo "make (dir)/(test).check -- run the given check once, repeat with GST_DEBUG=*:2 if it fails"
162 @echo "make (dir)/(test).check-norepeat -- run the given check once, but don't run it again if it fails"
163 @echo "make (dir)/(test).forever -- run the given check forever"
164 @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
166 @echo "make (dir)/(test).gdb -- start up gdb for the given test"
168 @echo "make valgrind -- valgrind all tests"
169 @echo "make valgrind.gen-suppressions -- generate suppressions for all tests"
170 @echo " and save to suppressions.log"
171 @echo "make (dir)/(test).valgrind -- valgrind the given test"
172 @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
173 @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
174 @echo " and save to suppressions.log"
175 @echo "make inspect -- inspect all plugin features"
178 @echo "Additionally, you can use the GST_CHECKS environment variable to"
179 @echo "specify which test(s) should be run. This is useful if you are"
180 @echo "debugging a failure in one particular test, or want to reproduce"
181 @echo "a race condition in a single test."
185 @echo " GST_CHECKS=test_this,test_that make element/foobar.check"
186 @echo " GST_CHECKS=test_many_threads make element/foobar.forever"