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 # run any given test in a loop
29 @for i in `seq 1 $(LOOPS)`; do \
30 $(TESTS_ENVIRONMENT) \
31 CK_DEFAULT_TIMEOUT=20 \
34 # run any given test in an infinite loop
37 $(TESTS_ENVIRONMENT) \
38 CK_DEFAULT_TIMEOUT=20 \
41 # valgrind any given test by running make test.valgrind
43 @$(TESTS_ENVIRONMENT) \
44 CK_DEFAULT_TIMEOUT=360 \
45 G_SLICE=always-malloc \
46 $(LIBTOOL) --mode=execute \
48 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
49 --tool=memcheck --leak-check=full --trace-children=yes \
50 --leak-resolution=high --num-callers=20 \
51 ./$* 2>&1 | tee valgrind.log
52 @if grep "==" valgrind.log > /dev/null 2>&1; then \
58 # valgrind any given test and generate suppressions for it
59 %.valgrind.gen-suppressions: %
60 @$(TESTS_ENVIRONMENT) \
61 CK_DEFAULT_TIMEOUT=360 \
62 G_SLICE=always-malloc \
63 $(LIBTOOL) --mode=execute \
65 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
66 --tool=memcheck --leak-check=full --trace-children=yes \
67 --leak-resolution=high --num-callers=20 \
68 --gen-suppressions=all \
69 ./$* 2>&1 | tee suppressions.log
71 # valgrind any given test until failure by running make test.valgrind-forever
73 @while $(MAKE) $*.valgrind; do \
76 # gdb any given test by running make test.gdb
78 @$(TESTS_ENVIRONMENT) \
80 $(LIBTOOL) --mode=execute \
86 @echo "Torturing tests ..."
87 @for i in `seq 1 $(LOOPS)`; do \
89 (echo "Failure after $$i runs"; exit 1) || \
92 @banner="All $(LOOPS) loops passed"; \
93 dashes=`echo "$$banner" | sed s/./=/g`; \
94 echo $$dashes; echo $$banner; echo $$dashes
99 @echo "Forever tests ..."
102 (echo "Failure"; exit 1) || \
108 @echo "Valgrinding tests ..."
110 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
111 $(MAKE) $$t.valgrind; \
112 if test "$$?" -ne 0; then \
113 echo "Valgrind error for test $$t"; \
114 failed=`expr $$failed + 1`; \
115 whicht="$$whicht $$t"; \
118 if test "$$failed" -ne 0; then \
119 echo "$$failed tests had leaks or errors under valgrind:"; \
124 # valgrind all tests and generate suppressions
125 valgrind.gen-suppressions: $(TESTS)
126 @echo "Valgrinding tests ..."
128 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
129 $(MAKE) $$t.valgrind.gen-suppressions; \
130 if test "$$?" -ne 0; then \
131 echo "Valgrind error for test $$t"; \
132 failed=`expr $$failed + 1`; \
133 whicht="$$whicht $$t"; \
136 if test "$$failed" -ne 0; then \
137 echo "$$failed tests had leaks or errors under valgrind:"; \
142 # inspect every plugin feature
143 GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_MAJORMINOR)
145 @echo "Inspecting features ..."
146 @for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2 \
148 do echo Inspecting $$e; \
149 $(GST_INSPECT) $$e > /dev/null 2>&1; done
153 @echo "make check -- run all checks"
154 @echo "make torture -- run all checks $(LOOPS) times"
155 @echo "make (dir)/(test).check -- run the given check once"
156 @echo "make (dir)/(test).forever -- run the given check forever"
157 @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
159 @echo "make (dir)/(test).gdb -- start up gdb for the given test"
161 @echo "make valgrind -- valgrind all tests"
162 @echo "make valgrind.gen-suppressionsx -- generate suppressions for all tests"
163 @echo " and save to suppressions.log"
164 @echo "make (dir)/(test).valgrind -- valgrind the given test"
165 @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
166 @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
167 @echo " and save to suppressions.log"
168 @echo "make inspect -- inspect all plugin features"
171 @echo "Additionally, you can use the GST_CHECKS environment variable to"
172 @echo "specify which test(s) should be run. This is useful if you are"
173 @echo "debugging a failure in one particular test, or want to reproduce"
174 @echo "a race condition in a single test."
178 @echo " GST_CHECKS=test_this,test_that make element/foobar.check"
179 @echo " GST_CHECKS=test_many_threads make element/foobar.forever"