Compare commits

..

17 Commits

Author SHA1 Message Date
Janet B. Anderson
7c136fc07d R3.14.11 2009-08-28 18:49:40 +00:00
Andrew Johnson
534ca2c86e Make ellFree() a 1-argument macro, calls ellFree2() with free as freeFunc. 2009-08-28 18:34:38 +00:00
Andrew Johnson
f17ac39f29 Disable divide by zero warnings on MSVC when generating NAN and INF.
Use those values rather than calculating them independently.
2009-08-25 18:19:49 +00:00
Jeff Hill
a4e5e540a9 added \n to printf diagnostic 2009-08-25 15:45:20 +00:00
Jeff Hill
33911cd0af improved failure diagnostic 2009-08-25 14:50:11 +00:00
Andrew Johnson
1607d2a192 ellFree() and Win32 time provider. 2009-08-24 20:55:31 +00:00
Jeff Hill
140b8a468d we dont need tocheck the return from new with assert 2009-08-24 17:09:55 +00:00
Jeff Hill
d84e9cb3ec exp passed to assert must not change the state of the data structures 2009-08-24 17:08:41 +00:00
Jeff Hill
fa24d119dd use verify instead of assert (in tests) 2009-08-24 17:07:03 +00:00
Jeff Hill
4921187178 use verify instead of assert 2009-08-24 17:04:40 +00:00
Jeff Hill
794811b95a exp passed to assert must not change the state of the data structures 2009-08-24 17:03:17 +00:00
Jeff Hill
aa904449c0 we dont need tocheck the return from new with assert 2009-08-24 17:01:21 +00:00
Andrew Johnson
1c95101ae1 Fixed Till's report of non-thread-safe lazy-init. 2009-08-21 17:32:13 +00:00
Janet B. Anderson
0961378465 Revert to -CVS for snapshots. 2009-08-21 15:48:28 +00:00
Janet B. Anderson
7655e7859d R3.14.11-RC1 2009-08-21 15:41:28 +00:00
Andrew Johnson
bbc0899423 RC1 2009-08-21 15:34:02 +00:00
Andrew Johnson
3afade09e6 Fixed epicsCalcTest issue, but epicsMutexTest can still run too long. 2009-08-21 15:32:01 +00:00
30 changed files with 393 additions and 350 deletions

View File

@@ -33,14 +33,14 @@ EPICS_MODIFICATION = 11
EPICS_PATCH_LEVEL = 0
# This will end in -CVS between official releases
EPICS_CVS_SNAPSHOT=-CVS
#EPICS_CVS_SNAPSHOT=-CVS
#EPICS_CVS_SNAPSHOT=-pre1
#EPICS_CVS_SNAPSHOT=-pre1-CVS
#EPICS_CVS_SNAPSHOT=-RC1
#EPICS_CVS_SNAPSHOT=-RC1-CVS
#EPICS_CVS_SNAPSHOT=-RC2
#EPICS_CVS_SNAPSHOT=-RC2-CVS
#EPICS_CVS_SNAPSHOT=
EPICS_CVS_SNAPSHOT=
# No changes should be needed below here

View File

@@ -12,13 +12,8 @@
<ul>
<li>The libCom test suite program epicsCalcTest test #66 fails on some linux
systems. This is not a bug in EPICS and will not be fixed; it actually
demonstrates that the GCC optimizer is not generating the same result for
the expression <tt>isinf(-Inf)</tt> that the glibc function returns at
runtime. Both versions return a non-zero result for infinite arguments, but
the GCC optimized version applies the sign of its infinite argument to its
return value, whereas glibc always returns +1.</li>
<li>The epicsMutexTest program sometimes runs an extra test, resulting in
a failure report from 'make -s runtests'. This is harmless.</li>
</ul>

View File

@@ -3,15 +3,29 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>EPICS Base R3.14.11-CVS Release Notes</title>
<title>EPICS Base R3.14.11-RC1 Release Notes</title>
</head>
<body lang="en">
<h1 align="center">EPICS Base Release 3.14.11-CVS</h1>
<h1 align="center">EPICS Base Release 3.14.11</h1>
<h2 align="center">Changes between 3.14.10 and 3.14.11</h2>
<!-- Insert new items immediately below here ... -->
<h4>Extra argument to ellFree()</h4>
<p>To work properly from Windows DLLs we had to add a second argument to the
ellFree() function, which should be passed the free function to be called. In
most cases this will involve just adding <tt><b>, free</b></tt> to the argument
list.</p>
<h4>Time provider on Win32</h4>
<p>A race condition meant that sometimes EPICS programs (including the internal
programs such as flex and antelope) built for Win32 architectures would not
start properly on Windows systems that have multiple CPUs. This race has been
fixed.</p>
<h4>Build system dependency change</h4>
<p>In order to get GNU make parallel execution (-j option) to work proprely for

View File

