blob: f148495afb2e63e3c9793291e9d0244c93f8b008 [file] [log] [blame]
Jakub Grajciar7c5c40d2017-08-30 10:13:25 +02001/*
2 *------------------------------------------------------------------
3 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
16 */
17
18#include <socket_test.h>
19
20#include <memif_private.h>
21#include <socket.h>
22
23static int
24get_queue_len (memif_msg_queue_elt_t * q)
25{
26 int r = 0;
27 memif_msg_queue_elt_t *c = q;
28 while (c != NULL)
29 {
30 r++;
31 c = c->next;
32 }
33 return r;
34}
35
36static void
37queue_free (memif_msg_queue_elt_t ** e)
38{
39 if (*e == NULL)
40 return;
41 queue_free (&(*e)->next);
42 free (*e);
43 *e = NULL;
44 return;
45}
46
47START_TEST (test_msg_queue)
48{
49 memif_connection_t conn;
50 conn.msg_queue = NULL;
51 conn.fd = -1;
52
53 int i, len = 10;
54
55 for (i = 0; i < len; i++)
56 {
57 if (i % 2)
58 memif_msg_enq_ack (&conn);
59 else
60 memif_msg_enq_init (&conn);
61 }
62
63 ck_assert_int_eq (len, get_queue_len (conn.msg_queue));
64
65 int pop = 6;
66
67 for (i = 0; i < pop; i++)
68 {
69 if (i % 2)
70 {
71 ck_assert_uint_eq (conn.msg_queue->msg.type, MEMIF_MSG_TYPE_ACK);
72 }
73 else
74 {
75 ck_assert_uint_eq (conn.msg_queue->msg.type, MEMIF_MSG_TYPE_INIT);
76 }
77 conn.flags |= MEMIF_CONNECTION_FLAG_WRITE;
78 /* function will return -1 because no socket is created */
79 memif_conn_fd_write_ready (&conn);
80 }
81
82 ck_assert_int_eq ((len - pop), get_queue_len (conn.msg_queue));
83
84 queue_free (&conn.msg_queue);
85}
86
87END_TEST
88START_TEST (test_enq_ack)
89{
90 int err;
91 memif_connection_t conn;
92 conn.msg_queue = NULL;
93
94 if ((err = memif_msg_enq_ack (&conn)) != MEMIF_ERR_SUCCESS)
95 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
96 memif_msg_queue_elt_t *e = conn.msg_queue;
97
98 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_ACK);
99 ck_assert_int_eq (e->fd, -1);
100 queue_free (&conn.msg_queue);
101}
102
103END_TEST
104START_TEST (test_enq_init)
105{
106 int err;
107 memif_connection_t conn;
108 conn.msg_queue = NULL;
109
110 conn.args.interface_id = 69;
111 conn.args.mode = 0;
112
113 strncpy ((char *) conn.args.instance_name, TEST_APP_NAME,
114 strlen (TEST_APP_NAME));
115 strncpy ((char *) conn.args.secret, TEST_SECRET, strlen (TEST_SECRET));
116
117 if ((err = memif_msg_enq_init (&conn)) != MEMIF_ERR_SUCCESS)
118 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
119
120 memif_msg_queue_elt_t *e = conn.msg_queue;
121
122 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_INIT);
123 ck_assert_int_eq (e->fd, -1);
124
125 memif_msg_init_t *i = &e->msg.init;
126
127 ck_assert_uint_eq (i->version, MEMIF_VERSION);
128 ck_assert_uint_eq (i->id, conn.args.interface_id);
129 ck_assert_uint_eq (i->mode, conn.args.mode);
130 ck_assert_str_eq (i->name, conn.args.instance_name);
131 ck_assert_str_eq (i->secret, conn.args.secret);
132 queue_free (&conn.msg_queue);
133}
134
135END_TEST
136START_TEST (test_enq_add_region)
137{
138 int err;
139 memif_connection_t conn;
140 conn.msg_queue = NULL;
141 conn.regions = (memif_region_t *) malloc (sizeof (memif_region_t));
142 memif_region_t *mr = conn.regions;
143 mr->fd = 5;
144 mr->region_size = 2048;
145 uint8_t region_index = 0;
146
147 if ((err =
148 memif_msg_enq_add_region (&conn, region_index)) != MEMIF_ERR_SUCCESS)
149 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
150
151 memif_msg_queue_elt_t *e = conn.msg_queue;
152
153 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_ADD_REGION);
154 ck_assert_int_eq (e->fd, mr->fd);
155
156 memif_msg_add_region_t *ar = &e->msg.add_region;
157
158 ck_assert_uint_eq (ar->index, region_index);
159 ck_assert_uint_eq (ar->size, mr->region_size);
160
161 free (conn.regions);
162 conn.regions = NULL;
163 mr = NULL;
164 queue_free (&conn.msg_queue);
165}
166
167END_TEST
168START_TEST (test_enq_add_ring)
169{
170 int err;
171 memif_connection_t conn;
172 conn.msg_queue = NULL;
173 conn.rx_queues = (memif_queue_t *) malloc (sizeof (memif_queue_t));
174 conn.tx_queues = (memif_queue_t *) malloc (sizeof (memif_queue_t));
175
176 memif_queue_t *mq = conn.tx_queues;
177 uint8_t dir = MEMIF_RING_S2M;
178 mq->int_fd = 5;
179 mq->offset = 0;
180 mq->log2_ring_size = 10;
181
182 if ((err = memif_msg_enq_add_ring (&conn, 0, dir)) != MEMIF_ERR_SUCCESS)
183 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
184
185 memif_msg_queue_elt_t *e = conn.msg_queue;
186
187 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_ADD_RING);
188 ck_assert_int_eq (e->fd, mq->int_fd);
189
190 memif_msg_add_ring_t *ar = &e->msg.add_ring;
191
192 ck_assert_uint_eq (ar->index, 0);
193 ck_assert_uint_eq (ar->offset, mq->offset);
194 ck_assert_uint_eq (ar->log2_ring_size, mq->log2_ring_size);
195 ck_assert (ar->flags & MEMIF_MSG_ADD_RING_FLAG_S2M);
196
197 dir = MEMIF_RING_M2S;
198 if ((err = memif_msg_enq_add_ring (&conn, 0, dir)) != MEMIF_ERR_SUCCESS)
199 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
200 queue_free (&conn.msg_queue);
201}
202
203END_TEST
204START_TEST (test_enq_connect)
205{
206 int err;
207 memif_connection_t conn;
208 conn.msg_queue = NULL;
209 memset (conn.args.interface_name, 0, sizeof (conn.args.interface_name));
210 strncpy ((char *) conn.args.interface_name, TEST_IF_NAME,
211 strlen (TEST_IF_NAME));
212
213 if ((err = memif_msg_enq_connect (&conn)) != MEMIF_ERR_SUCCESS)
214 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
215
216 memif_msg_queue_elt_t *e = conn.msg_queue;
217
218 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_CONNECT);
219 ck_assert_int_eq (e->fd, -1);
220 ck_assert_str_eq (e->msg.connect.if_name, TEST_IF_NAME);
221 queue_free (&conn.msg_queue);
222}
223
224END_TEST
225START_TEST (test_enq_connected)
226{
227 int err;
228 memif_connection_t conn;
229 conn.msg_queue = NULL;
230 memset (conn.args.interface_name, 0, sizeof (conn.args.interface_name));
231 strncpy ((char *) conn.args.interface_name, TEST_IF_NAME,
232 strlen (TEST_IF_NAME));
233
234 if ((err = memif_msg_enq_connected (&conn)) != MEMIF_ERR_SUCCESS)
235 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
236
237 memif_msg_queue_elt_t *e = conn.msg_queue;
238
239 ck_assert_uint_eq (e->msg.type, MEMIF_MSG_TYPE_CONNECTED);
240 ck_assert_int_eq (e->fd, -1);
241 ck_assert_str_eq (e->msg.connect.if_name, TEST_IF_NAME);
242 queue_free (&conn.msg_queue);
243}
244
245END_TEST
246START_TEST (test_send)
247{
248 int err;
249 int fd = -1, afd = 5;
250 memif_msg_t msg;
251 memset (&msg, 0, sizeof (msg));
252
253 if ((err = memif_msg_send (fd, &msg, afd)) != MEMIF_ERR_SUCCESS)
254 ck_assert_msg (err == MEMIF_ERR_BAD_FD,
255 "err code: %u, err msg: %s", err, memif_strerror (err));
256}
257
258END_TEST
259START_TEST (test_send_hello)
260{
261 int err;
262 memif_connection_t conn;
263 conn.fd = -1;
264 memset (conn.args.instance_name, 0, sizeof (conn.args.instance_name));
265 strncpy ((char *) conn.args.instance_name, TEST_APP_NAME,
266 strlen (TEST_APP_NAME));
267
268 if ((err =
269 memif_init (control_fd_update, TEST_APP_NAME)) != MEMIF_ERR_SUCCESS)
270 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
271
272 if ((err = memif_msg_send_hello (conn.fd)) != MEMIF_ERR_SUCCESS)
273 ck_assert_msg (err == MEMIF_ERR_BAD_FD,
274 "err code: %u, err msg: %s", err, memif_strerror (err));
275}
276
277END_TEST
278START_TEST (test_send_disconnect)
279{
280 int err;
281 memif_connection_t conn;
282 conn.fd = -1;
283
284 /* only possible fail if memif_msg_send fails... */
285 /* obsolete without socket */
286 if ((err =
287 memif_msg_send_disconnect (conn.fd, "unit_test_dc",
288 0)) != MEMIF_ERR_SUCCESS)
289 ck_assert_msg (err == MEMIF_ERR_BAD_FD, "err code: %u, err msg: %s", err,
290 memif_strerror (err));
291}
292
293END_TEST
294START_TEST (test_recv_hello)
295{
296 int err;
297 memif_connection_t conn;
298 memif_msg_t msg;
299
300 memif_msg_hello_t *h = &msg.hello;
301
302 msg.type = MEMIF_MSG_TYPE_HELLO;
303
304 h->min_version = MEMIF_VERSION;
305 h->max_version = MEMIF_VERSION;
306 h->max_s2m_ring = 1;
307 h->max_m2s_ring = 1;
308 h->max_log2_ring_size = 14;
309 strncpy ((char *) h->name, TEST_IF_NAME, strlen (TEST_IF_NAME));
310 memset (conn.remote_name, 0, sizeof (conn.remote_name));
311
312 conn.args.num_s2m_rings = 4;
313 conn.args.num_m2s_rings = 6;
314 conn.args.log2_ring_size = 10;
315
316 if ((err = memif_msg_receive_hello (&conn, &msg)) != MEMIF_ERR_SUCCESS)
317 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
318
319 ck_assert_uint_eq (conn.run_args.num_s2m_rings, 2);
320 ck_assert_uint_eq (conn.run_args.num_m2s_rings, 2);
321 ck_assert_uint_eq (conn.run_args.log2_ring_size, 10);
322 ck_assert_str_eq (conn.remote_name, TEST_IF_NAME);
323
324 h->max_version = 9;
325 if ((err = memif_msg_receive_hello (&conn, &msg)) != MEMIF_ERR_SUCCESS)
326 ck_assert_msg (err == MEMIF_ERR_PROTO,
327 "err code: %u, err msg: %s", err, memif_strerror (err));
328}
329
330END_TEST
331START_TEST (test_recv_init)
332{
333 int err;
334 memif_connection_t conn;
335
336 conn.args.interface_id = 69;
337 conn.args.is_master = 1;
338 conn.fd = -1;
339 conn.args.mode = 0;
340 memset (conn.args.secret, '\0', 24);
341 strncpy ((char *) conn.args.secret, TEST_SECRET, strlen (TEST_SECRET));
342
343 memif_msg_t msg;
344
345 memif_msg_init_t *i = &msg.init;
346
347 msg.type = MEMIF_MSG_TYPE_INIT;
348
349 i->version = MEMIF_VERSION;
350 i->id = 69;
351 i->mode = 0;
352 memset (i->name, '\0', 32);
353 memset (i->secret, '\0', 24);
354 strncpy ((char *) i->name, TEST_IF_NAME, strlen (TEST_IF_NAME));
355 strncpy ((char *) i->secret, TEST_SECRET, strlen (TEST_SECRET));
356
357 memif_socket_t ms;
358 ms.interface_list_len = 1;
359 ms.interface_list = malloc (sizeof (memif_list_elt_t));
360 memif_list_elt_t elt;
361 elt.key = 69;
362 elt.data_struct = &conn;
363 add_list_elt (&elt, &ms.interface_list, &ms.interface_list_len);
364
365 if ((err =
366 memif_init (control_fd_update, TEST_APP_NAME)) != MEMIF_ERR_SUCCESS)
367 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
368
369 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
370 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
371
372 i->version = 9;
373 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
374 ck_assert_msg (err == MEMIF_ERR_PROTO,
375 "err code: %u, err msg: %s", err, memif_strerror (err));
376 i->version = MEMIF_VERSION;
377
378 i->id = 78;
379 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
380 ck_assert_msg (err == MEMIF_ERR_ID,
381 "err code: %u, err msg: %s", err, memif_strerror (err));
382 i->id = 69;
383
384 i->mode = 1;
385 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
386 ck_assert_msg (err == MEMIF_ERR_MODE,
387 "err code: %u, err msg: %s", err, memif_strerror (err));
388 i->mode = 0;
389
390 i->secret[0] = '\0';
391 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
392 ck_assert_msg (err == MEMIF_ERR_SECRET,
393 "err code: %u, err msg: %s", err, memif_strerror (err));
394 strncpy ((char *) i->secret, TEST_SECRET, strlen (TEST_SECRET));
395
396 conn.args.is_master = 0;
397 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
398 ck_assert_msg (err == MEMIF_ERR_ACCSLAVE,
399 "err code: %u, err msg: %s", err, memif_strerror (err));
400 conn.args.is_master = 1;
401
402 conn.fd = 5;
403 if ((err = memif_msg_receive_init (&ms, -1, &msg)) != MEMIF_ERR_SUCCESS)
404 ck_assert_msg ((err == MEMIF_ERR_ALRCONN) || (err == MEMIF_ERR_BAD_FD),
405 "err code: %u, err msg: %s", err, memif_strerror (err));
406}
407
408END_TEST
409START_TEST (test_recv_add_region)
410{
411 int err;
412 memif_connection_t conn;
413 conn.regions = NULL;
414 memif_msg_t msg;
415 msg.type = MEMIF_MSG_TYPE_ADD_REGION;
416 msg.add_region.size = 2048;
417 msg.add_region.index = 0;
418
419 int fd = 5;
420
421 if ((err =
422 memif_msg_receive_add_region (&conn, &msg, fd)) != MEMIF_ERR_SUCCESS)
423 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
424
425 memif_region_t *mr = conn.regions;
426
427 ck_assert_uint_eq (mr->fd, fd);
428 ck_assert_uint_eq (mr->region_size, 2048);
429 ck_assert_ptr_eq (mr->shm, NULL);
430}
431
432END_TEST
433START_TEST (test_recv_add_ring)
434{
435 int err;
436 memif_connection_t conn;
437 int fd = 5;
438 memif_msg_t msg;
439 conn.args.num_s2m_rings = 2;
440 conn.args.num_m2s_rings = 2;
441 conn.rx_queues = NULL;
442 conn.tx_queues = NULL;
443
444 msg.type = MEMIF_MSG_TYPE_ADD_RING;
445 memif_msg_add_ring_t *ar = &msg.add_ring;
446
447 ar->log2_ring_size = 10;
448 ar->region = 0;
449 ar->offset = 0;
450 ar->flags = 0;
451 ar->flags |= MEMIF_MSG_ADD_RING_FLAG_S2M;
452 ar->index = 1;
453
454 if ((err =
455 memif_msg_receive_add_ring (&conn, &msg, fd)) != MEMIF_ERR_SUCCESS)
456 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
457
458
459 ar->offset = 2048;
460 ar->flags &= ~MEMIF_MSG_ADD_RING_FLAG_S2M;
461
462 if ((err =
463 memif_msg_receive_add_ring (&conn, &msg, fd)) != MEMIF_ERR_SUCCESS)
464 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
465
466}
467
468END_TEST
469START_TEST (test_recv_connect)
470{
471 int err;
472 memif_conn_handle_t c = NULL;
473 memif_conn_args_t args;
474 memset (&args, 0, sizeof (args));
475
476 args.interface_id = 0;
477 args.is_master = 0;
478 args.mode = 0;
479
480 if ((err =
481 memif_init (control_fd_update, TEST_APP_NAME)) != MEMIF_ERR_SUCCESS)
482 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
483
484 if ((err = memif_create (&c, &args, on_connect,
485 on_disconnect, on_interrupt,
486 NULL)) != MEMIF_ERR_SUCCESS)
487 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
488
489 memif_connection_t *conn = (memif_connection_t *) c;
490
491 conn->run_args.num_s2m_rings = 1;
492 conn->run_args.num_m2s_rings = 1;
493 conn->run_args.log2_ring_size = 10;
494 conn->run_args.buffer_size = 2048;
495
496 if ((err = memif_init_regions_and_queues (conn)) != MEMIF_ERR_SUCCESS)
497 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
498
499 memif_msg_t msg;
500 memset (&msg, 0, sizeof (msg));
501 msg.type = MEMIF_MSG_TYPE_CONNECT;
502
503 memset (msg.connect.if_name, 0, sizeof (msg.connect.if_name));
504 strncpy ((char *) msg.connect.if_name, TEST_IF_NAME, strlen (TEST_IF_NAME));
505
506 if ((err = memif_msg_receive_connect (conn, &msg)) != MEMIF_ERR_SUCCESS)
507 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
508
509 ck_assert_str_eq (conn->remote_if_name, TEST_IF_NAME);
510}
511
512END_TEST
513START_TEST (test_recv_connected)
514{
515 int err;
516 memif_conn_handle_t c = NULL;
517 memif_conn_args_t args;
518 memset (&args, 0, sizeof (args));
519
520 args.interface_id = 0;
521 args.is_master = 0;
522 args.mode = 0;
523
524 if ((err =
525 memif_init (control_fd_update, TEST_APP_NAME)) != MEMIF_ERR_SUCCESS)
526 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
527
528 if ((err = memif_create (&c, &args, on_connect,
529 on_disconnect, on_interrupt,
530 NULL)) != MEMIF_ERR_SUCCESS)
531 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
532
533 memif_connection_t *conn = (memif_connection_t *) c;
534
535 conn->run_args.num_s2m_rings = 1;
536 conn->run_args.num_m2s_rings = 1;
537 conn->run_args.log2_ring_size = 10;
538 conn->run_args.buffer_size = 2048;
539
540 if ((err = memif_init_regions_and_queues (conn)) != MEMIF_ERR_SUCCESS)
541 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
542
543 memif_msg_t msg;
544 memset (&msg, 0, sizeof (msg));
545 msg.type = MEMIF_MSG_TYPE_CONNECT;
546
547 memset (msg.connect.if_name, 0, sizeof (msg.connect.if_name));
548 strncpy ((char *) msg.connect.if_name, TEST_IF_NAME, strlen (TEST_IF_NAME));
549
550 if ((err = memif_msg_receive_connected (conn, &msg)) != MEMIF_ERR_SUCCESS)
551 ck_abort_msg ("err code: %u, err msg: %s", err, memif_strerror (err));
552
553 ck_assert_str_eq (conn->remote_if_name, TEST_IF_NAME);
554}
555
556END_TEST
557START_TEST (test_recv_disconnect)
558{
559 int err;
560 memif_connection_t conn;
561 memif_msg_t msg;
562 msg.type = MEMIF_MSG_TYPE_DISCONNECT;
563 memset (msg.disconnect.string, 0, sizeof (msg.disconnect.string));
564 strncpy ((char *) msg.disconnect.string, "unit_test_dc", 12);
565
566 if ((err = memif_msg_receive_disconnect (&conn, &msg)) != MEMIF_ERR_SUCCESS)
567 ck_assert_msg (err == MEMIF_ERR_DISCONNECT,
568 "err code: %u, err msg: %s", err, memif_strerror (err));
569
570 ck_assert_str_eq (conn.remote_disconnect_string, "unit_test_dc");
571}
572
573END_TEST Suite * socket_suite ()
574{
575 Suite *s;
576 TCase *tc_msg_queue;
577 TCase *tc_msg_enq;
578 TCase *tc_msg_send;
579 TCase *tc_msg_recv;
580
581 /* create socket test suite */
582 s = suite_create ("Socket messaging");
583
584 /* create msg queue test case */
585 tc_msg_queue = tcase_create ("Message queue");
586 /* add tests to test case */
587 tcase_add_test (tc_msg_queue, test_msg_queue);
588
589 /* create msg enq test case */
590 tc_msg_enq = tcase_create ("Message enqueue");
591 /* add tests to test case */
592 tcase_add_test (tc_msg_enq, test_enq_ack);
593 tcase_add_test (tc_msg_enq, test_enq_init);
594 tcase_add_test (tc_msg_enq, test_enq_add_region);
595 tcase_add_test (tc_msg_enq, test_enq_add_ring);
596 tcase_add_test (tc_msg_enq, test_enq_connect);
597 tcase_add_test (tc_msg_enq, test_enq_connected);
598
599 /* create msg send test case */
600 tc_msg_send = tcase_create ("Message send");
601 /* add tests to test case */
602 tcase_add_test (tc_msg_send, test_send);
603 tcase_add_test (tc_msg_send, test_send_hello);
604 tcase_add_test (tc_msg_send, test_send_disconnect);
605
606 /* create msg recv test case */
607 tc_msg_recv = tcase_create ("Message receive");
608 /* add tests to test case */
609 tcase_add_test (tc_msg_recv, test_recv_hello);
610 tcase_add_test (tc_msg_recv, test_recv_init);
611 tcase_add_test (tc_msg_recv, test_recv_add_region);
612 tcase_add_test (tc_msg_recv, test_recv_add_ring);
613 tcase_add_test (tc_msg_recv, test_recv_connect);
614 tcase_add_test (tc_msg_recv, test_recv_connected);
615 tcase_add_test (tc_msg_recv, test_recv_disconnect);
616
617 /* add test cases to test suite */
618 suite_add_tcase (s, tc_msg_queue);
619 suite_add_tcase (s, tc_msg_enq);
620 suite_add_tcase (s, tc_msg_send);
621 suite_add_tcase (s, tc_msg_recv);
622
623 /* return socket test suite to test runner */
624 return s;
625}