blob: 50c42666c073f9a68f7a7fc2e215761cd002e1c9 [file] [log] [blame]
E. Scott Daniels5efb1e62019-05-02 17:09:35 +00001// :vi sw=4 ts=4 noet:
2/*
3==================================================================================
4 Copyright (c) 2019 Nokia
5 Copyright (c) 2018-2019 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_nano_test.c
23 Abstract: This tests the whole rmr nanomsg 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 This test only needs to drive the soruce in nanomsg/src. The
32 common library functions are driven by the nng tests.
33
34 Author: E. Scott Daniels
35 Date: 18 January 2018 (IMO HRTL)
36*/
37
38#include <stdio.h>
39#include <stdlib.h>
40#include <netdb.h>
41#include <errno.h>
42#include <string.h>
43#include <errno.h>
44#include <pthread.h>
45#include <ctype.h>
46
47
48#include <unistd.h>
49#include <stdio.h>
50#include <stdlib.h>
51#include <strings.h>
52#include <errno.h>
53#include <string.h>
54#include <stdint.h>
55#include <ctype.h>
56#include <sys/epoll.h>
57
58#define DEBUG 1
59
60#include <nanomsg/nn.h>
61//#include <nng/protocol/pubsub0/pub.h>
62//#include <nng/protocol/pubsub0/sub.h>
63//#include <nng/protocol/pipeline0/push.h>
64//#include <nng/protocol/pipeline0/pull.h>
65
66#undef EMULATE_NNG
67#include "test_nng_em.c" // nng/nn emulation (before including things under test)
68
69
70#include "../src/common/include/rmr.h" // things the users see
71#include "../src/common/include/rmr_symtab.h"
72#include "../src/common/include/rmr_agnostic.h" // transport agnostic header
73#include "../src/nanomsg/include/rmr_private.h" // transport specific
74
75#include "../src/common/src/symtab.c"
76#include "../src/nanomsg/src/rmr.c"
77#include "../src/common/src/mbuf_api.c"
78#include "../src/nanomsg/src/rtable_static.c"
79
80static void gen_rt( uta_ctx_t* ctx ); // defined in sr_static_test, but used by a few others (eliminate order requirement below)
81
82 // specific test tools in this directory
83#include "test_support.c" // things like fail_if()
84 // and finally....
85//#include "tools_static_test.c" // local test functions pulled directly because of static nature of things
86//#include "symtab_static_test.c"
87//#include "ring_static_test.c"
88//#include "rt_static_test.c"
89//#include "wormhole_static_test.c"
90#include "mbuf_api_static_test.c"
91
92#include "sr_nano_static_test.c"
93#include "rmr_nng_api_static_test.c" // this can be used for both nng and nano
94#include "rt_nano_static_test.c" // this can be used for both
95
96
97/*
98 Drive each of the separate tests and report.
99*/
100int main() {
101 int errors = 0;
102
103 fprintf( stderr, "<INFO> starting RMr Nanomsg based API tests\n" );
104 errors += rmr_api_test();
105 fprintf( stderr, "<INFO> error count: %d\n", errors );
106
107 fprintf( stderr, "<INFO> starting mbuf related tests\n" );
108 errors += mbuf_api_test( );
109 fprintf( stderr, "<INFO> error count: %d\n", errors );
110
111 fprintf( stderr, "<INFO> starting send/receive tests\n" );
112 errors += sr_nano_test(); // test the send/receive static functions
113 fprintf( stderr, "<INFO> error count: %d\n", errors );
114
115 fprintf( stderr, "<INFO> starting rt_static tests\n" );
116 errors += rt_test(); // route table things specific to nano
117 fprintf( stderr, "<INFO> error count: %d\n", errors );
118
119 if( errors == 0 ) {
120 fprintf( stderr, "<PASS> all tests were OK\n" );
121 } else {
122 fprintf( stderr, "<FAIL> %d modules reported errors\n", errors );
123 }
124
125 return !!errors;
126}