Imported Upstream version 3.11.1
[platform/upstream/pygobject2.git] / tests / Makefile.am
1 CLEANFILES =
2 check_LTLIBRARIES = libgimarshallingtests.la
3 test_typelibs = GIMarshallingTests-1.0.typelib
4
5 nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
6 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
7 libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS)
8
9 # This is a hack to make sure a shared library is built
10 libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES)
11         $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS)
12
13 GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
14         $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
15         --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
16         --warn-all --warn-error \
17         --library=libgimarshallingtests.la \
18         --libtool="$(top_builddir)/libtool" \
19         --output $@ \
20         $(nodist_libgimarshallingtests_la_SOURCES)
21 GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
22         $(AM_V_GEN) g-ir-compiler $< -o $@
23
24 # regress.c needs cairo
25 if ENABLE_CAIRO
26 check_LTLIBRARIES += libregress.la
27 test_typelibs += Regress-1.0.typelib
28 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
29 libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
30 libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS)
31
32 libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES)
33         $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
34
35 # g-i doesn't ship these as shared libraries anymore; we build them here
36 Regress-1.0.gir: libregress.la Makefile
37         $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
38         --namespace=Regress --nsversion=1.0 \
39         --warn-all --warn-error \
40         --library=libregress.la \
41         --libtool="$(top_builddir)/libtool" \
42         --output $@ \
43         $(nodist_libregress_la_SOURCES)
44 Regress-1.0.typelib: Regress-1.0.gir Makefile
45         $(AM_V_GEN) g-ir-compiler $< -o $@
46
47 endif # ENABLE_CAIRO
48
49
50 gschemas.compiled: org.gnome.test.gschema.xml
51         glib-compile-schemas --targetdir=. --schema-file=$<
52
53 CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
54
55 check_LTLIBRARIES += testhelper.la
56
57 testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
58 testhelper_la_LDFLAGS = -module -avoid-version
59 testhelper_la_LIBADD = $(GLIB_LIBS)
60 testhelper_la_SOURCES = \
61         testhelpermodule.c \
62         test-floating.c \
63         test-thread.c \
64         test-unknown.c
65
66 # This is a hack to make sure a shared library is built
67 testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
68         $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
69
70
71 .la.so:
72         test -L $@ || $(LN_S) .libs/$@ $@
73
74
75 all: $(check_LTLIBRARIES:.la=.so)
76
77 EXTRA_DIST = \
78         compathelper.py \
79         runtests.py \
80         runtests-windows.py \
81         testmodule.py \
82         test-floating.h \
83         test-thread.h \
84         test-unknown.h \
85         te_ST@nouppera \
86         org.gnome.test.gschema.xml \
87         test_gio.py \
88         test_glib.py \
89         test_gobject.py \
90         test_gtype.py \
91         test_interface.py \
92         test_internal_api.py \
93         test_iochannel.py \
94         test_mainloop.py \
95         test_object_marshaling.py \
96         test_option.py \
97         test_properties.py \
98         test_signal.py \
99         test_source.py \
100         test_subprocess.py \
101         test_thread.py \
102         test_everything.py \
103         test_gi.py \
104         test_gdbus.py \
105         test_overrides.py \
106         test_overrides_glib.py \
107         test_overrides_pango.py \
108         test_overrides_gdk.py \
109         test_overrides_gtk.py \
110         test_atoms.py \
111         test_generictreemodel.py \
112         test_docstring.py \
113         test_repository.py \
114         compat_test_pygtk.py \
115         gi/__init__.py \
116         gi/overrides/__init__.py \
117         gi/overrides/Regress.py \
118         $(NULL)
119
120 clean-local:
121         rm -f $(check_LTLIBRARIES:.la=.so) file.txt~
122
123 DBUS_LAUNCH=$(shell which dbus-launch)
124 RUN_TESTS_ENV_VARS= \
125         PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
126         LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
127         GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
128         XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
129         MALLOC_PERTURB_=85 \
130         MALLOC_CHECK_=3 \
131         G_SLICE=debug-blocks \
132         TESTS_BUILDDIR=$(builddir)
133
134 # pygtkcompat tests need to be run in a separate process as they
135 # clobber global name space
136 check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
137         @echo "  CHECK  Pyflakes"
138         @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
139         @if test -z "$$SKIP_PEP8"; then \
140                 echo "  CHECK  PEP8"; \
141                 if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi; \
142         fi
143         export `$(DBUS_LAUNCH)` && \
144         $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
145         [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
146         kill $$DBUS_SESSION_BUS_PID; \
147         exit $$rc
148
149 check.gdb:
150         EXEC_NAME="gdb --args" $(MAKE) check
151
152 check.nemiver:
153         EXEC_NAME="nemiver" $(MAKE) check
154
155 check.valgrind:
156         EXEC_NAME="G_SLICE=always-malloc valgrind --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_DEBUG=gc-friendly $(MAKE) check
157
158 check.valgrindlog:
159         mkdir -p $(top_builddir)/tmp
160         EXEC_NAME="G_SLICE=always-malloc valgrind --log-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.log --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_DEBUG=gc-friendly $(MAKE) check
161
162 check.valgrindxml:
163         mkdir -p $(top_builddir)/tmp
164         EXEC_NAME="G_SLICE=always-malloc valgrind --xml=yes --xml-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.xml --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_DEBUG=gc-friendly $(MAKE) check