summaryrefslogtreecommitdiff
path: root/testsuite/Makefile.am
blob: de055c8650afeb4081f1a22a8fe76675dde0890d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
INCLUDES = \
	$(PYTHON_INCLUDES) \
	$(PYGOBJET_CFLAGS) \
	$(PYGST_CFLAGS) \
	$(GST_CFLAGS)

noinst_LTLIBRARIES = testhelper.la
linked_LIBS = testhelper.la

testhelper_la_LDFLAGS = -module -avoid-version
testhelper_la_LIBADD = $(GLIB_LIBS)
testhelper_la_CFLAGS = $(PYGOBJECT_CFLAGS)
testhelper_la_SOURCES = \
	testhelpermodule.c \
	test-object.c

# This is a hack to make sure a shared library is built
testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
	$(AM_V_CCLD)$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)

tests =  \
	test_adapter.py \
	test_audio.py \
	test_bin.py \
	test_buffer.py \
        test_caps.py \
	test_element.py \
	test_event.py \
	test_ghostpad.py \
        test_interface.py \
	test_message.py \
	test_pad.py \
        test_pipeline.py \
        test_registry.py \
        test_struct.py \
	test_segment.py \
	test_taglist.py \
	test_xml.py \
	test_pbutils.py	\
	test_gst.py

check-local: testhelper.la
	@PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py
	@PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py
	@rm -fr *.pyc

check-verbose: testhelper.la
	@VERBOSE=yes PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py
	@VERBOSE=yes PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py
	@rm -fr *.pyc

EXTRA_DIST = $(tests) common.py cleanup.py runtests.py test-object.h python.supp gstpython.supp

if HAVE_VALGRIND
check-valgrind:
	$(PYTHON) cleanup.py
	make valgrind
else
check-valgrind:
	@true
endif

GSTSUPP = $(top_srcdir)/common/gst.supp
PYTHONSUPP = $(top_srcdir)/testsuite/python.supp
GSTPYTHONSUPP = $(top_srcdir)/testsuite/gstpython.supp
TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) LC_ALL=C

# gdb any given test_x.py by running make test_x.py.gdb
%.gdb: %
	$(TESTS_ENVIRONMENT)                                    \
	gdb --args 						\
	$(PYTHON) 						\
	$*

# valgrind any given test_x.py by running make test_x.py.valgrind
%.valgrind: %
	$(TESTS_ENVIRONMENT)                                    \
	G_DEBUG=gc-friendly G_SLICE=always-malloc					\
	$(VALGRIND_PATH) -q					\
	--suppressions=$(GSTSUPP)				\
	--suppressions=$(PYTHONSUPP)				\
	--suppressions=$(GSTPYTHONSUPP)				\
	--tool=memcheck --leak-check=full --trace-children=yes  \
	--leak-resolution=high --num-callers=50		\
	$(PYTHON)						\
	$* 2>&1 | tee valgrind.log
	@if grep "tely lost" valgrind.log; then                 \
	    rm valgrind.log;                                    \
	    exit 1;                                             \
	fi
	@rm valgrind.log

# valgrind any given test_x.py by running make test_x.py.valgrind
%.gen-suppressions: %
	$(TESTS_ENVIRONMENT)                                    \
	G_DEBUG=gc-friendly G_SLICE=always-malloc					\
	$(VALGRIND_PATH) -q					\
	--suppressions=$(GSTSUPP)				\
	--suppressions=$(PYTHONSUPP)				\
	--suppressions=$(GSTPYTHONSUPP)				\
	--tool=memcheck --leak-check=full --trace-children=yes  \
	--leak-resolution=high --num-callers=50			\
	--gen-suppressions=all					\
	$(PYTHON)						\
	$* 2>&1 | tee valgrind.log
	@if grep "tely lost" valgrind.log; then                 \
	    rm valgrind.log;                                    \
	    exit 1;                                             \
	fi
	@rm valgrind.log

%.check: %
	@PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py
	@PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py $*
	@rm -fr *.pyc

# valgrind all tests
valgrind: $(tests)
	@echo "Valgrinding tests ..."
	@failed=0;                                                      \
	for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(tests)); do   \
	        make $$t.valgrind;                                      \
	        if test "$$?" -ne 0; then                               \
	                echo "Valgrind error for test $$t";             \
	                failed=`expr $$failed + 1`;                     \
	                whicht="$$whicht $$t";                          \
	        fi;                                                     \
	done;                                                           \
	if test "$$failed" -ne 0; then                                  \
	        echo "$$failed tests had leaks under valgrind:";        \
	        echo "$$whicht";                                        \
	        false;                                                  \
	fi