@@ -55,6 +55,9 @@ static epicsTimeStamp showProgressBeginTime;
static const double timeoutToPendIO = 1e20;
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
void showProgressBegin ( const char *pTestName, unsigned interestLevel )
{
@@ -133,7 +136,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
}
assert ( eventCount > 0 );
verify ( eventCount > 0 );
/* clear any knowledge of old gets */
ca_pend_io ( 1e-5 );
@@ -167,7 +170,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
}
assert ( eventCount > 0 );
verify ( eventCount > 0 );
status = ca_clear_event ( id );
SEVCHK (status, 0);
@@ -193,7 +196,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
}
assert ( eventCount > 0 );
verify ( eventCount > 0 );
/* verify that a ca_put() produces an update, but */
/* this may fail if there is an unusual deadband */
@@ -224,7 +227,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
}
assert ( eventCount > 0 );
verify ( eventCount > 0 );
/* clean up */
status = ca_clear_channel ( chan2 );
@@ -282,7 +285,7 @@ void verifyMonitorSubscriptionFlushIO ( chid chan, unsigned interestLevel )
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
}
assert ( eventCount > 0 );
verify ( eventCount > 0 );
status = ca_clear_event ( id );
SEVCHK (status, 0);
@@ -293,9 +296,9 @@ void accessRightsStateChange ( struct access_rights_handler_args args )
{
appChan *pChan = (appChan *) ca_puser ( args.chid );
assert ( pChan->channel == args.chid );
assert ( args.ar.read_access == ca_read_access ( args.chid ) );
assert ( args.ar.write_access == ca_write_access ( args.chid ) );
verify ( pChan->channel == args.chid );
verify ( args.ar.read_access == ca_read_access ( args.chid ) );
verify ( args.ar.write_access == ca_write_access ( args.chid ) );
accessUpdateCount++;
pChan->accessUpdateCount++;
}
@@ -304,12 +307,12 @@ void getCallbackStateChange ( struct event_handler_args args )
{
appChan *pChan = (appChan *) args.usr;
assert ( pChan->channel == args.chid );
assert ( pChan->connected );
verify ( pChan->channel == args.chid );
verify ( pChan->connected );
if ( args.status != ECA_NORMAL ) {
printf ( "getCallbackStateChange abnormal status was \"%s\"\n",
ca_message ( args.status ) );
assert ( args.status == ECA_NORMAL );
verify ( args.status == ECA_NORMAL );
}
getCallbackCount++;
@@ -322,25 +325,25 @@ void connectionStateChange ( struct connection_handler_args args )
appChan *pChan = (appChan *) ca_puser ( args.chid );
assert ( pChan->channel == args.chid );
verify ( pChan->channel == args.chid );
if ( args.op == CA_OP_CONN_UP ) {
if ( pChan->accessRightsHandlerInstalled ) {
assert ( pChan->accessUpdateCount > 0u );
verify ( pChan->accessUpdateCount > 0u );
}
assert ( ! pChan->connected );
verify ( ! pChan->connected );
pChan->connected = 1;
status = ca_get_callback ( DBR_STS_STRING, args.chid, getCallbackStateChange, pChan );
SEVCHK (status, 0);
}
else if ( args.op == CA_OP_CONN_DOWN ) {
assert ( pChan->connected );
verify ( pChan->connected );
pChan->connected = 0u;
assert ( ! ca_read_access ( args.chid ) );
assert ( ! ca_write_access ( args.chid ) );
verify ( ! ca_read_access ( args.chid ) );
verify ( ! ca_write_access ( args.chid ) );
}
else {
assert ( 0 );
verify ( 0 );
}
pChan->connectionUpdateCount++;
connectionUpdateCount++;
@@ -351,11 +354,11 @@ void subscriptionStateChange ( struct event_handler_args args )
struct dbr_sts_string * pdbrgs = ( struct dbr_sts_string * ) args.dbr;
appChan *pChan = (appChan *) args.usr;
assert ( args.status == ECA_NORMAL );
assert ( pChan->channel == args.chid );
assert ( pChan->connected );
assert ( args.type == DBR_STS_STRING );
assert ( strlen ( pdbrgs->value ) <= MAX_STRING_SIZE );
verify ( args.status == ECA_NORMAL );
verify ( pChan->channel == args.chid );
verify ( pChan->connected );
verify ( args.type == DBR_STS_STRING );
verify ( strlen ( pdbrgs->value ) <= MAX_STRING_SIZE );
pChan->subscriptionUpdateCount++;
subscriptionUpdateCount++;
}
@@ -422,7 +425,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount,
subscriptionStateChange, &pChans[j], &pChans[j].subscription );
SEVCHK ( status, NULL );
assert ( ca_test_io () == ECA_IODONE );
verify ( ca_test_io () == ECA_IODONE );
}
ca_flush_io ();
@@ -436,13 +439,13 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount,
}
for ( j = 0u; j < chanCount; j++ ) {
assert ( pChans[j].getCallbackCount == 1u);
assert ( pChans[j].connectionUpdateCount > 0 );
verify ( pChans[j].getCallbackCount == 1u);
verify ( pChans[j].connectionUpdateCount > 0 );
if ( pChans[j].connectionUpdateCount > 1u ) {
printf ("Unusual connection activity count = %u on channel %s?\n",
pChans[j].connectionUpdateCount, pChans[j].name );
}
assert ( pChans[j].accessUpdateCount > 0 );
verify ( pChans[j].accessUpdateCount > 0 );
if ( pChans[j].accessUpdateCount > 1u ) {
printf ("Unusual access rights activity count = %u on channel %s?\n",
pChans[j].connectionUpdateCount, pChans[j].name );
@@ -515,7 +518,7 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
i = 0;
while ( backgroundConnCount > 1u ) {
backgroundConnCount = ca_get_ioc_connection_count ();
assert ( i++ < 10 );
verify ( i++ < 10 );
printf ( "Z" );
fflush ( stdout );
epicsThreadSleep ( 1.0 );
@@ -535,11 +538,11 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
SEVCHK ( status, NULL );
if ( ca_state ( pChans[j].channel ) == cs_conn ) {
assert ( VALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
verify ( VALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
}
else {
assert ( INVALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
assert ( ca_test_io () == ECA_IOINPROGRESS );
verify ( INVALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
verify ( ca_test_io () == ECA_IOINPROGRESS );
}
status = ca_replace_access_rights_event (
@@ -577,14 +580,14 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
showProgress ( interestLevel );
assert ( ca_test_io () == ECA_IODONE );
verify ( ca_test_io () == ECA_IODONE );
connections = ca_get_ioc_connection_count ();
assert ( connections == backgroundConnCount );
verify ( connections == backgroundConnCount );
for ( j = 0u; j < chanCount; j++ ) {
assert ( VALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
assert ( ca_state ( pChans[j].channel ) == cs_conn );
verify ( VALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) );
verify ( ca_state ( pChans[j].channel ) == cs_conn );
SEVCHK ( ca_clear_channel ( pChans[j].channel ), NULL );
}
@@ -605,7 +608,7 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
while ( ca_get_ioc_connection_count () != backgroundConnCount ) {
epicsThreadSleep ( 0.1 );
ca_poll (); /* emulate typical GUI */
assert ( ++j < 100 );
verify ( ++j < 100 );
}
}
showProgress ( interestLevel );
@@ -621,7 +624,7 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
SEVCHK ( status, NULL );
}
assert ( ca_test_io () == ECA_IODONE );
verify ( ca_test_io () == ECA_IODONE );
/*
* verify ca_pend_io() does not see old search requests
@@ -650,13 +653,13 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount,
SEVCHK ( status, NULL );
status = ca_pend_io ( 1e-16 );
if ( status != ECA_TIMEOUT ) {
assert ( ca_state ( pChans[1].channel ) == cs_conn );
verify ( ca_state ( pChans[1].channel ) == cs_conn );
}
status = ca_clear_channel ( pChans[1].channel );
SEVCHK ( status, NULL );
}
else {
assert ( ca_state( pChans[0].channel ) == cs_conn );
verify ( ca_state( pChans[0].channel ) == cs_conn );
}
}
status = ca_clear_channel( pChans[0].channel );
@@ -721,9 +724,9 @@ void grEnumTest ( chid chan, unsigned interestLevel )
SEVCHK (status, "DBR_GR_ENUM ca_get()");
status = ca_pend_io (timeoutToPendIO);
assert (status == ECA_NORMAL);
verify (status == ECA_NORMAL);
assert ( ge.no_str >= 0 && ge.no_str < NELEMENTS(ge.strs) );
verify ( ge.no_str >= 0 && ge.no_str < NELEMENTS(ge.strs) );
if ( ge.no_str > 0 ) {
printf ("Enum state str = {");
count = (unsigned) ge.no_str;
@@ -763,7 +766,7 @@ void ctrlDoubleTest ( chid chan, unsigned interestLevel )
size = sizeof (*pDbl)*ca_element_count(chan);
pDbl = malloc (size);
assert (pDbl!=NULL);
verify (pDbl!=NULL);
/*
* initialize the array
@@ -782,7 +785,7 @@ void ctrlDoubleTest ( chid chan, unsigned interestLevel )
size = dbr_size_n(DBR_CTRL_DOUBLE, ca_element_count(chan));
pCtrlDbl = (struct dbr_ctrl_double *) malloc (size);
assert (pCtrlDbl!=NULL);
verify (pCtrlDbl!=NULL);
/*
* read the array from the PV
@@ -792,14 +795,14 @@ void ctrlDoubleTest ( chid chan, unsigned interestLevel )
chan, pCtrlDbl);
SEVCHK (status, "ctrlDoubleTest, ca_array_get");
status = ca_pend_io ( timeoutToPendIO );
assert (status==ECA_NORMAL);
verify (status==ECA_NORMAL);
/*
* verify the result
*/
for (i=0; i<nElem; i++) {
double diff = pDbl[i] - sin (i*slice);
assert (fabs(diff) < DBL_EPSILON*4);
verify (fabs(diff) < DBL_EPSILON*4);
}
free (pCtrlDbl);
@@ -830,7 +833,7 @@ void verifyBlockInPendIO ( chid chan, unsigned interestLevel )
"get block test failed - val written %d\n", req );
printf (
"get block test failed - val read %d\n", resp );
assert ( 0 );
verify ( 0 );
}
}
else if ( resp != -100 ) {
@@ -847,7 +850,7 @@ void verifyBlockInPendIO ( chid chan, unsigned interestLevel )
"get block test failed - val written %d\n", req);
printf (
"get block test failed - val read %d\n", resp);
assert(0);
verify (0);
}
showProgressEnd ( interestLevel );
}
@@ -879,7 +882,7 @@ void floatTest ( chid chan, dbr_float_t beginValue, dbr_float_t increment,
if ( fabs ( fval - fretval ) > epsilon ) {
printf ( "float test failed val written %f\n", fval );
printf ( "float test failed val read %f\n", fretval );
assert (0);
verify (0);
}
fval += increment;
}
@@ -909,7 +912,7 @@ void doubleTest ( chid chan, dbr_double_t beginValue,
if ( fabs ( fval - fretval ) > epsilon ) {
printf ( "double test failed val written %f\n", fval );
printf ( "double test failed val read %f\n", fretval );
assert ( 0 );
verify ( 0 );
}
fval += increment;
}
@@ -960,7 +963,7 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max,
(dbr_double_t) epsil, iter );
}
else {
assert ( 0 );
verify ( 0 );
}
}
base = max;
@@ -981,7 +984,7 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max,
(dbr_double_t) epsil, iter );
}
else {
assert ( 0 );
verify ( 0 );
}
}
base = - max;
@@ -1002,7 +1005,7 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max,
(dbr_double_t) epsil, iter );
}
else {
assert ( 0 );
verify ( 0 );
}
}
showProgressEnd ( interestLevel );
@@ -1042,7 +1045,7 @@ void verifyLongIO ( chid chan, unsigned interestLevel )
ca_get ( DBR_LONG, chan, &rdbk );
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "get pend failed\n" );
assert ( iter == rdbk );
verify ( iter == rdbk );
}
showProgressEnd ( interestLevel );
}
@@ -1087,7 +1090,7 @@ void verifyShortIO ( chid chan, unsigned interestLevel )
ca_get ( DBR_SHORT, chan, &rdbk );
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "get pend failed\n" );
assert ( iter == rdbk );
verify ( iter == rdbk );
}
showProgressEnd ( interestLevel );
}
@@ -1198,7 +1201,7 @@ void verifyHighThroughputWriteCallback ( chid chan, unsigned interestLevel )
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status,
"verifyHighThroughputWriteCallback, verification get pend" );
assert ( dval == i );
verify ( dval == i );
showProgressEnd ( interestLevel );
}
else {
@@ -1219,14 +1222,14 @@ void verifyBadString ( chid chan, unsigned interestLevel )
showProgressBegin ( "verifyBadString", interestLevel );
memset (stimStr, 'a', sizeof (stimStr) );
status = ca_array_put ( DBR_STRING, 1u, chan, stimStr );
assert ( status != ECA_NORMAL );
verify ( status != ECA_NORMAL );
sprintf ( stimStr, "%u", 8u );
status = ca_array_put ( DBR_STRING, 1u, chan, stimStr );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_array_get ( DBR_STRING, 1u, chan, respStr );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
if ( strcmp ( stimStr, respStr ) ) {
printf (
"Test fails if stim \"%s\" isnt roughly equiv to resp \"%s\"\n",
@@ -1473,7 +1476,7 @@ void channelClearWithEventTrafficTest ( const char *pName, unsigned interestLeve
CA_PRIORITY_DEFAULT, &chan );
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "channelClearWithEventTrafficTest: channel connect failed" );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
count = 0u;
SEVCHK ( ca_add_event ( DBR_GR_FLOAT, chan, noopSubscriptionStateChange,
@@ -1516,7 +1519,7 @@ void selfDeleteEvent ( struct event_handler_args args )
{
int status;
status = ca_clear_event ( globalEventID );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
}
void eventClearTest ( chid chan )
@@ -1601,7 +1604,7 @@ void exceptionTest ( chid chan, unsigned interestLevel )
SEVCHK ( status, "exception notify install failed" );
pRS = malloc ( ca_element_count (chan) * sizeof (*pRS) );
assert ( pRS );
verify ( pRS );
status = ca_array_get ( DBR_PUT_ACKT,
ca_element_count (chan), chan, pRS );
SEVCHK ( status, "array read request failed" );
@@ -1627,7 +1630,7 @@ void exceptionTest ( chid chan, unsigned interestLevel )
status = ca_array_get_callback ( DBR_PUT_ACKT,
ca_element_count (chan), chan, arrayEventExceptionNotify, 0 );
if ( status != ECA_NORMAL ) {
assert ( status == ECA_BADTYPE || status == ECA_GETFAIL );
verify ( status == ECA_BADTYPE || status == ECA_GETFAIL );
arrayEventExceptionNotifyComplete = 1;
}
ca_flush_io ();
@@ -1651,7 +1654,7 @@ void exceptionTest ( chid chan, unsigned interestLevel )
status = ca_add_array_event ( DBR_PUT_ACKT, ca_element_count ( chan ),
chan, arrayEventExceptionNotify, 0, 0.0, 0.0, 0.0, &id );
if ( status != ECA_NORMAL ) {
assert ( status == ECA_BADTYPE || status == ECA_GETFAIL );
verify ( status == ECA_BADTYPE || status == ECA_GETFAIL );
arrayEventExceptionNotifyComplete = 1;
}
ca_flush_io ();
@@ -1679,14 +1682,14 @@ void exceptionTest ( chid chan, unsigned interestLevel )
SEVCHK ( status, "exception notify install failed" );
pWS = malloc ( ca_element_count (chan) * MAX_STRING_SIZE );
assert ( pWS );
verify ( pWS );
for ( i = 0; i < ca_element_count (chan); i++ ) {
strcpy ( pWS[i], "@#$%" );
}
status = ca_array_put ( DBR_STRING,
ca_element_count (chan), chan, pWS );
if ( status != ECA_NORMAL ) {
assert ( status == ECA_BADTYPE || status == ECA_PUTFAIL );
verify ( status == ECA_BADTYPE || status == ECA_PUTFAIL );
acctstExceptionCount++; /* local PV case */
}
ca_flush_io ();
@@ -1711,7 +1714,7 @@ void exceptionTest ( chid chan, unsigned interestLevel )
unsigned i;
pWS = malloc ( ca_element_count (chan) * MAX_STRING_SIZE );
assert ( pWS );
verify ( pWS );
for ( i = 0; i < ca_element_count (chan); i++ ) {
strcpy ( pWS[i], "@#$%" );
}
@@ -1751,7 +1754,7 @@ void arrayReadNotify ( struct event_handler_args args )
dbr_double_t *pRF = ( dbr_double_t * ) ( args.dbr );
int i;
for ( i = 0; i < args.count; i++ ) {
assert ( pWF[i] == pRF[i] );
verify ( pWF[i] == pRF[i] );
}
arrayReadNotifyComplete = 1;
}
@@ -1781,10 +1784,10 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel )
showProgressBegin ( "arrayTest", interestLevel );
pRF = (dbr_double_t *) calloc ( ca_element_count (chan), sizeof (*pRF) );
assert ( pRF != NULL );
verify ( pRF != NULL );
pWF = (dbr_double_t *) calloc ( ca_element_count (chan), sizeof (*pWF) );
assert ( pWF != NULL );
verify ( pWF != NULL );
/*
* write some random numbers into the array
@@ -1810,7 +1813,11 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel )
* verify read response matches values written
*/
for ( i = 0; i < ca_element_count ( chan ); i++ ) {
assert ( pWF[i] == pRF[i] );
if ( pWF[i] != pRF[i] ) {
printf ( "i=%u, pWF[i]=%f, pRF[i]=%f\n",
i, pWF[i], pRF[i]);
}
verify ( pWF[i] == pRF[i] );
}
/*
@@ -1823,7 +1830,7 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel )
if ( size <= maxArrayBytes ) {
pRS = malloc ( ca_element_count (chan) * MAX_STRING_SIZE );
assert ( pRS );
verify ( pRS );
status = ca_array_get ( DBR_STRING,
ca_element_count (chan), chan, pRS );
SEVCHK ( status, "array read request failed" );
@@ -1897,7 +1904,7 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel )
}
}
else {
assert ( status == ECA_BADCOUNT );
verify ( status == ECA_BADCOUNT );
}
status = ca_add_exception_event ( 0, 0 );
SEVCHK ( status, "exception notify install failed" );
@@ -1926,54 +1933,54 @@ void unequalServerBufferSizeTest ( const char * pName, unsigned interestLevel )
/* this test must be run when no channels are connected */
connections = ca_get_ioc_connection_count ();
assert ( connections == 0u );
verify ( connections == 0u );
status = ca_create_channel ( pName, 0, 0, 0, & newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
showProgress ( interestLevel );
if ( ! ca_write_access ( newChan ) ) {
printf ( "skipping unequal buffer size test - no write access\n" );
status = ca_clear_channel ( newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
return;
}
pRF = (dbr_double_t *) calloc ( ca_element_count (newChan), sizeof (*pRF) );
assert ( pRF != NULL );
verify ( pRF != NULL );
pWF = (dbr_double_t *) calloc ( ca_element_count (newChan), sizeof (*pWF) );
assert ( pWF != NULL );
verify ( pWF != NULL );
status = ca_array_get ( DBR_DOUBLE, ca_element_count ( newChan ),
newChan, pRF );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_clear_channel ( newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
showProgress ( interestLevel );
status = ca_create_channel ( pName, 0, 0, 0, &newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
showProgress ( interestLevel );
status = ca_array_put ( DBR_DOUBLE, ca_element_count ( newChan ),
newChan, pWF );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_array_get ( DBR_DOUBLE, 1,
newChan, pRF );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_clear_channel ( newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
free ( pRF );
free ( pWF );
@@ -2002,7 +2009,7 @@ void pend_event_delay_test ( dbr_double_t request )
accuracy = 100.0*(delay-request)/request;
printf ( "CA pend event delay = %f sec results in error = %f %%\n",
request, accuracy );
assert ( fabs(accuracy) < 10.0 );
verify ( fabs(accuracy) < 10.0 );
}
void caTaskExitTest ( unsigned interestLevel )
@@ -2022,26 +2029,26 @@ void verifyDataTypeMacros (void)
int type;
type = dbf_type_to_DBR ( DBF_SHORT );
assert ( type == DBR_SHORT );
verify ( type == DBR_SHORT );
type = dbf_type_to_DBR_STS ( DBF_SHORT );
assert ( type == DBR_STS_SHORT );
verify ( type == DBR_STS_SHORT );
type = dbf_type_to_DBR_GR ( DBF_SHORT );
assert ( type == DBR_GR_SHORT );
verify ( type == DBR_GR_SHORT );
type = dbf_type_to_DBR_CTRL ( DBF_SHORT );
assert ( type == DBR_CTRL_SHORT );
verify ( type == DBR_CTRL_SHORT );
type = dbf_type_to_DBR_TIME ( DBF_SHORT );
assert ( type == DBR_TIME_SHORT );
assert ( strcmp ( dbr_type_to_text( DBR_SHORT ), "DBR_SHORT" ) == 0 );
assert ( strcmp ( dbf_type_to_text( DBF_SHORT ), "DBF_SHORT" ) == 0 );
assert ( dbr_type_is_SHORT ( DBR_SHORT ) );
assert ( dbr_type_is_valid ( DBR_SHORT ) );
assert ( dbf_type_is_valid ( DBF_SHORT ) );
verify ( type == DBR_TIME_SHORT );
verify ( strcmp ( dbr_type_to_text( DBR_SHORT ), "DBR_SHORT" ) == 0 );
verify ( strcmp ( dbf_type_to_text( DBF_SHORT ), "DBF_SHORT" ) == 0 );
verify ( dbr_type_is_SHORT ( DBR_SHORT ) );
verify ( dbr_type_is_valid ( DBR_SHORT ) );
verify ( dbf_type_is_valid ( DBF_SHORT ) );
{
int dataType = -1;
dbf_text_to_type ( "DBF_SHORT", dataType );
assert ( dataType == DBF_SHORT );
verify ( dataType == DBF_SHORT );
dbr_text_to_type ( "DBR_CLASS_NAME", dataType );
assert ( dataType == DBR_CLASS_NAME );
verify ( dataType == DBR_CLASS_NAME );
}
}
@@ -2084,7 +2091,7 @@ void clearChannelInGetCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
status = ca_create_channel ( pName, 0, 0, 0, & chan );
@@ -2098,7 +2105,7 @@ void clearChannelInGetCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
showProgressEnd ( level );
@@ -2115,7 +2122,7 @@ void clearChannelInPutCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
status = ca_create_channel ( pName, 0, 0, 0, & chan );
@@ -2130,7 +2137,7 @@ void clearChannelInPutCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
showProgressEnd ( level );
@@ -2146,7 +2153,7 @@ void clearChannelInSubscrCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
status = ca_create_channel ( pName, 0, 0, 0, & chan );
@@ -2161,7 +2168,7 @@ void clearChannelInSubscrCallbackTest ( const char *pName, unsigned level )
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
showProgressEnd ( level );
@@ -2172,7 +2179,7 @@ void monitorAddConnectionCallback ( struct connection_handler_args args )
if ( args.op == CA_OP_CONN_UP ) {
unsigned * pEventCount = ( unsigned * ) ca_puser ( args.chid );
int status;
assert ( *pEventCount == 0u );
verify ( *pEventCount == 0u );
(*pEventCount)++;
status = ca_create_subscription ( DBR_DOUBLE, 1,
args.chid, DBE_VALUE, nUpdatesTester, ca_puser ( args.chid ), 0 );
@@ -2201,7 +2208,7 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve
for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) {
ca_pend_event ( 0.1 );
assert ( i < 100 );
verify ( i < 100 );
}
status = ca_create_channel ( pName,
@@ -2211,15 +2218,15 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve
while ( eventCount < 2 ) {
ca_pend_event ( 0.1 );
}
assert ( eventCount == 2u );
verify ( eventCount == 2u );
status = ca_get_callback ( DBR_DOUBLE, chan, nUpdatesTester, &getCallbackCount );
SEVCHK ( status, "monitorAddConnectionCallback get callback" );
while ( getCallbackCount == 0 ) {
ca_pend_event ( 0.1 );
}
assert ( eventCount == 2u );
assert ( getCallbackCount == 1u );
verify ( eventCount == 2u );
verify ( getCallbackCount == 1u );
status = ca_clear_channel ( chan );
SEVCHK ( status, "monitorAddConnectionCallbackTest clear channel" );
@@ -2308,7 +2315,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel )
}
printf ( "-" );
fflush ( stdout );
assert ( tries++ < 50 );
verify ( tries++ < 50 );
}
showProgress ( interestLevel );
@@ -2341,7 +2348,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel )
if ( getResp != temp ) {
printf ( "getResp=%f, temp=%f\n", getResp, temp );
assert ( getResp == temp );
verify ( getResp == temp );
}
/*
@@ -2358,7 +2365,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel )
* we shouldnt see old monitors because
* we resubscribed
*/
assert ( test[j].count <= i + 2 );
verify ( test[j].count <= i + 2 );
if ( test[j].lastValue == temp ) {
if ( test[j].count < i + 1 ) {
tmpFlowCtrlCount++;
@@ -2371,7 +2378,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel )
break;
}
if ( passCount == prevPassCount ) {
assert ( tries++ < 500 );
verify ( tries++ < 500 );
if ( tries % 50 == 0 ) {
for ( j = 0; j <= i; j++ ) {
dbr_float_t pat = monitorUpdateTestPattern ( j );
@@ -2431,7 +2438,7 @@ void verifyReasonableBeaconPeriod ( chid chan, unsigned interestLevel )
ca_name ( chan ), beaconPeriod );
watchDogDelay = ca_receive_watchdog_delay ( chan );
assert ( watchDogDelay >= 0.0 );
verify ( watchDogDelay >= 0.0 );
printf ( "busy: receive watchdog for \"%s\" expires in %g sec.\n",
ca_name ( chan ), watchDogDelay );
@@ -2449,7 +2456,7 @@ void verifyReasonableBeaconPeriod ( chid chan, unsigned interestLevel )
}
watchDogDelay = ca_receive_watchdog_delay ( chan );
assert ( watchDogDelay >= 0.0 );
verify ( watchDogDelay >= 0.0 );
printf ( "inactive: receive watchdog for \"%s\" expires in %g sec.\n",
ca_name ( chan ), watchDogDelay );
@@ -2468,9 +2475,9 @@ void verifyOldPend ( unsigned interestLevel )
* verify that the old ca_pend() is in the symbol table
*/
status = ca_pend ( 100000.0, 1 );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_pend ( 1e-12, 0 );
assert ( status == ECA_TIMEOUT );
verify ( status == ECA_TIMEOUT );
showProgressEnd ( interestLevel );
}
@@ -2488,21 +2495,21 @@ void verifyTimeStamps ( chid chan, unsigned interestLevel )
showProgressBegin ( "verifyTimeStamps", interestLevel );
status = epicsTimeGetCurrent ( & localTime );
assert ( status >= 0 );
verify ( status >= 0 );
status = ca_get ( DBR_TIME_DOUBLE, chan, & first );
SEVCHK ( status, "fetch of dbr time double failed\n" );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_get ( DBR_TIME_DOUBLE, chan, & last );
SEVCHK ( status, "fetch of dbr time double failed\n" );
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
length = epicsTimeToStrftime ( buf, sizeof ( buf ),
"%a %b %d %Y %H:%M:%S.%f", & first.stamp );
assert ( length );
verify ( length );
printf ("Processing time of channel \"%s\" was \"%s\"\n",
ca_name ( chan ), buf );
@@ -2556,7 +2563,7 @@ void verifyChannelPriorities ( const char *pName, unsigned interestLevel )
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "prioritized channel connect failed" );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
value = i;
status = ca_put ( DBR_DOUBLE, chan0, &value );
@@ -2595,7 +2602,7 @@ void verifyTearDownWhenChannelConnected ( const char * pName,
double * const pValues = (double * const) calloc ( chanCount, sizeof ( *pValues ) );
unsigned i, j;
assert ( pChans && pValues );
verify ( pChans && pValues );
showProgressBegin ( "verifyTearDownWhenChannelConnected", interestLevel );
@@ -2609,7 +2616,7 @@ void verifyTearDownWhenChannelConnected ( const char * pName,
}
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "immediate tear down channel connect failed" );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
for ( j = 0; j < chanCount; j++ ) {
status = ca_get ( DBR_DOUBLE, pChans[j], &pValues[j] );
@@ -2649,7 +2656,7 @@ void verifyImmediateTearDown ( const char * pName,
SEVCHK ( status, "immediate tear down channel create failed" );
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "immediate tear down channel connect failed" );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
/*
* verify that puts pending when we call ca_task_exit()
* get flushed out
@@ -2662,7 +2669,7 @@ void verifyImmediateTearDown ( const char * pName,
SEVCHK ( status, "immediate tear down channel get failed" );
if ( currentValue != ( (i - 1) % 8 ) ) {
printf ( "currentValue = %i, i = %i\n", currentValue, i );
assert ( currentValue == ( (i - 1) % 8 ) );
verify ( currentValue == ( (i - 1) % 8 ) );
}
}
status = ca_put ( DBR_LONG, chan, & value );
@@ -2703,12 +2710,12 @@ void fdRegCB ( void * parg, int fd, int opened )
if ( opened ) {
status = fdmgr_add_callback (
mgrCtx, fd, fdi_read, fdcb, 0 );
assert ( status >= 0 );
verify ( status >= 0 );
}
else {
status = fdmgr_clear_callback (
mgrCtx, fd, fdi_read );
assert ( status >= 0 );
verify ( status >= 0 );
}
}
@@ -2723,46 +2730,46 @@ void fdManagerVerify ( const char * pName, unsigned interestLevel )
epicsTimeStamp begin, end;
mgrCtx = fdmgr_init ();
assert ( mgrCtx );
verify ( mgrCtx );
showProgressBegin ( "fdManagerVerify", interestLevel );
status = ca_add_fd_registration ( fdRegCB, mgrCtx );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_create_channel ( pName, 0, 0, 0, & newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
while ( ca_state ( newChan ) != cs_conn ) {
tmo.tv_sec = 6000;
tmo.tv_usec = 0;
status = fdmgr_pend_event ( mgrCtx, & tmo );
assert ( status >= 0 );
verify ( status >= 0 );
}
showProgress ( interestLevel );
status = ca_add_event ( DBR_FLOAT, newChan,
nUpdatesTester, & eventCount, & subscription );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_flush_io ();
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
while ( eventCount < 1 ) {
tmo.tv_sec = 6000;
tmo.tv_usec = 0;
status = fdmgr_pend_event ( mgrCtx, & tmo );
assert ( status >= 0 );
verify ( status >= 0 );
}
showProgress ( interestLevel );
status = ca_clear_event ( subscription );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_flush_io ();
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
/* look for infinite loop in fd manager schedualing */
epicsTimeGetCurrent ( & begin );
@@ -2772,25 +2779,25 @@ void fdManagerVerify ( const char * pName, unsigned interestLevel )
tmo.tv_sec = 1;
tmo.tv_usec = 0;
status = fdmgr_pend_event ( mgrCtx, & tmo );
assert ( status >= 0 );
verify ( status >= 0 );
epicsTimeGetCurrent ( & end );
delay = epicsTimeDiffInSeconds ( & end, & begin );
if ( delay >= 1.0 ) {
break;
}
assert ( eventCount++ < 100 );
verify ( eventCount++ < 100 );
}
showProgress ( interestLevel );
status = ca_clear_channel ( newChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_add_fd_registration ( 0, 0 );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = fdmgr_delete ( mgrCtx );
assert ( status >= 0 );
verify ( status >= 0 );
showProgressEnd ( interestLevel );
}
@@ -2809,11 +2816,11 @@ void verifyConnectWithDisconnectedChannels (
char buf[256];
sprintf ( buf, "aChannelThatShouldNeverNeverNeverExist%u", i );
status = ca_create_channel ( buf, 0, 0, 0, & bogusChan[i] );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
}
status = ca_pend_io ( 0.001 );
assert ( status == ECA_TIMEOUT );
verify ( status == ECA_TIMEOUT );
/* wait a long time for the search interval to increase */
for ( i= 0u; i < 10; i++ ) {
@@ -2822,7 +2829,7 @@ void verifyConnectWithDisconnectedChannels (
}
status = ca_create_channel ( pName, 0, 0, 0, & validChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
/*
* we should be able to connect to a valid
@@ -2831,14 +2838,14 @@ void verifyConnectWithDisconnectedChannels (
* diasconnected channel
*/
status = ca_pend_io ( timeoutToPendIO );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
status = ca_clear_channel ( validChan );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
for ( i= 0u; i < NELEMENTS ( bogusChan ); i++ ) {
status = ca_clear_channel ( bogusChan[i] );
assert ( status == ECA_NORMAL );
verify ( status == ECA_NORMAL );
}
showProgressEnd ( interestLevel );
@@ -2991,7 +2998,7 @@ void verifyContextRundownFlush ( const char * pName, unsigned interestLevel )
status = ca_pend_io ( timeoutToPendIO );
SEVCHK ( status, "get, pend io failed" );
assert ( stim == resp );
verify ( stim == resp );
status = ca_clear_channel ( chan );
SEVCHK ( status, NULL );
@@ -3064,7 +3071,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount,
verifyDataTypeMacros ();
connections = ca_get_ioc_connection_count ();
assert ( connections == 0u );
verify ( connections == 0u );
unequalServerBufferSizeTest ( pName, interestLevel );
clearChannelInGetCallbackTest ( pName, interestLevel );
clearChannelInPutCallbackTest ( pName, interestLevel );
@@ -3083,7 +3090,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount,
ca_element_count ( chan ) );
connections = ca_get_ioc_connection_count ();
assert ( connections == 1u || connections == 0u );
verify ( connections == 1u || connections == 0u );
if ( connections == 0u ) {
printf ( "testing with a local channel\n" );
}
@@ -3135,7 +3142,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount,
/* ca_client_status ( 6u ); info about each channel */
pChans = calloc ( channelCount, sizeof ( *pChans ) );
assert ( pChans );
verify ( pChans );
for ( i = 0; i < channelCount; i++ ) {
strncpy ( pChans[ i ].name, pName, sizeof ( pChans[ i ].name ) );

View File

@@ -66,7 +66,6 @@ void caConnTest ( const char *pNameIn, unsigned channelCountIn, double delayIn )
channelCount = channelCountIn;
pChans = new chid [channelCount];
assert ( pChans );
while ( 1 ) {
connCount = 0u;

View File

@@ -36,7 +36,6 @@ void caEventRate ( const char *pName, unsigned count )
unsigned eventCount = 0u;
chid * pChidTable = new chid [ count ];
assert ( pChidTable );
{
printf ( "Connecting to CA Channel \"%s\" %u times.",

View File

@@ -145,7 +145,8 @@ private:
return;
}
pComBuf = newComBuf ();
assert ( pComBuf->push ( val ) );
bool success = pComBuf->push ( val );
assert ( success );
this->pushComBuf ( *pComBuf );
}

View File

@@ -79,8 +79,8 @@ void nciu::destroy (
epicsGuard < epicsMutex > & guard )
{
while ( baseNMIU * pNetIO = this->eventq.first () ) {
assert ( this->cacCtx.destroyIO (
guard, pNetIO->getId (), *this ) );
bool success = this->cacCtx.destroyIO ( guard, pNetIO->getId (), *this );
assert ( success );
}
// if the claim reply has not returned yet then we will issue

View File

@@ -511,7 +511,10 @@ void ca_repeater ()
pBuf = new char [MAX_UDP_RECV];
assert ( osiSockAttach() );
{
bool success = osiSockAttach();
assert ( success );
}
port = envGetInetPortConfigParam ( & EPICS_CA_REPEATER_PORT,
static_cast <unsigned short> (CA_REPEATER_PORT) );

View File

@@ -50,7 +50,6 @@ public:
{
pvInfo::pFirst = this;
this->pName = new char [strlen(pNameIn)+1u];
assert(this->pName);
strcpy(this->pName, pNameIn);
}

View File

@@ -21,9 +21,13 @@
#define epicsExportSharedSymbols
#include "casdef.h"
#include "epicsAssert.h"
#include "casEventRegistry.h"
#ifdef TEST
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
main ()
{
casEventRegistry reg;
@@ -49,20 +53,20 @@ main ()
art2.show(10u);
reg.show(10u);
assert (bill1 == bill2);
assert (bill1 == bill3);
assert (jane != bill1);
assert (jane != art1);
assert (bill1 != art1);
assert (art1 == art2);
verify (bill1 == bill2);
verify (bill1 == bill3);
verify (jane != bill1);
verify (jane != art1);
verify (bill1 != art1);
verify (art1 == art2);
artBill = art1 | bill1;
tmp = artBill & art1;
assert (tmp.eventsSelected());
verify (tmp.eventsSelected());
tmp = artBill & bill1;
assert (tmp.eventsSelected());
verify (tmp.eventsSelected());
tmp = artBill&jane;
assert (tmp.noEventsSelected());
verify (tmp.noEventsSelected());
}
#endif
@@ -128,10 +132,8 @@ casEventMaskEntry::casEventMaskEntry (
casEventRegistry & regIn, casEventMask maskIn, const char * pName ) :
casEventMask ( maskIn ), stringId ( pName ), reg ( regIn )
{
int stat;
assert ( this->resourceName() != NULL );
stat = this->reg.add ( *this );
int stat = this->reg.add ( *this );
assert ( stat == 0 );
}

View File

@@ -613,7 +613,7 @@ static void dbBkptCont(dbCommon *precord)
--lset_stack_count;
/* free entrypoint queue */
ellFree(&pnode->ep_queue, free);
ellFree(&pnode->ep_queue);
/* remove execution semaphore */
epicsEventDestroy(pnode->ex_sem);

View File

@@ -135,7 +135,7 @@ epicsShareFunc long
if (itop)
*ptop = (long) *ptop % itop;
else
*ptop = 0.0 / itop; /* NaN */
*ptop = epicsNAN; /* NaN */
break;
case POWER:

View File

@@ -25,6 +25,9 @@ typedef intId<unsigned,8,16> testIntId;
typedef intId<unsigned,8> testIntId;
#endif
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
static void empty()
{
}
@@ -34,7 +37,7 @@ public:
albert (resTable< albert, testIntId > &atIn, unsigned idIn) :
testIntId(idIn), at(atIn)
{
assert (at.add (*this)==0);
verify (at.add (*this)==0);
}
void show (unsigned /* level */)
{
@@ -125,52 +128,52 @@ int main()
intTbl.setTableSize ( 100000 );
assert (intTbl.add(fred0)==0);
verify (intTbl.add(fred0)==0);
intTbl.verify ();
assert (intTbl.add(fred1)==0);
verify (intTbl.add(fred1)==0);
intTbl.verify ();
assert (intTbl.add(fred2)==0);
verify (intTbl.add(fred2)==0);
intTbl.verify ();
assert (intTbl.add(fred3)==0);
verify (intTbl.add(fred3)==0);
intTbl.verify ();
assert (intTbl.add(fred4)==0);
verify (intTbl.add(fred4)==0);
intTbl.verify ();
intTbl.setTableSize ( 200000 );
assert (intTbl.add(fred5)==0);
verify (intTbl.add(fred5)==0);
intTbl.verify ();
assert (intTbl.add(fred6)==0);
verify (intTbl.add(fred6)==0);
intTbl.verify ();
assert (intTbl.add(fred7)==0);
verify (intTbl.add(fred7)==0);
intTbl.verify ();
assert (intTbl.add(fred8)==0);
verify (intTbl.add(fred8)==0);
intTbl.verify ();
assert (intTbl.add(fred9)==0);
verify (intTbl.add(fred9)==0);
intTbl.verify ();
start = clock();
for (i=0; i<LOOPS; i++) {
pFred = intTbl.lookup(intId1);
assert(pFred==&fred1);
verify(pFred==&fred1);
pFred = intTbl.lookup(intId2);
assert(pFred==&fred2);
verify (pFred==&fred2);
pFred = intTbl.lookup(intId3);
assert(pFred==&fred3);
verify (pFred==&fred3);
pFred = intTbl.lookup(intId4);
assert(pFred==&fred4);
verify (pFred==&fred4);
pFred = intTbl.lookup(intId5);
assert(pFred==&fred5);
verify (pFred==&fred5);
pFred = intTbl.lookup(intId6);
assert(pFred==&fred6);
verify (pFred==&fred6);
pFred = intTbl.lookup(intId7);
assert(pFred==&fred7);
verify (pFred==&fred7);
pFred = intTbl.lookup(intId8);
assert(pFred==&fred8);
verify (pFred==&fred8);
pFred = intTbl.lookup(intId9);
assert(pFred==&fred9);
verify (pFred==&fred9);
pFred = intTbl.lookup(intId0);
assert(pFred==&fred0);
verify (pFred==&fred0);
}
finish = clock();
@@ -187,35 +190,35 @@ int main()
intTbl.remove(intId1);
intTbl.remove(intId2);
pFred = intTbl.lookup(intId1);
assert(pFred==0);
verify (pFred==0);
pFred = intTbl.lookup(intId2);
assert(pFred==0);
verify (pFred==0);
assert (strTbl.add(jane1)==0);
assert (strTbl.add(jane2)==0);
verify (strTbl.add(jane1)==0);
verify (strTbl.add(jane2)==0);
start = clock();
for(i=0; i<LOOPS; i++){
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId1);
assert(pJane==&jane1);
verify (pJane==&jane1);
pJane = strTbl.lookup(strId2);
assert(pJane==&jane2);
verify (pJane==&jane2);
}
finish = clock();
@@ -264,7 +267,7 @@ int main()
for (i=0; i<elementCount; i++) {
pAlbert[i] = new albert (alTbl, i);
assert ( pAlbert[i] );
verify ( pAlbert[i] );
}
alTbl.verify ();
alTbl.show (1u);
@@ -276,26 +279,26 @@ int main()
i++;
alTblIter++;
}
assert ( i == elementCount );
verify ( i == elementCount );
alTbl.verify ();
for ( i = 0; i < elementCount; i++ ) {
assert ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) );
verify ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) );
}
alTbl.verify ();
for ( i = 0; i < elementCount; i += 2 ) {
assert ( pAlbert[i] == alTbl.remove ( pAlbert[i]->getId() ) );
verify ( pAlbert[i] == alTbl.remove ( pAlbert[i]->getId() ) );
}
alTbl.verify ();
for ( i = 0; i < elementCount; i += 2 ) {
assert ( 0 == alTbl.lookup ( pAlbert[i]->getId() ) );
verify ( 0 == alTbl.lookup ( pAlbert[i]->getId() ) );
}
alTbl.verify ();
for ( i = 1; i < elementCount; i += 2 ) {
assert ( pAlbert[i] == alTbl.lookup ( pAlbert[i]->getId() ) );
verify ( pAlbert[i] == alTbl.lookup ( pAlbert[i]->getId() ) );
}
alTbl.verify ();

