summaryrefslogtreecommitdiff
path: root/tests/twisted/Makefile.am
blob: c679a4c0f4d5e42080ef3ed55a3e578563ca606c (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# Tests that don't need their own MC instance, although in practice
# we currently run them in their own MC instance anyway.
TWISTED_BASIC_TESTS = \
	account-manager/account-basics.py \
	account-manager/avatar.py \
	account-manager/backend-makes-changes.py \
	account-manager/bad-cm.py \
	account-manager/crashy-cm.py \
	account-manager/create-auto-connect.py \
	account-manager/create-twice.py \
	account-manager/create-with-properties.py \
	account-manager/enable-auto-connect.py \
	account-manager/enable.py \
	account-manager/irc.py \
	account-manager/nickname.py \
	account-manager/param-types.py \
	account-manager/presence.py \
	account-manager/reconnect.py \
	account-manager/recover-from-disconnect.py \
	account-manager/req-conn-fails.py \
	account-manager/request-online.py \
	account-manager/restricted-storage.py \
	account-manager/service.py \
	account-manager/update-parameters.py \
	account-requests/cancel.py \
	account-requests/create-text.py \
	account-requests/delete-account-during-request.py \
	account/addressing.py \
	capabilities/contact-caps.py \
	dispatcher/already-has-channel.py \
	dispatcher/approver-fails.py \
	dispatcher/bypass-approval.py \
	dispatcher/cancel.py \
	dispatcher/capture-bundle.py \
	dispatcher/cdo-claim.py \
	dispatcher/connect-for-request.py \
	dispatcher/create-delayed-by-mini-plugin.py \
	dispatcher/create-handler-fails.py \
	dispatcher/create-hints.py \
	dispatcher/create-no-preferred-handler.py \
	dispatcher/create-rejected-by-mini-plugin.py \
	dispatcher/create-text.py \
	dispatcher/created-behind-our-back.py \
	dispatcher/delay-approvers.py \
	dispatcher/delay-then-call-handle-with.py \
	dispatcher/delay-then-dont-call-approvers.py \
	dispatcher/dispatch-activatable.py \
	dispatcher/dispatch-before-connected.py \
	dispatcher/dispatch-delayed-by-mini-plugin.py \
	dispatcher/dispatch-rejected-by-mini-plugin.py \
	dispatcher/dispatch-text.py \
	dispatcher/ensure-and-redispatch.py \
	dispatcher/ensure-is-approval.py \
	dispatcher/ensure-rapidly.py \
	dispatcher/exploding-bundles.py \
	dispatcher/fdo-21034.py \
	dispatcher/handle-channels-fails.py \
	dispatcher/lose-text.py \
	dispatcher/recover-from-disconnect.py \
	dispatcher/redispatch-channels.py \
	dispatcher/request-disabled-account.py \
	dispatcher/respawn-activatable-observers.py \
	dispatcher/respawn-observers.py \
	dispatcher/some-delay-approvers.py \
	dispatcher/undispatchable.py \
	dispatcher/vanishing-client.py \
	$(NULL)

# Tests that aren't to be run if we're running the real (installed) MC,
# because they rely on special behaviour of mc-debug-server.
#
# For simplicity, these are also separate tests: at least
# account-storage/*.py need their own instances.
TWISTED_SPECIAL_BUILD_TESTS = \
	account-manager/connectivity.py \
	account-storage/diverted-storage.py \
	account-storage/5-12.py \
	account-storage/5-14.py \
	account-storage/create-new.py \
	account-storage/load-keyfiles.py \
	account-manager/server-drops-us.py \
	$(NULL)

# Tests that need their own MC instance.
TWISTED_SEPARATE_TESTS = \
	account-manager/auto-connect.py \
	account-manager/avatar-refresh.py \
	account-manager/device-idle.py \
	account-manager/make-valid.py \
	crash-recovery/crash-recovery.py \
	dispatcher/create-at-startup.py

# All the tests that are run by "make check"
TWISTED_TESTS = \
	$(TWISTED_BASIC_TESTS) \
	$(TWISTED_SEPARATE_TESTS) \
	$(TWISTED_SPECIAL_BUILD_TESTS) \
	$(NULL)

# other files used by the twisted tests, but are not tests and are not built
# source
TWISTED_OTHER_FILES = \
	constants.py \
	fakeaccountsservice.py \
	fakeconnectivity.py \
	mctest.py \
	servicetest.py \
	account-storage/storage_helper.py \
	telepathy-1/clients/README \
	telepathy-1/clients/AbiWord.client \
	telepathy-1/clients/Logger.client \
	telepathy-1/managers/fakecm.manager \
	telepathy-1/managers/onewitheverything.manager \
	telepathy-1/managers/README \
	$(NULL)

# This deliberately doesn't include the TWISTED_SPECIAL_BUILD_TESTS
# since it's testing the real binary, not the "debug" binary.
mc-twisted-tests.list:
	$(AM_V_GEN)echo $(TWISTED_BASIC_TESTS) $(TWISTED_SEPARATE_TESTS) > $@

%.test: Makefile
	@$(MKDIR_P) $(dir $*)
	$(AM_V_GEN)( echo '[Test]'; \
		echo 'Exec=${twistedtestsdir}/run-test.sh $*.py'; \
		echo 'Type=session'; \
		echo 'Output=TAP' ) > $@.tmp
	@mv $@.tmp $@

run-test.sh: run-test.sh.in Makefile
	$(AM_V_GEN)sed \
		-e "s|[@]mctestsdir[@]|@mctestsdir@|g" \
		-e "s|[@]TEST_PYTHON[@]|$(PYTHON)|g" \
		$< > $@
	@chmod +x $@

if ENABLE_INSTALLED_TESTS
insttestdir = ${datadir}/installed-tests/telepathy-mission-control
nobase_nodist_insttest_DATA = \
	$(patsubst %.py,%.test,$(TWISTED_BASIC_TESTS)) \
	$(patsubst %.py,%.test,$(TWISTED_SEPARATE_TESTS)) \
	$(NULL)

# Install files in each directory. They could be tests, pristine data files,
# scripts or built source
twistedtestsdir = @mctestsdir@/twisted
nobase_nodist_twistedtests_SCRIPTS = \
	run-test.sh \
	$(NULL)
nobase_dist_twistedtests_DATA = \
	$(TWISTED_BASIC_TESTS) \
	$(TWISTED_SEPARATE_TESTS) \
	$(TWISTED_OTHER_FILES) \
	$(NULL)
nobase_nodist_twistedtests_DATA = \
	config.py \
	mc-twisted-tests.list \
	$(NULL)
endif

if HAVE_NM
HAVE_NM_PYBOOL = True
else
HAVE_NM_PYBOOL = False
endif

config.py: Makefile
	$(AM_V_GEN) { \
		echo "HAVE_NM = $(HAVE_NM_PYBOOL)"; \
	} > $@

BUILT_SOURCES = \
	config.py \
	mc-twisted-tests.list \
	run-test.sh \
	$(NULL)

AM_CFLAGS = $(ERROR_CFLAGS)

plugins_list = \
	mcp-plugin.la \
	mcp-account-diversion.la \
	libgiofakenetworkmonitor.la \
	$(NULL)

plugin_ldflags = -module -shared -avoid-version -no-undefined

if ENABLE_INSTALLED_TESTS

noinst_LTLIBRARIES = \
	$(NULL)
testplugindir = @mctestsdir@/twisted/plugins
testplugin_LTLIBRARIES = \
	$(plugins_list) \
	$(NULL)

else

# A demo dispatcher plugin (new, minimal API)
noinst_LTLIBRARIES = $(plugins_list)

# this rune is necessary to make libtool build a dlopen()able shared
# library even though it's not going to be installed - the default for noinst
# libraries is static
plugin_ldflags += -rpath @abs_builddir@

endif

mcp_plugin_la_SOURCES = \
	dbus-account-plugin.c \
	dbus-account-plugin.h \
	mcp-plugin.c \
	$(NULL)
mcp_plugin_la_LIBADD = \
	$(top_builddir)/mission-control-plugins/libmission-control-plugins-6.la \
	$(TELEPATHY_LIBS) \
	$(DBUS_LIBS) \
	$(GLIB_LIBS) \
	$(NULL)
mcp_plugin_la_LDFLAGS = $(plugin_ldflags)

libgiofakenetworkmonitor_la_SOURCES = \
	fake-network-monitor.c \
	$(NULL)
libgiofakenetworkmonitor_la_LIBADD = \
	$(TELEPATHY_LIBS) \
	$(GLIB_LIBS) \
	$(NULL)
libgiofakenetworkmonitor_la_LDFLAGS = $(plugin_ldflags)

mcp_account_diversion_la_SOURCES = mcp-account-diversion.c
mcp_account_diversion_la_LIBADD = \
	$(top_builddir)/mission-control-plugins/libmission-control-plugins-6.la \
	$(TELEPATHY_LIBS) \
	$(DBUS_LIBS) \
	$(GLIB_LIBS) \
	$(NULL)
mcp_account_diversion_la_LDFLAGS = $(plugin_ldflags)

# A debug version of the normal MC executable, which exits cleanly on
# disconnection from D-Bus (so gcov info gets written out)
noinst_PROGRAMS = mc-debug-server
mc_debug_server_SOURCES = mc-debug-server.c
mc_debug_server_LDADD = \
	$(top_builddir)/src/libmcd-convenience.la

AM_CPPFLAGS = \
	-I$(top_srcdir) -I$(top_builddir) \
	-I$(top_srcdir)/src -I$(top_builddir)/src \
	$(DBUS_CFLAGS) \
	$(TELEPATHY_CFLAGS) \
	-DMC_DISABLE_DEPRECATED \
	-DLIBDIR="@libdir@" -DLIBVERSION="0"

TESTS =

if WANT_TWISTED_TESTS
check-local: check-twisted

installcheck-local: installcheck-twisted
installcheck-twisted:
	$(MAKE) check-twisted \
		TWISTED_SPECIAL_BUILD_TESTS= \
		MC_EXECUTABLE=$(DESTDIR)@libexecdir@/mission-control-6

endif # WANT_TWISTED_TESTS

CHECK_TWISTED_SLOW =

check-twisted: $(BUILT_SOURCES)
	$(MAKE) -C tools
	rm -f core
	failed=0; \
	MC_TEST_UNINSTALLED=1 \
	  CHECK_TWISTED_SLOW=$(CHECK_TWISTED_SLOW) \
	  MC_ABS_TOP_SRCDIR=@abs_top_srcdir@ \
	  MC_ABS_TOP_BUILDDIR=@abs_top_builddir@ \
	  sh run-test.sh "${TWISTED_TESTS}${extra_tests}"
	if test -e core; then\
		echo "Core dump exists: core";\
		exit 1;\
	fi

EXTRA_DIST = \
	$(TWISTED_BASIC_TESTS) \
	$(TWISTED_SEPARATE_TESTS) \
	$(TWISTED_SPECIAL_BUILD_TESTS) \
	$(TWISTED_OTHER_FILES) \
	accounts/README \
	run-test.sh.in \
	$(NULL)

CLEANFILES = \
	accounts/accounts.cfg \
	accounts/.mc6_connections \
	mc-[1-9]*.log \
	missioncontrol.log \
	*.pyc \
	*/*.pyc \
	with-session-bus-*.dbus-monitor-logs \
	$(BUILT_SOURCES) \
	$(NULL)

check_misc_sources = $(TESTS)

SUBDIRS = tools