Merge lp:~oif-team/geis/geis2-add-subscription-activation into lp:geis
- geis2-add-subscription-activation
- Merge into trunk
Proposed by
Stephen M. Webb
Status: | Merged |
---|---|
Merged at revision: | 94 |
Proposed branch: | lp:~oif-team/geis/geis2-add-subscription-activation |
Merge into: | lp:geis |
Prerequisite: | lp:~oif-team/geis/event-control-functions |
Diff against target: |
586 lines (+318/-17) 15 files modified
ChangeLog (+36/-0) include/geis/geis.h (+20/-0) libutouch-geis/geis.c (+44/-0) libutouch-geis/geis_backend.c (+22/-0) libutouch-geis/geis_backend.h (+10/-0) libutouch-geis/geis_backend_protected.h (+3/-1) libutouch-geis/geis_backend_test_fixture.c (+26/-2) libutouch-geis/geis_private.h (+39/-0) libutouch-geis/geis_subscription.c (+20/-0) libutouch-geis/geis_subscription.h (+10/-3) libutouch-geis/libutouch-geis.ver (+2/-0) testsuite/geis2/check_subscription.c (+7/-3) testsuite/libutouch-geis/Makefile.am (+1/-1) testsuite/libutouch-geis/check_backend_multiplexor.c (+7/-5) testsuite/libutouch-geis/check_geis_private.c (+71/-2) |
To merge this branch: | bzr merge lp:~oif-team/geis/geis2-add-subscription-activation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chase Douglas (community) | Approve | ||
Review via email: mp+43492@code.launchpad.net |
Commit message
Description of the change
Two smaller enabling changes that set the stage for back end implementations.
(1) Add a call pair for back ends to multiplex/
(2) Add the GEIS v2.0 subscription activation functions and associated forwarding function to propagate the calls through to the back ends.
Test cases are included.
To post a comment you must log in.
Revision history for this message
Henrik Rydberg (rydberg) wrote : | # |
- 95. By Stephen M. Webb
-
Added GEIS v2.0 subscription activation calls.
Revision history for this message
Stephen M. Webb (bregma) wrote : | # |
Typos fixed.
Revision history for this message
Chase Douglas (chasedouglas) wrote : | # |
No problems here.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' |
2 | --- ChangeLog 2010-12-13 14:13:50 +0000 |
3 | +++ ChangeLog 2010-12-13 14:13:50 +0000 |
4 | @@ -1,3 +1,39 @@ |
5 | +2010-12-12 Stephen M. Webb <stephen.webb@canonical.com> |
6 | + |
7 | + Added GEIS v2.0 subscription activation calls. |
8 | + |
9 | + * include/geis/geis.h (geis_subscription_activate): new function |
10 | + (geis_subscription_deactivate): new function |
11 | + * libutouch-geis/geis_subscription.c: implemented above new functions |
12 | + * libutouch-geis/geis_backend.h (geis_backend_subscribe) new function |
13 | + (geis_backend_unsubscribe): new function |
14 | + * libutouch-geis/geis_backend.c: implemented above new functions |
15 | + * libutouch-geis/geis_backend_protected.h (GeisBackendVtable): added new |
16 | + subscribe and unsubscribe function pointers |
17 | + * libutouch-geis/geis_backend_test_fixture.c (_subscribe): new vfunction |
18 | + (_unsubscribe): new vfunction |
19 | + * libutouch-geis/geis_private.h (geis_activate_subscription): new function |
20 | + (geis_deactivate_subscription): new function |
21 | + * libutouch-geis/geis.c: implemented above new functions |
22 | + * libutouch-geis/geis_subscription.h: fixed a typo in a prototype |
23 | + * libutouch-geis/libutouch-geis.ver: added new GEIS v2.0 symbols |
24 | + * testsuite/geis2/check_subscription.c: new test cases |
25 | + |
26 | +2010-12-12 Stephen M. Webb <stephen.webb@canonical.com> |
27 | + |
28 | + Added forwarding functions so back ends can multiplex file descriptors through |
29 | + the API. |
30 | + |
31 | + * libutouch-geis/geis_private.h (geis_multiplex_fd): new function |
32 | + (geis_demultiplex_fd): new function |
33 | + * libutouch-geis/geis.c: implemented above new functions |
34 | + * testsuite/libutouch-geis/check_geis_private.c: |
35 | + renamed from check_backend_event_posting.c |
36 | + (multiplex_fd): new test case |
37 | + * testsuite/libutouch-geis/Makefile.am: renamed above file |
38 | + * testsuite/libutouch-geis/check_backend_multiplexor.c: removed debug message |
39 | + silenced build warnings |
40 | + |
41 | 2010-12-08 Stephen M. Webb <stephen.webb@canonical.com> |
42 | |
43 | Refactored event queue style. |
44 | |
45 | === modified file 'include/geis/geis.h' |
46 | --- include/geis/geis.h 2010-12-13 14:13:50 +0000 |
47 | +++ include/geis/geis.h 2010-12-13 14:13:50 +0000 |
48 | @@ -677,6 +677,26 @@ |
49 | GEIS_API GeisStatus geis_subscription_delete(GeisSubscription subscription); |
50 | |
51 | /** |
52 | + * Activates a subscription. |
53 | + * |
54 | + * @param[in] subscription The subscription. |
55 | + * |
56 | + * Puts the subscription into the active state. Gesture events will be |
57 | + * delivered for this subscription. |
58 | + */ |
59 | +GEIS_API GeisStatus geis_subscription_activate(GeisSubscription subscription); |
60 | + |
61 | +/** |
62 | + * Deactivates a subscription. |
63 | + * |
64 | + * @param[in] subscription The subscription. |
65 | + * |
66 | + * Puts the subscription into the inactive state. Gesture events will not be |
67 | + * delivered for this subscription. |
68 | + */ |
69 | +GEIS_API GeisStatus geis_subscription_deactivate(GeisSubscription subscription); |
70 | + |
71 | +/** |
72 | * Gets the name given to a subscription when it was created. |
73 | * |
74 | * @param[in] subscription The subscription. |
75 | |
76 | === modified file 'libutouch-geis/geis.c' |
77 | --- libutouch-geis/geis.c 2010-12-13 14:13:50 +0000 |
78 | +++ libutouch-geis/geis.c 2010-12-13 14:13:50 +0000 |
79 | @@ -362,6 +362,30 @@ |
80 | } |
81 | |
82 | |
83 | +/* |
84 | + * Adds a back end file descriptor to multiplex. |
85 | + */ |
86 | +void |
87 | +geis_multiplex_fd(Geis geis, |
88 | + int fd, |
89 | + GeisBackendFdEventCallback callback, |
90 | + void *context) |
91 | +{ |
92 | + geis_backend_multiplexor_add_fd(geis->backend_multiplexor, |
93 | + fd, callback, context); |
94 | +} |
95 | + |
96 | + |
97 | +/* |
98 | + * Removes a back end file descriptor from the multiplex. |
99 | + */ |
100 | +void |
101 | +geis_demultiplex_fd(Geis geis, int fd) |
102 | +{ |
103 | + geis_backend_multiplexor_remove_fd(geis->backend_multiplexor, fd); |
104 | +} |
105 | + |
106 | + |
107 | GeisErrorStack * |
108 | geis_error_stack(Geis geis) |
109 | { |
110 | @@ -376,3 +400,23 @@ |
111 | } |
112 | |
113 | |
114 | +/* |
115 | + * Activates a subscription. |
116 | + */ |
117 | +GeisStatus |
118 | +geis_activate_subscription(Geis geis, GeisSubscription sub) |
119 | +{ |
120 | + return geis_backend_subscribe(geis->backend, sub); |
121 | +} |
122 | + |
123 | + |
124 | +/* |
125 | + * Deactivates a subscription. |
126 | + */ |
127 | +GeisStatus |
128 | +geis_deactivate_subscription(Geis geis, GeisSubscription sub) |
129 | +{ |
130 | + return geis_backend_unsubscribe(geis->backend, sub); |
131 | +} |
132 | + |
133 | + |
134 | |
135 | === modified file 'libutouch-geis/geis_backend.c' |
136 | --- libutouch-geis/geis_backend.c 2010-12-02 19:09:57 +0000 |
137 | +++ libutouch-geis/geis_backend.c 2010-12-13 14:13:50 +0000 |
138 | @@ -63,3 +63,25 @@ |
139 | return be->be_name; |
140 | } |
141 | |
142 | + |
143 | +/** |
144 | + * Forwarding function for subscription activation. |
145 | + */ |
146 | +GeisStatus |
147 | +geis_backend_subscribe(GeisBackend be, GeisSubscription sub) |
148 | +{ |
149 | + return be->be_vtbl->subscribe(be, sub); |
150 | +} |
151 | + |
152 | + |
153 | +/** |
154 | + * Forwarding function for subscription deactivation. |
155 | + */ |
156 | +GeisStatus |
157 | +geis_backend_unsubscribe(GeisBackend be, GeisSubscription sub) |
158 | +{ |
159 | + return be->be_vtbl->unsubscribe(be, sub); |
160 | +} |
161 | + |
162 | + |
163 | + |
164 | |
165 | === modified file 'libutouch-geis/geis_backend.h' |
166 | --- libutouch-geis/geis_backend.h 2010-12-06 12:10:40 +0000 |
167 | +++ libutouch-geis/geis_backend.h 2010-12-13 14:13:50 +0000 |
168 | @@ -53,4 +53,14 @@ |
169 | */ |
170 | GeisString geis_backend_name(GeisBackend be); |
171 | |
172 | +/** |
173 | + * Asks the back end to create a described subscription. |
174 | + */ |
175 | +GeisStatus geis_backend_subscribe(GeisBackend be, GeisSubscription sub); |
176 | + |
177 | +/** |
178 | + * Asks a back end to remove a subscription. |
179 | + */ |
180 | +GeisStatus geis_backend_unsubscribe(GeisBackend be, GeisSubscription sub); |
181 | + |
182 | #endif /* GEIS_BACKEND_H_ */ |
183 | |
184 | === modified file 'libutouch-geis/geis_backend_protected.h' |
185 | --- libutouch-geis/geis_backend_protected.h 2010-12-02 19:09:57 +0000 |
186 | +++ libutouch-geis/geis_backend_protected.h 2010-12-13 14:13:50 +0000 |
187 | @@ -35,7 +35,9 @@ |
188 | */ |
189 | typedef struct _GeisBackendVtable |
190 | { |
191 | - void (* finalize)(GeisBackend); |
192 | + void (* finalize)(GeisBackend); |
193 | + GeisStatus (* subscribe)(GeisBackend, GeisSubscription); |
194 | + GeisStatus (* unsubscribe)(GeisBackend, GeisSubscription); |
195 | } *GeisBackendVtable; |
196 | |
197 | /** |
198 | |
199 | === modified file 'libutouch-geis/geis_backend_test_fixture.c' |
200 | --- libutouch-geis/geis_backend_test_fixture.c 2010-12-02 19:09:57 +0000 |
201 | +++ libutouch-geis/geis_backend_test_fixture.c 2010-12-13 14:13:50 +0000 |
202 | @@ -32,16 +32,40 @@ |
203 | |
204 | |
205 | static void |
206 | -geis_backend_finalize(GeisBackend be) |
207 | +_finalize(GeisBackend be) |
208 | { |
209 | GeisBackendTestFixture tf __attribute__((unused)) = (GeisBackendTestFixture)be; |
210 | } |
211 | |
212 | |
213 | +static GeisStatus |
214 | +_subscribe(GeisBackend be __attribute__((unused)), |
215 | + GeisSubscription sub __attribute__((unused))) |
216 | +{ |
217 | + geis_debug("begins"); |
218 | + GeisStatus status = GEIS_STATUS_SUCCESS; |
219 | + geis_debug("ends"); |
220 | + return status; |
221 | +} |
222 | + |
223 | + |
224 | +static GeisStatus |
225 | +_unsubscribe(GeisBackend be __attribute__((unused)), |
226 | + GeisSubscription sub __attribute__((unused))) |
227 | +{ |
228 | + geis_debug("begins"); |
229 | + GeisStatus status = GEIS_STATUS_SUCCESS; |
230 | + geis_debug("ends"); |
231 | + return status; |
232 | +} |
233 | + |
234 | static struct _GeisBackendVtable tf_vtbl = { |
235 | - geis_backend_finalize |
236 | + _finalize, |
237 | + _subscribe, |
238 | + _unsubscribe |
239 | }; |
240 | |
241 | + |
242 | GeisBackend |
243 | geis_backend_new_test_fixture(Geis geis __attribute__((unused))) |
244 | { |
245 | |
246 | === modified file 'libutouch-geis/geis_private.h' |
247 | --- libutouch-geis/geis_private.h 2010-12-13 14:13:50 +0000 |
248 | +++ libutouch-geis/geis_private.h 2010-12-13 14:13:50 +0000 |
249 | @@ -2,6 +2,9 @@ |
250 | * @file geis_error.h |
251 | * @brief internal GEIS error facilities |
252 | * |
253 | + * This file is the internal interface to the GEIS API object. It provides the |
254 | + * implementation hooks for back ends to pass information through the API. |
255 | + * |
256 | * Copyright 2010 Canonical Ltd. |
257 | * |
258 | * This library is free software; you can redistribute it and/or modify it under |
259 | @@ -24,6 +27,7 @@ |
260 | #include <geis/geis.h> |
261 | |
262 | #include "geis_error.h" |
263 | +#include "geis_backend_multiplexor.h" |
264 | #include "geis_subscription.h" |
265 | |
266 | |
267 | @@ -41,6 +45,26 @@ |
268 | */ |
269 | GeisSubBag geis_subscription_bag(Geis geis); |
270 | |
271 | +/** |
272 | + * Adds a back end file descriptor to multiplex. |
273 | + * |
274 | + * @param[in] geis The API instance. |
275 | + * @param[in] fd The file descriptor to add. |
276 | + * @param[in] callback The file descriptor event callback. |
277 | + * @param[in] context A contextual datum. |
278 | + */ |
279 | +void geis_multiplex_fd(Geis geis, |
280 | + int fd, |
281 | + GeisBackendFdEventCallback callback, |
282 | + void *context); |
283 | + |
284 | +/** |
285 | + * Removes a back end file descriptor from the multiplex. |
286 | + * |
287 | + * @param[in] geis The API instance. |
288 | + * @param[in] fd The file descriptor to remove. |
289 | + */ |
290 | +void geis_demultiplex_fd(Geis geis, int fd); |
291 | |
292 | /** |
293 | * Posts a new event through the API. |
294 | @@ -50,5 +74,20 @@ |
295 | */ |
296 | void geis_post_event(Geis geis, GeisEvent event); |
297 | |
298 | +/** |
299 | + * Activates a subscription in the back end. |
300 | + * |
301 | + * @param[in] geis The API instance. |
302 | + * @param[in] sub The subscription. |
303 | + */ |
304 | +GeisStatus geis_activate_subscription(Geis geis, GeisSubscription sub); |
305 | + |
306 | +/** |
307 | + * Activates a subscription in the back end. |
308 | + * |
309 | + * @param[in] geis The API instance. |
310 | + * @param[in] sub The subscription. |
311 | + */ |
312 | +GeisStatus geis_deactivate_subscription(Geis geis, GeisSubscription sub); |
313 | |
314 | #endif /* GEIS_PRIVATE_H_ */ |
315 | |
316 | === modified file 'libutouch-geis/geis_subscription.c' |
317 | --- libutouch-geis/geis_subscription.c 2010-11-29 02:16:02 +0000 |
318 | +++ libutouch-geis/geis_subscription.c 2010-12-13 14:13:50 +0000 |
319 | @@ -176,6 +176,26 @@ |
320 | } |
321 | |
322 | |
323 | +/* |
324 | + * Activates a subscirption. |
325 | + */ |
326 | +GeisStatus |
327 | +geis_subscription_activate(GeisSubscription sub) |
328 | +{ |
329 | + return geis_activate_subscription(sub->sub_geis, sub); |
330 | +} |
331 | + |
332 | + |
333 | +/* |
334 | + * Deactivates a subscirption. |
335 | + */ |
336 | +GeisStatus |
337 | +geis_subscription_deactivate(GeisSubscription sub) |
338 | +{ |
339 | + return geis_deactivate_subscription(sub->sub_geis, sub); |
340 | +} |
341 | + |
342 | + |
343 | /** |
344 | * Creates a new subsciption on an API instance. |
345 | */ |
346 | |
347 | === modified file 'libutouch-geis/geis_subscription.h' |
348 | --- libutouch-geis/geis_subscription.h 2010-11-29 02:16:02 +0000 |
349 | +++ libutouch-geis/geis_subscription.h 2010-12-13 14:13:50 +0000 |
350 | @@ -55,15 +55,22 @@ |
351 | /** |
352 | * Creates a new subscription object in a subscription container. |
353 | * |
354 | - * @param[in] bag The bag. |
355 | + * @param[in] bag The container. |
356 | + * @param[in] sub The subscription to be added. |
357 | * |
358 | * @returns the index of the newly inserted subscription |
359 | */ |
360 | GeisSize geis_subscription_bag_insert(GeisSubBag bag, |
361 | GeisSubscription sub); |
362 | |
363 | -void geis_subscription_bag_removed(GeisSubBag bag, |
364 | - GeisSubscription sub); |
365 | +/** |
366 | + * Removes a subscription from a subscription container. |
367 | + * |
368 | + * @param[in] bag The subscription container. |
369 | + * @param[in] sub The subscription to be removed. |
370 | + */ |
371 | +void geis_subscription_bag_remove(GeisSubBag bag, |
372 | + GeisSubscription sub); |
373 | |
374 | /** |
375 | * Looks for an subscription in an subscription container. |
376 | |
377 | === modified file 'libutouch-geis/libutouch-geis.ver' |
378 | --- libutouch-geis/libutouch-geis.ver 2010-12-13 14:13:50 +0000 |
379 | +++ libutouch-geis/libutouch-geis.ver 2010-12-13 14:13:50 +0000 |
380 | @@ -29,7 +29,9 @@ |
381 | geis_next_event; |
382 | geis_register_event_callback; |
383 | geis_set_configuration; |
384 | + geis_subscription_activate; |
385 | geis_subscription_add_filter; |
386 | + geis_subscription_deactivate; |
387 | geis_subscription_delete; |
388 | geis_subscription_id; |
389 | geis_subscription_name; |
390 | |
391 | === modified file 'testsuite/geis2/check_subscription.c' |
392 | --- testsuite/geis2/check_subscription.c 2010-12-02 19:09:57 +0000 |
393 | +++ testsuite/geis2/check_subscription.c 2010-12-13 14:13:50 +0000 |
394 | @@ -37,12 +37,16 @@ |
395 | START_TEST(construction) |
396 | { |
397 | GeisSubscription sub = geis_subscription_new(g_geis, |
398 | - "name", |
399 | - GEIS_SUBSCRIPTION_NONE); |
400 | + "name", |
401 | + GEIS_SUBSCRIPTION_NONE); |
402 | fail_unless(sub != NULL, |
403 | "failed to create subscription"); |
404 | fail_unless(0 == strcmp(geis_subscription_name(sub), "name"), |
405 | - "unexpected subscription name returned"); |
406 | + "unexpected subscription name returned"); |
407 | + fail_unless(GEIS_STATUS_SUCCESS == geis_subscription_activate(sub), |
408 | + "unable to activate subscription"); |
409 | + fail_unless(GEIS_STATUS_SUCCESS == geis_subscription_deactivate(sub), |
410 | + "unable to deactivate subscription"); |
411 | geis_subscription_delete(sub); |
412 | } |
413 | END_TEST |
414 | |
415 | === modified file 'testsuite/libutouch-geis/Makefile.am' |
416 | --- testsuite/libutouch-geis/Makefile.am 2010-12-13 14:13:50 +0000 |
417 | +++ testsuite/libutouch-geis/Makefile.am 2010-12-13 14:13:50 +0000 |
418 | @@ -32,7 +32,7 @@ |
419 | |
420 | check_geis2_internals_SOURCES = \ |
421 | check_attr.c \ |
422 | - check_backend_event_posting.c \ |
423 | + check_geis_private.c \ |
424 | check_backend_multiplexor.c \ |
425 | check_error_reporting.c \ |
426 | check_event_queue.c \ |
427 | |
428 | === modified file 'testsuite/libutouch-geis/check_backend_multiplexor.c' |
429 | --- testsuite/libutouch-geis/check_backend_multiplexor.c 2010-12-02 16:54:02 +0000 |
430 | +++ testsuite/libutouch-geis/check_backend_multiplexor.c 2010-12-13 14:13:50 +0000 |
431 | @@ -3,9 +3,10 @@ |
432 | */ |
433 | #include <check.h> |
434 | |
435 | +#include <errno.h> |
436 | #include "geis/geis.h" |
437 | #include "libutouch-geis/geis_backend_multiplexor.h" |
438 | -#include <stdio.h> |
439 | +#include <string.h> |
440 | #include <sys/select.h> |
441 | #include <unistd.h> |
442 | |
443 | @@ -31,7 +32,7 @@ |
444 | testcase_event_callback(int fd, GeisBackendMultiplexorEvent event, void *context) |
445 | { |
446 | char buf[2]; |
447 | - (void)read(fd, buf, 1); |
448 | + ssize_t ssize = read(fd, buf, 1); |
449 | *(int *)context += 1; |
450 | } |
451 | |
452 | @@ -57,7 +58,8 @@ |
453 | int status = 0; |
454 | int first_time = 1; |
455 | |
456 | - (void)pipe(pfd); |
457 | + fail_unless(pipe(pfd) == 0, "error %d creating self-pipe: %d", |
458 | + errno, strerror(errno)); |
459 | geis_backend_multiplexor_add_fd(g_mx, pfd[0], testcase_event_callback, &called); |
460 | |
461 | while (1) |
462 | @@ -78,14 +80,14 @@ |
463 | } |
464 | else if (0 == status) |
465 | { |
466 | - fprintf(stderr, "select timeout\n"); |
467 | fail_unless(first_time, "select timed out before read"); |
468 | if (!first_time) |
469 | { |
470 | break; |
471 | } |
472 | first_time = 0; |
473 | - (void)write(pfd[1], "1", 1); |
474 | + ssize_t ssize = write(pfd[1], "1", 1); |
475 | + fail_unless(ssize == 1, "error writing to self-pipe"); |
476 | } |
477 | else |
478 | { |
479 | |
480 | === renamed file 'testsuite/libutouch-geis/check_backend_event_posting.c' => 'testsuite/libutouch-geis/check_geis_private.c' |
481 | --- testsuite/libutouch-geis/check_backend_event_posting.c 2010-12-13 14:13:50 +0000 |
482 | +++ testsuite/libutouch-geis/check_geis_private.c 2010-12-13 14:13:50 +0000 |
483 | @@ -3,9 +3,14 @@ |
484 | */ |
485 | #include <check.h> |
486 | |
487 | +#include <errno.h> |
488 | #include "geis/geis.h" |
489 | #include "libutouch-geis/geis_event.h" |
490 | #include "libutouch-geis/geis_private.h" |
491 | +#include <string.h> |
492 | +#include <sys/select.h> |
493 | +#include <unistd.h> |
494 | + |
495 | |
496 | /* fixtures */ |
497 | Geis g_geis; |
498 | @@ -22,6 +27,14 @@ |
499 | geis_delete(g_geis); |
500 | } |
501 | |
502 | +static void |
503 | +testcase_event_callback(int fd, GeisBackendMultiplexorEvent event, void *context) |
504 | +{ |
505 | + char buf[2]; |
506 | + ssize_t ssize = read(fd, buf, 1); |
507 | + *(int *)context += 1; |
508 | +} |
509 | + |
510 | START_TEST(backend_post) |
511 | { |
512 | GeisStatus status; |
513 | @@ -54,15 +67,71 @@ |
514 | } |
515 | END_TEST |
516 | |
517 | +START_TEST(multiplex_fd) |
518 | +{ |
519 | + int pfd[2]; |
520 | + int geis_fd; |
521 | + int called = 0; |
522 | + int status = 0; |
523 | + int first_time = 1; |
524 | + GeisStatus gstat = geis_get_configuration(g_geis, |
525 | + GEIS_CONFIGURATION_FD, |
526 | + &geis_fd); |
527 | + fail_unless(gstat == GEIS_STATUS_SUCCESS, "unable to get GEIS fd"); |
528 | + |
529 | + fail_unless(pipe(pfd) == 0, "error %d creating self-pipe: %d", |
530 | + errno, strerror(errno)); |
531 | + geis_multiplex_fd(g_geis, pfd[0], testcase_event_callback, &called); |
532 | + |
533 | + while (1) |
534 | + { |
535 | + fd_set fds; |
536 | + FD_ZERO(&fds); |
537 | + FD_SET(geis_fd, &fds); |
538 | + |
539 | + struct timeval tm; |
540 | + tm.tv_sec = 0; |
541 | + tm.tv_usec = 5000; |
542 | + |
543 | + status = select(geis_fd+1, &fds, NULL, NULL, &tm); |
544 | + fail_if(status < 0, "error in select"); |
545 | + if (status < 0) |
546 | + { |
547 | + break; |
548 | + } |
549 | + else if (0 == status) |
550 | + { |
551 | + fail_unless(first_time, "select timed out before read"); |
552 | + if (!first_time) |
553 | + { |
554 | + break; |
555 | + } |
556 | + first_time = 0; |
557 | + ssize_t ssize = write(pfd[1], "1", 1); |
558 | + fail_unless(ssize == 1, "error writing to self-pipe"); |
559 | + } |
560 | + else |
561 | + { |
562 | + geis_dispatch_events(g_geis); |
563 | + break; |
564 | + } |
565 | + } |
566 | + |
567 | + fail_if(called == 0, "event callback not called"); |
568 | + fail_if(called > 1, "event callback called too many times"); |
569 | +} |
570 | +END_TEST |
571 | + |
572 | /* boilerplate */ |
573 | Suite * |
574 | make_backend_event_posting_suite() |
575 | { |
576 | - Suite *s = suite_create("utouch-geis2-backend-event-posting"); |
577 | + Suite *s = suite_create("utouch-geis2-geis-private"); |
578 | |
579 | - TCase *usage = tcase_create("backend-event-posting-usage"); |
580 | + TCase *usage = tcase_create("backend-event-posting"); |
581 | tcase_add_checked_fixture(usage, construct_geis, destroy_geis); |
582 | tcase_add_test(usage, backend_post); |
583 | + tcase_add_test(usage, multiplex_fd); |
584 | suite_add_tcase(s, usage); |
585 | |
586 | return s; |
Just a couple of typos:
+ * Asks the back end to create a descibed subscription.
+ * Asks a back end to removed a subscription.
Thanks!