View File

@@ -67,7 +67,8 @@ int main ()
clk = clock ();
for (i=0u; i<LOOPCOUNT; i++) {
assert ( tree.verify(a) );
bool success = tree.verify(a);
assert ( success );
}
diff = clock () - clk;
delay = diff;
@@ -77,13 +78,14 @@ int main ()
clk = clock ();
while ( ( pA = list.get () ) ) {
assert (tree.remove(*pA));
bool success = tree.remove(*pA);
assert ( success );
}
diff = clock () - clk;
delay = diff;
delay = delay/CLOCKS_PER_SEC;
delay = delay/LOOPCOUNT;
printf ("delay = %15.10f\n", delay);
delay = diff;
delay = delay/CLOCKS_PER_SEC;
delay = delay/LOOPCOUNT;
printf ("delay = %15.10f\n", delay);
tree.traverse (&A::show);

View File

@@ -14,6 +14,9 @@
#include "tsBTree.h"
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
class A : public tsBTreeNode<A> {
public:
A(const char *pNameIn) : pName(pNameIn) {}
@@ -57,30 +60,30 @@ int main ()
tree.traverse (&A::show);
assert (tree.remove(a6)==tsbtrrNotFound);
verify (tree.remove(a6)==tsbtrrNotFound);
tree.insert (a6);
assert (tree.remove(a6)==tsbtrrFound);
assert (tree.remove(a5)==tsbtrrFound);
assert (tree.remove(a5)==tsbtrrNotFound);
assert (!tree.verify(a5));
assert (tree.verify(a4));
assert (tree.remove(a0)==tsbtrrFound);
assert (!tree.verify(a0));
assert (tree.remove(a0)==tsbtrrNotFound);
verify (tree.remove(a6)==tsbtrrFound);
verify (tree.remove(a5)==tsbtrrFound);
verify (tree.remove(a5)==tsbtrrNotFound);
verify (!tree.verify(a5));
verify (tree.verify(a4));
verify (tree.remove(a0)==tsbtrrFound);
verify (!tree.verify(a0));
verify (tree.remove(a0)==tsbtrrNotFound);
tree.insert (a5);
assert (tree.verify(a5));
assert (tree.verify(a2));
assert (tree.remove(a2)==tsbtrrFound);
assert (!tree.verify(a2));
assert (tree.remove(a2)==tsbtrrNotFound);
assert (tree.verify(a5));
assert (tree.remove(a5)==tsbtrrFound);
assert (tree.remove(a5)==tsbtrrNotFound);
assert (tree.remove(a0)==tsbtrrNotFound);
assert (tree.remove(a4)==tsbtrrFound);
assert (tree.remove(a3)==tsbtrrFound);
assert (tree.remove(a4)==tsbtrrNotFound);
assert (tree.remove(a1)==tsbtrrFound);
verify (tree.verify(a5));
verify (tree.verify(a2));
verify (tree.remove(a2)==tsbtrrFound);
verify (!tree.verify(a2));
verify (tree.remove(a2)==tsbtrrNotFound);
verify (tree.verify(a5));
verify (tree.remove(a5)==tsbtrrFound);
verify (tree.remove(a5)==tsbtrrNotFound);
verify (tree.remove(a0)==tsbtrrNotFound);
verify (tree.remove(a4)==tsbtrrFound);
verify (tree.remove(a3)==tsbtrrFound);
verify (tree.remove(a4)==tsbtrrNotFound);
verify (tree.remove(a1)==tsbtrrFound);
tree.traverse (&A::show);

View File

@@ -14,6 +14,9 @@
#include <assert.h>
#include <stdio.h>
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
class fred : public tsDLNode<fred> {
public:
fred(const char * const pNameIn) : pName(pNameIn){}
@@ -46,16 +49,16 @@ int main ()
list.add (*pFred);
list.add (*pFredII);
tsDLIter <fred> iter = list.firstIter();
assert (iter.pointer() == pFred);
verify (iter.pointer() == pFred);
iter++;
assert (iter.pointer() == pFredII);
verify (iter.pointer() == pFredII);
list.remove(*pFred);
list.add(*pFred);
pFredBack = list.get();
assert (pFredBack == pFredII);
verify (pFredBack == pFredII);
pFredBack = list.get();
assert (pFredBack == pFred);
assert (list.count() == 0u);
verify (pFredBack == pFred);
verify (list.count() == 0u);
list.add(*pFred);
list.add(*pFredII);
list.add(* new fred("C"));
@@ -70,9 +73,9 @@ int main ()
pJane = new jane("JA");
janeList.add(*pJane);
pJane = new jane("JB");
assert ( janeList.find ( *pJane ) == -1 );
verify ( janeList.find ( *pJane ) == -1 );
janeList.add(*pJane);
assert ( janeList.find ( *pJane ) == 1 );
verify ( janeList.find ( *pJane ) == 1 );
while ( janeFwdIter.valid() ) {
janeFwdIter->show();
@@ -96,21 +99,21 @@ int main ()
i++;
bdIter++;
}
assert ( i == janeList.count () );
verify ( i == janeList.count () );
iter = list.firstIter();
while ( iter.pointer() ) {
list.remove( * iter.pointer() );
iter++;
}
assert(list.count()==0);
verify (list.count()==0);
janeFwdIter = janeList.firstIter();
while ( janeFwdIter.valid() ) {
janeList.remove( * janeFwdIter.pointer() );
janeFwdIter++;
}
assert(janeList.count()==0);
verify (janeList.count()==0);
pJane = new jane("JA");
janeList.add(*pJane);
@@ -121,7 +124,7 @@ int main ()
janeList.remove( * janeBwdIter.pointer() );
janeBwdIter--;
}
assert(janeList.count()==0);
verify (janeList.count()==0);
return 0;
}

