3 ==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
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
11 http://www.apache.org/licenses/LICENSE-2.0
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 ==================================================================================
23 Abstract: This is the main driver to test the si95 core functions
24 (within rmr/src/si/src/si95).
26 Author: E. Scott Daniels
48 #include <sys/epoll.h>
50 #include <semaphore.h>
54 // specific test tools in this directory
55 #undef NNG_UNDER_TEST // NNG is NOT under test so undefine if set
56 #define NO_EMULATION 1 // no emulation of transport functions
57 #define NO_PRIVATE_HEADERS 1 // no rmr_si or rmr_nng headers
58 #define NO_DUMMY_RMR 1 // no msg things
59 #include "test_support.c" // things like fail_if()
63 #include "rmr.h" // things the users see
64 #include "rmr_symtab.h"
65 #include "rmr_agnostic.h" // transport agnostic header
67 #include <rmr_logging.h>
70 //#include <si95/siaddress.c>
71 //#include <si95/sialloc.c>
72 //#include <si95/sibldpoll.c>
73 //#include <si95/sicbreg.c>
74 //#include <si95/sicbstat.c>
75 //#include <si95/siclose.c>
76 //#include <si95/siconnect.c>
77 //#include <si95/siestablish.c>
78 //#include <si95/sigetadd.c>
79 //#include <si95/sigetname.c>
80 #include <si95/siinit.c>
81 //#include <si95/silisten.c>
82 #include <si95/sinew.c>
83 //#include <si95/sinewses.c>
84 //#include <si95/sipoll.c>
85 //#include <si95/sircv.c>
86 //#include <si95/sisend.c>
87 //#include <si95/sisendt.c>
88 #include <si95/sishutdown.c>
89 #include <si95/siterm.c>
90 #include <si95/sitrash.c>
91 //#include <si95/siwait.c>
95 Memory allocation/free related tests
97 static int memory( ) {
102 // ---- SInew ----------------
103 ptr = SInew( 100 ); // invalid block type should return nil
104 errors += fail_not_nil( ptr, "memory: sinew did not return nil when given a valid struct type" );
105 SItrash( 100, NULL ); // drive trash for coverage
107 iptr = SInew( IOQ_BLK );
108 errors += fail_if_nil( iptr, "memory: sinew returned nil when given ioq request" );
109 iptr = SInew( IOQ_BLK );
110 SItrash( IOQ_BLK, iptr );
112 ptr = SInew( TP_BLK );
113 errors += fail_if_nil( ptr, "memory: sinew returned nil when given tpblk request" );
115 ((struct tp_blk *)ptr)->squeue = iptr;
116 SItrash( TP_BLK, ptr );
119 ptr = SInew( GI_BLK );
120 errors += fail_if_nil( ptr, "memory: sinew returned nil when given giblk request" );
121 SItrash( GI_BLK, ptr );
127 void* si_ctx = NULL; // a global context might be useful
130 Test initialisation related things
135 si_ctx = SIinitialise( 0 );
136 errors += fail_if_nil( si_ctx, "init: siinit returned a nil pointer" );
138 SIclr_tflags( si_ctx, 0x00 ); // drive for coverage; no return value from these
139 SIset_tflags( si_ctx, 0x03 );
150 rmr_set_vlevel( 5 ); // enable all debugging
152 fprintf( stderr, "\n<INFO> starting SI95 tests\n" );
158 fprintf( stderr, "<PASS> all tests were OK\n\n" );
160 fprintf( stderr, "<FAIL> %d errors in SI95 core code\n\n", errors );