X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fring_static_test.c;h=b194928d0b3b90e21fba02037e4e70ed9ba7ff63;hb=40e32867174c51c9b0ea50dfea19130c468cc200;hp=e0c9b6e6ca0dfd75bd267fb77c9771a311254d82;hpb=8790bf0c4f4f08fd05853afa67e211112b344a42;p=ric-plt%2Flib%2Frmr.git diff --git a/test/ring_static_test.c b/test/ring_static_test.c index e0c9b6e..b194928 100644 --- a/test/ring_static_test.c +++ b/test/ring_static_test.c @@ -34,10 +34,11 @@ #include #include #include +#include +#include -#include "../src/common/include/rmr.h" -#include "../src/common/include/rmr_agnostic.h" -//#include "../src/common/src/ring_static.c" +#include "rmr.h" +#include "rmr_agnostic.h" /* @@ -77,6 +78,8 @@ static int ring_test( ) { int data[20]; int* dp; int size = 18; + int pfd = -1; // pollable file descriptor for the ring + int errors = 0; r = uta_mk_ring( 0 ); // should return nil if( r != NULL ) { @@ -95,6 +98,19 @@ static int ring_test( ) { return 1; } + pfd = uta_ring_getpfd( r ); // get pollable file descriptor + if( pfd < 0 ) { + fprintf( stderr, " expected a pollable file descriptor >= 0, but got: %d\n", pfd ); + errors++; + } + + pfd = uta_ring_config( r, 0x03 ); // turn on locking for reads and writes + if( pfd != 1 ) { + fprintf( stderr, " config attempt to enable locking failed\n" ); + errors++; + } + + for( i = 0; i < 20; i++ ) { // test to ensure it reports full when head/tail start at 0 data[i] = i; if( ! uta_ring_insert( r, &data[i] ) ) { @@ -160,5 +176,5 @@ static int ring_test( ) { } fprintf( stderr, " all ring tests pass\n" ); - return 0; + return errors; }