View File

@@ -263,11 +263,10 @@ int ellFind (ELLLIST *pList, ELLNODE *pNode)
*
* NOTE: the nodes in the list are free()'d on the assumption that the node
* structures were malloc()'d one-at-a-time and that the ELLNODE structure is
* the first thing in the "rest of" the node structure.
* In other words, this is a pretty worthless function.
* the first member of the parent structure.
*
*****************************************************************************/
void ellFree (ELLLIST *pList, FREEFUNC freeFunc)
void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc)
{
ELLNODE *nnode = pList->node.next;
ELLNODE *pnode;

View File

@@ -45,6 +45,7 @@ typedef void (*FREEFUNC)(void *);
#define ellLast(PLIST) ((PLIST)->node.previous)
#define ellNext(PNODE) ((PNODE)->next)
#define ellPrevious(PNODE) ((PNODE)->previous)
#define ellFree(PLIST) ellFree2(PLIST, free)
epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode);
epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList);
@@ -55,8 +56,7 @@ epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode);
epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum);
epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep);
epicsShareFunc int ellFind (ELLLIST *pList, ELLNODE *pNode);
/* ellFree has to take a free function to work properly on Windows */
epicsShareFunc void ellFree (ELLLIST *pList, FREEFUNC freeFunc);
epicsShareFunc void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc);
epicsShareFunc void ellVerify (ELLLIST *pList);
#ifdef __cplusplus

