fdd1f33739e2449e7cc02909e814f524711ab65a
[ric-plt/lib/rmr.git] / test / rmr_si_rcv_test.c
1 // :vi sw=4 ts=4 noet:
2 /*
3 ==================================================================================
4         Copyright (c) 2020 Nokia
5         Copyright (c) 2020 AT&T Intellectual Property.
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11            http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18 ==================================================================================
19 */
20
21 /*
22         Mmemonic:       rmr_si_rcv_test.c
23         Abstract:       This drives only the receive tests for the SI API. Because
24                                 of the threaded nature of SI receives it is not possible to
25                                 mix these tests with the other coverage tests which allocate
26                                 various contexes.
27
28         Author:         E. Scott Daniels
29         Date:           14 April 2020           (AKD)
30 */
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <netdb.h>
35 #include <errno.h>
36 #include <string.h>
37 #include <errno.h>
38 #include <pthread.h>
39 #include <ctype.h>
40
41
42 #include <unistd.h>
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <strings.h>
46 #include <errno.h>
47 #include <string.h>
48 #include <stdint.h>
49 #include <ctype.h>
50 #include <sys/epoll.h>
51 #include <pthread.h>
52 #include <semaphore.h>
53
54 #define DEBUG 1
55 #define PARANOID_CHECKS 1                                       // must have parinoid testing on to not fail on nil pointer tests
56
57                                                                                         // specific test tools in this directory
58 #undef NNG_UNDER_TEST 
59 #include "test_support.c"                                       // things like fail_if()
60 #include "test_ctx_support.c"                           // dummy context support
61 #include "test_msg_support.c"
62 #include "test_gen_rt.c"
63
64
65 #include "rmr.h"                                        // things the users see
66 #include "rmr_symtab.h"
67 #include "rmr_logging.h"
68 #include "rmr_agnostic.h"                       // transport agnostic header
69
70 #include "symtab.c"
71 #include "logging.c"
72 #include "rmr_si.c"
73 #include "mbuf_api.c"
74
75
76 static void gen_rt( uta_ctx_t* ctx );           // defined in sr_si_static_test, but used by a few others (eliminate order requirement below)
77
78                                                                                         // and finally....
79 #include "rmr_si_rcv_static_test.c"                     // the only test driver
80
81
82 /*
83         Drive each of the separate tests and report.
84 */
85 int main() {
86         int errors = 0;
87
88         rmr_set_vlevel( 5 );                    // enable all debugging
89
90         fprintf( stderr, "\n<INFO> starting receive tests (%d)\n", errors );
91         errors += rmr_rcv_test();
92         fprintf( stderr, "<INFO> error count: %d\n", errors );
93
94         if( errors == 0 ) {
95                 fprintf( stderr, "<PASS> all tests were OK\n\n" );
96         } else {
97                 fprintf( stderr, "<FAIL> %d modules reported errors\n\n", errors );
98         }
99
100         return !!errors;
101 }