CI: Add silent cmake SonarCloud scan
[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_msg_support.c"
61 #include "test_gen_rt.c"
62
63
64 #include "rmr.h"                                        // things the users see
65 #include "rmr_symtab.h"
66 #include "rmr_logging.h"
67 #include "rmr_agnostic.h"                       // transport agnostic header
68
69 #include "symtab.c"
70 #include "logging.c"
71 #include "rmr_si.c"
72 #include "mbuf_api.c"
73
74 #include "test_ctx_support.c"                           // dummy context support (needs rmr headers)
75
76
77 static void gen_rt( uta_ctx_t* ctx );           // defined in sr_si_static_test, but used by a few others (eliminate order requirement below)
78
79                                                                                         // and finally....
80 #include "rmr_si_rcv_static_test.c"                     // the only test driver
81
82
83 /*
84         Drive each of the separate tests and report.
85 */
86 int main() {
87         int errors = 0;
88
89         rmr_set_vlevel( 5 );                    // enable all debugging
90
91         fprintf( stderr, "\n<INFO> starting receive tests (%d)\n", errors );
92         errors += rmr_rcv_test();
93         fprintf( stderr, "<INFO> error count: %d\n", errors );
94
95         test_summary( errors, "receive tests" );
96         if( errors == 0 ) {
97                 fprintf( stderr, "<PASS> all tests were OK\n\n" );
98         } else {
99                 fprintf( stderr, "<FAIL> %d modules reported errors\n\n", errors );
100         }
101
102         return !!errors;
103 }