View File

@@ -3,8 +3,7 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*epicsExit.c*/
@@ -52,7 +51,7 @@ static epicsThreadPrivateId exitPvtPerThread = 0;
static void destroyExitPvt ( exitPvt * pep )
{
ellFree ( &pep->list, free );
ellFree ( &pep->list );
free ( pep );
}

View File

@@ -1,27 +1,24 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsInterrupth
#define epicsInterrupth
/*THIS MAY BE A BIG PROBLEM */
#ifdef __cplusplus
extern "C" {
#endif
#include "shareLib.h"
epicsShareFunc int epicsShareAPI epicsInterruptLock(void);
epicsShareFunc void epicsShareAPI epicsInterruptUnlock(int key);
epicsShareFunc int epicsShareAPI epicsInterruptIsInterruptContext(void);
epicsShareFunc void epicsShareAPI epicsInterruptContextMessage(const char *message);
epicsShareFunc int epicsInterruptLock(void);
epicsShareFunc void epicsInterruptUnlock(int key);
epicsShareFunc int epicsInterruptIsInterruptContext(void);
epicsShareFunc void epicsInterruptContextMessage(const char *message);
#ifdef __cplusplus
}

View File

@@ -9,6 +9,11 @@
#define epicsExportSharedSymbols
#include <epicsMath.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4723)
#endif
static float makeNAN ( void )
{
float a = 0, b = 0;
@@ -25,3 +30,8 @@ extern "C" {
epicsShareDef float epicsNAN = makeNAN();
epicsShareDef float epicsINF = makeINF();
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View File

@@ -128,7 +128,8 @@ void epicsThread::exit ()
void epicsThread::exitWait () throw ()
{
assert ( this->exitWait ( DBL_MAX ) );
bool success = this->exitWait ( DBL_MAX );
assert ( success );
}
bool epicsThread::exitWait ( const double delay ) throw ()

View File

@@ -1,18 +1,15 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osi/default/osdInterrupt.c */
/* Author: Marty Kraimer Date: 15JUL99 */
/* This is a version that does not allow osi calls at interrupt level */
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
@@ -21,34 +18,41 @@
#define epicsExportSharedSymbols
#include "epicsMutex.h"
#include "epicsThread.h"
#include "cantProceed.h"
#include "errlog.h"
#include "epicsInterrupt.h"
static epicsMutexId globalLock=0;
static int firstTime = 1;
epicsShareFunc int epicsShareAPI epicsInterruptLock()
static epicsMutexId globalLock = NULL;
static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT;
static void initOnce(void *junk)
{
if(firstTime) {
globalLock = epicsMutexMustCreate();
firstTime = 0;
}
epicsMutexMustLock(globalLock);
return(0);
globalLock = epicsMutexMustCreate();
}
epicsShareFunc void epicsShareAPI epicsInterruptUnlock(int key)
epicsShareFunc int epicsInterruptLock()
{
if(firstTime) cantProceed(
"epicsInterruptUnlock called before epicsInterruptLock\n");
epicsThreadOnce(&onceId, initOnce, NULL);
epicsMutexMustLock(globalLock);
return 0;
}
epicsShareFunc void epicsInterruptUnlock(int key)
{
if (!globalLock)
cantProceed("epicsInterruptUnlock called before epicsInterruptLock\n");
epicsMutexUnlock(globalLock);
}
epicsShareFunc int epicsShareAPI epicsInterruptIsInterruptContext() { return(0);}
epicsShareFunc void epicsShareAPI epicsInterruptContextMessage(const char *message)
epicsShareFunc int epicsInterruptIsInterruptContext()
{
errlogPrintf("%s",message);
return 0;
}
epicsShareFunc void epicsInterruptContextMessage(const char *message)
{
errlogPrintf("%s", message);
}

View File

@@ -18,6 +18,9 @@
#include "epicsUnitTest.h"
#include "testMain.h"
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
union address {
struct sockaddr_in ia;
struct sockaddr sa;
@@ -73,7 +76,7 @@ circuit::circuit ( SOCKET sockIn ) :
recvWakeup ( false ),
sendWakeup ( false )
{
assert ( this->sock != INVALID_SOCKET );
verify ( this->sock != INVALID_SOCKET );
}
bool circuit::recvWakeupDetected () const
@@ -89,7 +92,7 @@ bool circuit::sendWakeupDetected () const
void circuit::shutdown ()
{
int status = ::shutdown ( this->sock, SHUT_RDWR );
assert ( status == 0 );
verify ( status == 0 );
}
void circuit::signal ()
@@ -141,14 +144,14 @@ clientCircuit::clientCircuit ( const address & addrIn ) :
address tmpAddr = addrIn;
int status = ::connect (
this->sock, & tmpAddr.sa, sizeof ( tmpAddr ) );
assert ( status == 0 );
verify ( status == 0 );
circuit * pCir = this;
this->id = epicsThreadCreate (
"client circuit", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
socketRecvTest, pCir );
assert ( this->id );
verify ( this->id );
}
@@ -166,7 +169,7 @@ server::server ( const address & addrIn ) :
sock ( epicsSocketCreate ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ),
id ( 0 ), exit ( false )
{
assert ( this->sock != INVALID_SOCKET );
verify ( this->sock != INVALID_SOCKET );
// setup server side
address tmpAddr = addrIn;
@@ -177,7 +180,7 @@ server::server ( const address & addrIn ) :
testAbort ( "Stop all CA servers before running this test." );
}
status = listen ( this->sock, 10 );
assert ( status == 0 );
verify ( status == 0 );
}
void server::start ()
@@ -186,7 +189,7 @@ void server::start ()
"server daemon", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
serverDaemon, this );
assert ( this->id );
verify ( this->id );
}
void server::daemon ()
@@ -197,9 +200,9 @@ void server::daemon ()
osiSocklen_t addressSize = sizeof ( addr );
SOCKET ns = accept ( this->sock,
& addr.sa, & addressSize );
assert ( ns != INVALID_SOCKET );
verify ( ns != INVALID_SOCKET );
circuit * pCir = new serverCircuit ( ns );
assert ( pCir );
verify ( pCir );
}
}
@@ -211,7 +214,7 @@ serverCircuit::serverCircuit ( SOCKET sockIn ) :
"server circuit", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
socketRecvTest, pCir );
assert ( threadId );
verify ( threadId );
}
const char * serverCircuit::pName ()
@@ -253,7 +256,7 @@ MAIN(blockingSockTest)
clientCircuit client ( addr );
epicsThreadSleep ( 1.0 );
assert ( ! client.recvWakeupDetected () );
verify ( ! client.recvWakeupDetected () );
client.shutdown ();
epicsThreadSleep ( 1.0 );

