X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fsidecars%2Flistener%2Funit_test.c;fp=src%2Fsidecars%2Flistener%2Funit_test.c;h=0000000000000000000000000000000000000000;hb=fe2bd3618e4748333078f91c26a8a3f5dcf184c4;hp=79bc43fd409c3990f1ce2db5bb8f3903d4171758;hpb=53a0c6d44d66556623c6aee61eb7b6de9c4fd41b;p=ric-app%2Fmc.git diff --git a/src/sidecars/listener/unit_test.c b/src/sidecars/listener/unit_test.c deleted file mode 100644 index 79bc43f..0000000 --- a/src/sidecars/listener/unit_test.c +++ /dev/null @@ -1,77 +0,0 @@ -// vim: ts=4 sw=4 noet: -/* - -------------------------------------------------------------------------------- - Copyright (c) 2018-2019 AT&T Intellectual Property. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -------------------------------------------------------------------------------- -*/ - -/* - Mnemonic: unit_test.c - Abstract: Basic unit tests for the mc listener. - Date: 22 August 2019 - Author: E. Scott Daniels -*/ - -// this/these are what we are testing; include them directly -#include "mcl.c" - -/* - Parms: [fifo-dir-name] -*/ -int main( int argc, char** argv ) { - void* ctx; - int errors; - char* dname = "/tmp/fifos"; - char* port = "4560"; - int fd; - int fd2; - - if( argc > 1 ) { - dname = argv[1]; - } - - ctx = mcl_mk_context( dname ); - if( ctx == NULL ) { - fprintf( stderr, "[FAIL] couldn't make context" ); - exit( 1 ); - } - - mcl_set_sigh(); // prevent colobber from broken pipe - - fd = suss_fifo( ctx, 101, 1 ); // should open the file for writing and return the fdes - if( fd < 0 ) { - fprintf( stderr, "[FAIL] suss_fifo did not return a valid fd\n" ); - errors++; - } - - fd2= suss_fifo( ctx, 101, 0 ); // should open the file file for reading and return a different fd - if( fd < 0 ) { - fprintf( stderr, "[FAIL] suss_fifo did not return a valid fd\n" ); - errors++; - } - if( fd == fd2 ) { - fprintf( stderr, "[FAIL] reading and writing fifo file descriptors expected to differ; both were %d\n", fd ); - errors++; - } - - mcl_start_listening( ctx, port, 0 ); // start the listener, no waiting for rt since we don't send - - if( ! errors ) { - fprintf( stderr, "[PASS] all tests look peachy\n" ); - } - - return errors != 0; -} -