081028a295cbeda5ab96f05f3f3c732542da2a7d
[platform/upstream/python-gobject.git] / tests / Makefile.am
1 CLEANFILES =
2 noinst_LTLIBRARIES = libregress.la libgimarshallingtests.la
3
4 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
5 libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
6 libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS)
7 nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
8 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
9 libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS)
10
11 # This is a hack to make sure a shared library is built
12 libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES)
13         $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
14
15 libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES)
16         $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS)
17
18 # g-i doesn't ship these as shared libraries anymore; we build them here
19 Regress-1.0.gir: libregress.la Makefile
20         $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
21         --namespace=Regress --nsversion=1.0 \
22         --warn-all --warn-error \
23         --library=libregress.la \
24         --libtool="$(top_builddir)/libtool" \
25         --output $@ \
26         $(nodist_libregress_la_SOURCES)
27 Regress-1.0.typelib: Regress-1.0.gir Makefile
28         $(AM_V_GEN) g-ir-compiler $< -o $@
29
30 GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
31         $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
32         --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
33         --warn-all --warn-error \
34         --library=libgimarshallingtests.la \
35         --libtool="$(top_builddir)/libtool" \
36         --output $@ \
37         $(nodist_libgimarshallingtests_la_SOURCES)
38 GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
39         $(AM_V_GEN) g-ir-compiler $< -o $@
40
41 gschemas.compiled: org.gnome.test.gschema.xml
42         glib-compile-schemas --targetdir=. --schema-file=$<
43
44 CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
45
46 noinst_LTLIBRARIES += testhelper.la
47
48 testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
49 testhelper_la_LDFLAGS = -module -avoid-version
50 testhelper_la_LIBADD = $(GLIB_LIBS)
51 testhelper_la_SOURCES = \
52         testhelpermodule.c \
53         test-floating.c \
54         test-thread.c \
55         test-unknown.c
56
57 # This is a hack to make sure a shared library is built
58 testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
59         $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
60
61
62 .la.so:
63         test -L $@ || $(LN_S) .libs/$@ $@
64
65
66 all: $(LTLIBRARIES:.la=.so)
67
68 EXTRA_DIST = \
69         compathelper.py \
70         runtests.py \
71         runtests-windows.py \
72         testmodule.py \
73         test-floating.h \
74         test-thread.h \
75         test-unknown.h \
76         te_ST@nouppera \
77         org.gnome.test.gschema.xml \
78         test_glib.py \
79         test_gobject.py \
80         test_interface.py \
81         test_mainloop.py \
82         test_option.py \
83         test_properties.py \
84         test_signal.py \
85         test_source.py \
86         test_subprocess.py \
87         test_thread.py \
88         test_uris.py \
89         test_everything.py \
90         test_gi.py \
91         test_gdbus.py \
92         test_overrides.py \
93         test_overrides_gio.py \
94         test_overrides_glib.py \
95         test_overrides_pango.py \
96         test_overrides_gdk.py \
97         test_overrides_gtk.py \
98         test_atoms.py \
99         test_pygtkcompat.py \
100         gi/__init__.py \
101         gi/overrides/__init__.py \
102         gi/overrides/Regress.py \
103         $(NULL)
104
105 clean-local:
106         rm -f $(LTLIBRARIES:.la=.so) file.txt~
107
108 DBUS_LAUNCH=$(shell which dbus-launch)
109 RUN_TESTS_ENV_VARS= \
110         PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
111         LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
112         GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
113         XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
114         MALLOC_PERTURB_=85 \
115         TESTS_BUILDDIR=$(builddir)
116
117 check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
118         @echo "  CHECK  Pyflakes"
119         @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
120         @echo "  CHECK  PEP8"
121         @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
122         $(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning $(srcdir)/runtests.py
123
124 check.gdb:
125         EXEC_NAME="gdb --args" $(MAKE) check
126
127 check.nemiver:
128         EXEC_NAME="nemiver" $(MAKE) check
129
130 check.valgrind:
131         EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_SLICE=always-malloc G_DEBUG=gc-friendly $(MAKE) check