View File

@@ -14,6 +14,9 @@
#include "bucketLib.h"
#include "testMain.h"
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
MAIN(buckTest)
{
unsigned id1;
@@ -36,35 +39,35 @@ MAIN(buckTest)
id1 = 0x1000a432;
pValSave1 = "fred";
s = bucketAddItemUnsignedId(pb, &id1, pValSave1);
assert (s == S_bucket_success);
verify (s == S_bucket_success);
pValSave2 = "jane";
id2 = 0x0000a432;
s = bucketAddItemUnsignedId(pb, &id2, pValSave2);
assert (s == S_bucket_success);
verify (s == S_bucket_success);
start = clock();
for(i=0; i<LOOPS; i++){
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id1);
assert(pVal == pValSave1);
verify (pVal == pValSave1);
pVal = bucketLookupItemUnsignedId(pb, &id2);
assert(pVal == pValSave2);
verify (pVal == pValSave2);
}
finish = clock();

View File

@@ -161,7 +161,7 @@ MAIN(epicsEllTest)
testOk1(ellFind(&list2, ellNth(&list2, 10)) == 10);
testOk1(ellFind(&list1, ellNth(&list1, 11)) == 11);
ellFree(&list2, free);
ellFree(&list2);
testOk1(ellCount(&list2) == 0);
pick = (struct myItem *)ellFirst(&list1);
@@ -190,7 +190,7 @@ MAIN(epicsEllTest)
pitem = (struct myItem *)ellNStep(&pitem->node, -4);
testOk1(pitem->num == 7);
ellFree(&list1, free);
ellFree2(&list1, free);
testOk1(ellCount(&list1) == 0);
return testDone();

