Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 1 | // : vi ts=4 sw=4 noet : |
| 2 | /* |
| 3 | ================================================================================== |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 4 | Copyright (c) 2019 Nokia |
| 5 | Copyright (c) 2018-2019 AT&T Intellectual Property. |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 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 | |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 11 | http://www.apache.org/licenses/LICENSE-2.0 |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 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 | /* |
E. Scott Daniels | fc5c77b | 2020-02-21 13:24:29 -0500 | [diff] [blame] | 23 | Mnemonic: tools_test.c |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 24 | Abstract: Unit tests for the RMr tools module. |
| 25 | Author: E. Scott Daniels |
| 26 | Date: 21 January 2019 |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #include <stdio.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <netdb.h> |
| 33 | #include <errno.h> |
| 34 | #include <string.h> |
| 35 | #include <errno.h> |
| 36 | #include <pthread.h> |
| 37 | #include <ctype.h> |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 38 | #include <pthread.h> |
| 39 | #include <semaphore.h> |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 40 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 41 | #include "rmr.h" |
E. Scott Daniels | 0d4def6 | 2020-01-28 16:50:27 -0500 | [diff] [blame] | 42 | #include "rmr_logging.h" |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 43 | #include "rmr_agnostic.h" |
E. Scott Daniels | fc5c77b | 2020-02-21 13:24:29 -0500 | [diff] [blame] | 44 | |
| 45 | #define NO_EMULATION |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 46 | #include "test_support.c" // our private library of test tools |
| 47 | |
E. Scott Daniels | 316614a | 2020-08-04 13:48:47 -0400 | [diff] [blame] | 48 | #include "logging.c" // tools references logging, so pull in too |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 49 | #include "tools_static.c" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 50 | |
E. Scott Daniels | 68d09fa | 2019-06-03 19:45:12 +0000 | [diff] [blame] | 51 | #include "tools_static_test.c" |
E. Scott Daniels | 8c6756d | 2021-04-19 15:13:51 -0400 | [diff] [blame] | 52 | #include "wrapper_static_test.c" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 53 | |
| 54 | int main( ) { |
E. Scott Daniels | 77526eb | 2020-09-17 16:39:31 -0400 | [diff] [blame] | 55 | int errors = 0; |
| 56 | |
E. Scott Daniels | 8c6756d | 2021-04-19 15:13:51 -0400 | [diff] [blame] | 57 | fprintf( stderr, "<INFO> starting tools_test\n" ); |
E. Scott Daniels | 77526eb | 2020-09-17 16:39:31 -0400 | [diff] [blame] | 58 | errors += tools_test() > 0; |
| 59 | |
E. Scott Daniels | 8c6756d | 2021-04-19 15:13:51 -0400 | [diff] [blame] | 60 | fprintf( stderr, "<INFO> testing wrapper\n" ); |
| 61 | errors += wrapper_test(); |
| 62 | |
E. Scott Daniels | 77526eb | 2020-09-17 16:39:31 -0400 | [diff] [blame] | 63 | test_summary( errors, "tool tests" ); |
| 64 | if( errors == 0 ) { |
| 65 | fprintf( stderr, "<PASS> all tool tests were OK\n\n" ); |
| 66 | } else { |
| 67 | fprintf( stderr, "<FAIL> %d errors in tool code\n\n", errors ); |
| 68 | } |
| 69 | |
| 70 | return !!errors; |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 71 | } |
E. Scott Daniels | 68d09fa | 2019-06-03 19:45:12 +0000 | [diff] [blame] | 72 | |