blob: aa1b6ab754f496316d6d208497feedab9297fda3 [file] [log] [blame]
E. Scott Danielsfc5c77b2020-02-21 13:24:29 -05001// :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_test.c
23 Abstract: This tests the whole RMR SI95 implementation. This driver
24 includes all of the module specific unit test static files
25 (e.g. wormhole_static_test.c) and drives the tests contained
26 there. The individual modules allow them to be driven by
27 a standalone driver, and to be maintained separately. We must
28 test by inclusion because of the static nature of the internal
29 functions of the library.
30
31 Author: E. Scott Daniels
32 Date: 18 January 2018 (IMO HRTL)
33*/
34
35#include <stdio.h>
36#include <stdlib.h>
37#include <netdb.h>
38#include <errno.h>
39#include <string.h>
40#include <errno.h>
41#include <pthread.h>
42#include <ctype.h>
43
44
45#include <unistd.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <strings.h>
49#include <errno.h>
50#include <string.h>
51#include <stdint.h>
52#include <ctype.h>
53#include <sys/epoll.h>
54#include <pthread.h>
55#include <semaphore.h>
56
57#define DEBUG 1
E. Scott Danielsc113b082020-04-08 15:44:40 -040058#define PARANOID_CHECKS 1 // must have parinoid testing on to not fail on nil pointer tests
E. Scott Danielsfc5c77b2020-02-21 13:24:29 -050059
60 // specific test tools in this directory
61#undef NNG_UNDER_TEST
62#include "test_support.c" // things like fail_if()
63#include "test_ctx_support.c" // dummy context support
64#include "test_gen_rt.c"
65
66
67#include "rmr.h" // things the users see
68#include "rmr_symtab.h"
69#include "rmr_logging.h"
70#include "rmr_agnostic.h" // transport agnostic header
71
72#include "symtab.c"
73#include "logging.c"
74#include "rmr_si.c"
75#include "mbuf_api.c"
76
E. Scott Danielsc113b082020-04-08 15:44:40 -040077
E. Scott Danielsfc5c77b2020-02-21 13:24:29 -050078static void gen_rt( uta_ctx_t* ctx ); // defined in sr_si_static_test, but used by a few others (eliminate order requirement below)
79
80 // and finally....
81#include "tools_static_test.c" // local test functions pulled directly because of static nature of things
82#include "symtab_static_test.c"
83#include "ring_static_test.c"
84#include "rt_static_test.c"
85#include "wormhole_static_test.c"
86#include "mbuf_api_static_test.c"
87#include "sr_si_static_test.c"
E. Scott Danielsc113b082020-04-08 15:44:40 -040088#include "lg_buf_static_test.c"
E. Scott Danielsfc5c77b2020-02-21 13:24:29 -050089
90#include "rmr_si_api_static_test.c"
91
92
93/*
94 Drive each of the separate tests and report.
95*/
96int main() {
97 int errors = 0;
98
99 rmr_set_vlevel( 5 ); // enable all debugging
100
E. Scott Danielsc113b082020-04-08 15:44:40 -0400101 fprintf( stderr, "\n<INFO> starting lg buffer tests (%d)\n", errors );
102 errors += rmr_lgbuf_test();
103 fprintf( stderr, "<INFO> error count: %d\n", errors );
104
E. Scott Danielsfc5c77b2020-02-21 13:24:29 -0500105 fprintf( stderr, "\n<INFO> starting ring tests (%d)\n", errors );
106 errors += ring_test();
107 fprintf( stderr, "<INFO> error count: %d\n", errors );
108
109 fprintf( stderr, "\n<INFO> starting symtab tests\n" );
110 errors += symtab_test( );
111 fprintf( stderr, "<INFO> error count: %d\n", errors );
112
113 fprintf( stderr, "\n<INFO> starting rtable tests\n" );
114 errors += rt_test(); // route table tests
115 fprintf( stderr, "<INFO> error count: %d\n", errors );
116
117 fprintf( stderr, "\n<INFO> starting wormhole tests\n" );
118 errors += worm_test(); // test wormhole funcitons
119 fprintf( stderr, "<INFO> error count: %d\n", errors );
120
121 fprintf( stderr, "\n<INFO> starting tool tests\n" );
122 errors += tools_test();
123 fprintf( stderr, "<INFO> error count: %d\n", errors );
124
125 fprintf( stderr, "\n<INFO> starting mbuf api tests\n" );
126 errors += mbuf_api_test( );
127 fprintf( stderr, "<INFO> error count: %d\n", errors );
128
129 fprintf( stderr, "\n<INFO> starting send/receive tests\n" );
130 errors += sr_si_test(); // test the send/receive static functions
131 fprintf( stderr, "<INFO> error count: %d\n", errors );
132
133
134 fprintf( stderr, "\n<INFO> starting RMr API tests\n" );
135 errors += rmr_api_test();
136
137/// ---- all ok above here
138/*
139 fprintf( stderr, "\n<INFO> run RMr API tests with src name only env var set\n" );
140 setenv( "RMR_SRC_NAMEONLY", "1", 1 );
141 errors += rmr_api_test();
142 fprintf( stderr, "<INFO> error count: %d\n", errors );
143*/
144
145 if( errors == 0 ) {
146 fprintf( stderr, "<PASS> all tests were OK\n\n" );
147 } else {
148 fprintf( stderr, "<FAIL> %d modules reported errors\n\n", errors );
149 }
150
151 return !!errors;
152}