Imported Upstream version 2.28.1
[platform/upstream/pygobject2.git] / tests / Makefile.am
1 CLEANFILES =
2 noinst_LTLIBRARIES = 
3 if ENABLE_INTROSPECTION
4 noinst_LTLIBRARIES += libregress.la libgimarshallingtests.la
5
6 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
7 libregress_la_CFLAGS = $(GIO_CFLAGS) $(PYCAIRO_CFLAGS)
8 libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(PYCAIRO_LIBS)
9 nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
10 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
11 libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS)
12
13 # This is a hack to make sure a shared library is built
14 libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES)
15         $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
16
17 libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES)
18         $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS)
19
20 # g-i doesn't ship these as shared libraries anymore; we build them here
21 Regress-1.0.gir: libregress.la Makefile
22         $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
23         --namespace=Regress --nsversion=1.0 \
24         --warn-all --warn-error \
25         --library=libregress.la \
26         --libtool="$(top_builddir)/libtool" \
27         --output $@ \
28         $(nodist_libregress_la_SOURCES)
29 Regress-1.0.typelib: Regress-1.0.gir Makefile
30         $(AM_V_GEN) g-ir-compiler $< -o $@
31
32 GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
33         $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
34         --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
35         --warn-all --warn-error \
36         --library=libgimarshallingtests.la \
37         --libtool="$(top_builddir)/libtool" \
38         --output $@ \
39         $(nodist_libgimarshallingtests_la_SOURCES)
40 GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
41         $(AM_V_GEN) g-ir-compiler $< -o $@
42
43 gschemas.compiled: org.gnome.test.gschema.xml
44         glib-compile-schemas --targetdir=. --schema-file=$<
45
46 CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
47 endif
48
49 noinst_LTLIBRARIES += testhelper.la
50
51 testhelper_la_CFLAGS = -I$(top_srcdir)/gobject -I$(top_srcdir)/glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
52 testhelper_la_LDFLAGS = -module -avoid-version
53 testhelper_la_LIBADD = $(GLIB_LIBS)
54 testhelper_la_SOURCES = \
55         testhelpermodule.c \
56         test-floating.c \
57         test-thread.c \
58         test-unknown.c
59
60 # This is a hack to make sure a shared library is built
61 testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
62         $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
63
64
65 .la.so:
66         test -L $@ || $(LN_S) .libs/$@ $@
67
68
69 all: $(LTLIBRARIES:.la=.so)
70
71 TEST_FILES_STATIC = \
72         test_gobject.py \
73         test_interface.py \
74         test_mainloop.py \
75         test_option.py \
76         test_properties.py \
77         test_signal.py \
78         test_source.py \
79         test_subprocess.py \
80         test_thread.py \
81         test_uris.py
82
83 if BUILD_GIO
84 TEST_FILES_GIO = \
85         test_gio.py \
86         test_gresolver.py \
87         test_gsocket.py \
88         test_gicon.py \
89         test_gcancellable.py
90 endif 
91
92 if ENABLE_INTROSPECTION
93 TEST_FILES_GI = \
94         test_everything.py \
95         test_gi.py \
96         test_gdbus.py \
97         test_overrides.py
98 endif
99
100 EXTRA_DIST = \
101         compathelper.py \
102         runtests.py \
103         testmodule.py \
104         test-floating.h \
105         test-thread.h \
106         test-unknown.h \
107         org.gnome.test.gschema.xml
108
109 EXTRA_DIST += $(TEST_FILES_STATIC) $(TEST_FILES_GI) $(TEST_FILES_GIO)
110
111 clean-local:
112         rm -f $(LTLIBRARIES:.la=.so) file.txt~
113
114 DBUS_LAUNCH=$(shell which dbus-launch)
115 RUN_TESTS_ENV_VARS= \
116         PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
117         LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
118         GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
119         XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share
120 RUN_TESTS_LAUNCH=$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py
121
122 # run tests in separately to avoid loading static and introspection bindings in the same process
123 check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
124         TEST_FILES="$(TEST_FILES_STATIC)" $(RUN_TESTS_LAUNCH)
125         TEST_FILES="$(TEST_FILES_GI)" $(RUN_TESTS_LAUNCH)
126 if BUILD_GIO
127         TEST_FILES="$(TEST_FILES_GIO)" $(RUN_TESTS_LAUNCH)
128 endif 
129
130 check.gdb:
131         EXEC_NAME="gdb --args" $(MAKE) check
132
133 check.valgrind:
134         EXEC_NAME="valgrind --suppressions=python.supp" G_SLICE=always-malloc G_DEBUG=gc-friendly $(MAKE) check
135
136 -include $(top_srcdir)/git.mk