View File

@@ -26,6 +26,8 @@
#include "epicsUnitTest.h"
#include "testMain.h"
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
static const double delayVerifyOffset = 1.0; // sec
@@ -368,7 +370,7 @@ epicsTimerNotify::expireStatus periodicVerify::expire ( const epicsTime & )
for ( unsigned i = 0u; i < 1000; i++ ) {
root = sqrt ( root );
}
assert ( ! this->cancelCalled );
verify ( ! this->cancelCalled );
double delay = rand ();
delay = delay / RAND_MAX;
delay /= 10.0;

View File

@@ -15,6 +15,9 @@
#include "epicsAssert.h"
#include "cadef.h"
#define verify(exp) ((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
static const unsigned uSecPerSec = 1000000;
typedef struct cbStructCreateDestroyFD {
@@ -38,12 +41,12 @@ void fdCreateDestroyHandler (void *pArg, int fd, int open)
if (open) {
printf ("new fd = %d\n", fd);
status = fdmgr_add_callback (pCBFD->pfdm, fd, fdi_read, fdHandler, pArg);
assert (status==0);
verify (status==0);
}
else {
printf ("terminated fd = %d\n", fd);
status = fdmgr_clear_callback (pCBFD->pfdm, fd, fdi_read);
assert (status==0);
verify (status==0);
}
}
@@ -74,13 +77,13 @@ void testTimer (fdctx *pfdm, double delay)
tmo.tv_sec = (unsigned long) delay;
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
aid = fdmgr_add_timeout (pfdm, &tmo, alarmCB, &cbs);
assert (aid!=fdmgrNoAlarm);
verify (aid!=fdmgrNoAlarm);
while (!cbs.done) {
tmo.tv_sec = (unsigned long) delay;
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
status = fdmgr_pend_event (pfdm, &tmo);
assert (status==0);
verify (status==0);
}
measuredDelay = epicsTimeDiffInSeconds (&cbs.time, &begin);
@@ -98,7 +101,7 @@ int main (int argc, char **argv)
chid chan;
pfdm = fdmgr_init ();
assert (pfdm);
verify (pfdm);
SEVCHK (ca_task_initialize(), NULL);
cbsfd.pfdm = pfdm;
@@ -121,12 +124,12 @@ int main (int argc, char **argv)
tmo.tv_usec = 100000;
cbsfd.trig = 0;
status = fdmgr_pend_event (pfdm, &tmo);
assert (status==0);
verify (status==0);
ca_poll ();
}
status = fdmgr_delete (pfdm);
assert (status==0);
verify (status==0);
printf ( "Test Complete\n" );

