1 // vim: ts=4 sw=4 noet:
3 --------------------------------------------------------------------------------
4 Copyright (c) 2018-2019 AT&T Intellectual Property.
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 --------------------------------------------------------------------------------
22 Abstract: Basic unit tests for the mc listener.
24 Author: E. Scott Daniels
27 // this/these are what we are testing; include them directly
31 Parms: [fifo-dir-name]
33 int main( int argc, char** argv ) {
36 char* dname = "/tmp/fifos";
45 ctx = mcl_mk_context( dname );
47 fprintf( stderr, "[FAIL] couldn't make context" );
51 mcl_set_sigh(); // prevent colobber from broken pipe
53 fd = suss_fifo( ctx, 101, 1 ); // should open the file for writing and return the fdes
55 fprintf( stderr, "[FAIL] suss_fifo did not return a valid fd\n" );
59 fd2= suss_fifo( ctx, 101, 0 ); // should open the file file for reading and return a different fd
61 fprintf( stderr, "[FAIL] suss_fifo did not return a valid fd\n" );
65 fprintf( stderr, "[FAIL] reading and writing fifo file descriptors expected to differ; both were %d\n", fd );
69 mcl_start_listening( ctx, port, 0 ); // start the listener, no waiting for rt since we don't send
72 fprintf( stderr, "[PASS] all tests look peachy\n" );