New API added for debugging rmr rx queue
[ric-plt/lib/rmr.git] / test / rmr_nng_api_static_test.c
index f08c2f1..b7cc5eb 100644 (file)
@@ -1,8 +1,8 @@
 // : vi ts=4 sw=4 noet :
 /*
 ==================================================================================
-           Copyright (c) 2019 Nokia
-           Copyright (c) 2018-2019 AT&T Intellectual Property.
+           Copyright (c) 2019-2021 Nokia
+           Copyright (c) 2018-2021 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.
@@ -274,6 +274,8 @@ static int rmr_api_test( ) {
        snprintf( msg->xaction, 17, "%015d", 16 );              // dummy transaction id (emulation generates, this should arrive after a few calls to recv)
        msg->mtype = 0;
        msg->sub_id = -1;
+       em_set_rcvcount( 0 );                                                   // reset message counter
+       em_set_rcvdelay( 1 );                                                   // force slow msg rate during mt testing
        msg = rmr_call( rmc, msg );                                             // dummy nng/nano function will sequentually add xactions and should match or '16'
        errors += fail_if_nil( msg, "rmr_call returned a nil message on call expected to succeed "  );
        if( msg ) {
@@ -444,15 +446,15 @@ static int rmr_api_test( ) {
                errors += fail_if_nil( msg, "mt_call with known xaction id returned nil message" );
        }
        fprintf( stderr, "<INFO> time check: %ld\n", time( NULL ) );
-               
 
        em_set_mtc_msgs( 0 );                                                   // turn off 
-       em_set_rcvdelay( 0 );                                                   // full speed receive rate
-       ((uta_ctx_t *)rmc)->shutdown = 1;                               // force the mt-reciver attached to the context to stop
+       em_set_rcvdelay( 0 );                                                   // full speed receive rate to overflow the ring
 
-       em_set_rcvdelay( 0 );                                                   // let the receive loop spin w/o receives so we drive warning code about queue full
-       sleep( 5 );
+       fprintf( stderr, "<INFO> pausing 5s to allow mt-call receive ring to fill  %ld\n", time( NULL ) );
+       sleep( 2 );
+       fprintf( stderr, "<INFO> tests continuing %ld\n", time( NULL ) );
        em_set_rcvdelay( 1 );                                                   // restore slow receive pace for any later tests
+       ((uta_ctx_t *)rmc)->shutdown = 1;                               // force the mt-reciver attached to the context to stop
 #endif
 
 
@@ -461,5 +463,5 @@ static int rmr_api_test( ) {
        if( ! errors ) {
                fprintf( stderr, "<INFO> all RMr API tests pass\n" );
        }
-       return !!errors;
+       return errors;
 }