View File

@@ -84,11 +84,6 @@ static void do_sel(selRecord *);
static int fetch_values(selRecord *);
static void monitor(selRecord *);
/* This needed to prevent the MS optimizer from barfing */
static double divide(double num, double den) { return num / den; }
static double NaN, Inf;
static long init_record(selRecord *prec, int pass)
{
@@ -98,9 +93,6 @@ static long init_record(selRecord *prec, int pass)
if (pass==0) return(0);
NaN = divide(0.0, 0.0);
Inf = divide(1.0, 0.0);
/* get seln initial value if nvl is a constant*/
if (prec->nvl.type == CONSTANT ) {
recGblInitConstantLink(&prec->nvl,DBF_USHORT,&prec->seln);
@@ -109,7 +101,7 @@ static long init_record(selRecord *prec, int pass)
plink = &prec->inpa;
pvalue = &prec->a;
for(i=0; i<SEL_MAX; i++, plink++, pvalue++) {
*pvalue = NaN;
*pvalue = epicsNAN;
if (plink->type==CONSTANT) {
recGblInitConstantLink(plink,DBF_DOUBLE,pvalue);
}
@@ -365,7 +357,7 @@ static void do_sel(selRecord *prec)
val = *(pvalue+prec->seln);
break;
case (selSELM_High_Signal):
val = -Inf;
val = -epicsINF;
for (i = 0; i < SEL_MAX; i++,pvalue++){
if (!isnan(*pvalue) && val < *pvalue) {
val = *pvalue;
@@ -374,7 +366,7 @@ static void do_sel(selRecord *prec)
}
break;
case (selSELM_Low_Signal):
val = Inf;
val = epicsINF;
for (i = 0; i < SEL_MAX; i++,pvalue++){
if (!isnan(*pvalue) && val > *pvalue) {
val = *pvalue;
@@ -384,7 +376,7 @@ static void do_sel(selRecord *prec)
break;
case (selSELM_Median_Signal):
count = 0;
order[0] = NaN;
order[0] = epicsNAN;
for (i = 0; i < SEL_MAX; i++,pvalue++){
if (!isnan(*pvalue)){
/* Insertion sort */