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
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Abstract: Specific tests related to the API functions in rmr_nng.c/rmr.c.
This should be included by a driver, but only the main RMr
driver and there likely not be a specific stand alone driver
Abstract: Specific tests related to the API functions in rmr_nng.c/rmr.c.
This should be included by a driver, but only the main RMr
driver and there likely not be a specific stand alone driver
library needed to test at this level.
The message buffer specific API tests are in a different static
library needed to test at this level.
The message buffer specific API tests are in a different static
v = rmr_get_rcvfd( NULL );
errors += fail_if( v >= 0, "rmr_get_rcvfd returned a valid file descriptor when given nil context" );
v = rmr_get_rcvfd( rmc );
v = rmr_get_rcvfd( NULL );
errors += fail_if( v >= 0, "rmr_get_rcvfd returned a valid file descriptor when given nil context" );
v = rmr_get_rcvfd( rmc );
msg2 = rmr_send_msg( NULL, NULL ); // drive for coverage
errors += fail_not_nil( msg2, "send_msg returned msg pointer when given a nil message and context" );
msg2 = rmr_send_msg( NULL, NULL ); // drive for coverage
errors += fail_not_nil( msg2, "send_msg returned msg pointer when given a nil message and context" );
rmr_rts_msg( rmc, NULL );
errors += fail_if( errno == 0, "rmr_rts_msg did not set errno when given a nil message" );
rmr_rts_msg( rmc, NULL );
errors += fail_if( errno == 0, "rmr_rts_msg did not set errno when given a nil message" );
msg = rmr_rts_msg( rmc, msg ); // return the buffer to the sender
errors += fail_if_nil( msg, "rmr_rts_msg did not return a message pointer" );
errors += fail_if( errno != 0, "rmr_rts_msg did not reset errno" );
snprintf( msg->xaction, 17, "%015d", 16 ); // dummy transaction id (emulation generates, this should arrive after a few calls to recv)
msg = rmr_rts_msg( rmc, msg ); // return the buffer to the sender
errors += fail_if_nil( msg, "rmr_rts_msg did not return a message pointer" );
errors += fail_if( errno != 0, "rmr_rts_msg did not reset errno" );
snprintf( msg->xaction, 17, "%015d", 16 ); // dummy transaction id (emulation generates, this should arrive after a few calls to recv)
msg = rmr_call( rmc, msg ); // this call should return a message as we can anticipate a dummy message in
errors += fail_if_nil( msg, "rmr_call returned a nil message on call expected to succeed" );
if( msg ) {
errors += fail_not_equal( msg->state, RMR_OK, "rmr_call did not properly set state on successful return" );
msg = rmr_call( rmc, msg ); // this call should return a message as we can anticipate a dummy message in
errors += fail_if_nil( msg, "rmr_call returned a nil message on call expected to succeed" );
if( msg ) {
errors += fail_not_equal( msg->state, RMR_OK, "rmr_call did not properly set state on successful return" );
}
snprintf( wbuf, 17, "%015d", 14 ); // if we call receive we should find this in the first 15 tries
}
snprintf( wbuf, 17, "%015d", 14 ); // if we call receive we should find this in the first 15 tries
+ msg2 = rmr_torcv_msg( NULL, NULL, 10 );
+ errors += fail_not_nil( msg2, "rmr_torcv_msg returned a pointer when given nil information" );
+ msg2 = rmr_torcv_msg( rmc, NULL, 10 );
+ errors += fail_if_nil( msg2, "rmr_torcv_msg did not return a message pointer when given a nil old msg" );
+
// --- test timeout receive; our dummy epoll function will return 1 ready on first call and 0 ready (timeout emulation) on second
// however we must drain the swamp (queue) first, so run until we get a timeout error, or 20 and report error if we get to 20.
msg = NULL;
// --- test timeout receive; our dummy epoll function will return 1 ready on first call and 0 ready (timeout emulation) on second
// however we must drain the swamp (queue) first, so run until we get a timeout error, or 20 and report error if we get to 20.
msg = NULL;
errors += fail_not_equal( state, 17, "len of trace data (a) returned after msg allocation was not expected size (b)" );
state = strcmp( wbuf, "1904308620110417" );
errors += fail_not_equal( state, 0, "trace data returned after tralloc was not correct" );
errors += fail_not_equal( state, 17, "len of trace data (a) returned after msg allocation was not expected size (b)" );
state = strcmp( wbuf, "1904308620110417" );
errors += fail_not_equal( state, 0, "trace data returned after tralloc was not correct" );