32 #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" 63 static const double timeoutToPendIO = 1e20;
65 #define verify(exp) ((exp) ? (void)0 : \ 66 epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor)) 71 if ( interestLevel > 0 ) {
72 if ( interestLevel > 1 ) {
73 printf (
"%s ", pTestName );
83 if ( interestLevel > 0 ) {
85 if ( interestLevel > 1 ) {
90 printf (
" %f sec\n", delay );
100 if ( interestLevel > 0 ) {
109 unsigned *pCtr = (
unsigned *) args.
usr;
113 printf (
"subscription update failed for \"%s\" because \"%s\"",
123 unsigned eventCount = 0u;
124 unsigned waitCount = 0u;
140 while ( eventCount < 1 && waitCount++ < 100 ) {
146 verify ( eventCount > 0 );
160 if ( delta <= 0.0 ) {
164 currentVal.
value += delta;
167 currentVal.
value -= delta;
174 while ( eventCount < 1 && waitCount++ < 100 ) {
180 verify ( eventCount > 0 );
200 while ( eventCount < 1 && waitCount++ < 100 ) {
206 verify ( eventCount > 0 );
217 if ( delta <= 0.0 ) {
221 currentVal.
value += delta;
224 currentVal.
value -= delta;
231 while ( eventCount < 1 && waitCount++ < 100 ) {
237 verify ( eventCount > 0 );
249 unsigned *pCtr = (
unsigned *) args.
usr;
253 printf(
"get call back failed for \"%s\" because \"%s\"",
266 printf (
"subscription update failed for \"%s\" because \"%s\"",
274 unsigned eventCount = 0u;
275 unsigned waitCount = 0u;
289 while ( eventCount < 1 && waitCount++ < 100 ) {
295 verify ( eventCount > 0 );
320 printf (
"getCallbackStateChange abnormal status was \"%s\"\n",
366 verify ( pChan->connected );
369 pChan->subscriptionUpdateCount++;
376 printf (
"noopSubscriptionStateChange: subscription update failed for \"%s\" because \"%s\"",
400 unsigned repetitionCount,
unsigned interestLevel )
407 for ( i = 0; i < repetitionCount; i++ ) {
413 for ( j = 0u; j < chanCount; j++ ) {
448 for ( j = 0u; j < chanCount; j++ ) {
452 printf (
"Unusual connection activity count = %u on channel %s?\n",
457 printf (
"Unusual access rights activity count = %u on channel %s?\n",
466 for ( j = 0u; j < chanCount; j += 2 ) {
475 for ( j = 0u; j < chanCount; j++ ) {
481 for ( j = 0u; j < chanCount; j++ ) {
516 unsigned repetitionCount,
unsigned interestLevel )
520 unsigned connections;
526 while ( backgroundConnCount > 1u ) {
534 for ( i = 0; i < repetitionCount; i++ ) {
536 for ( j = 0u; j < chanCount; j++ ) {
563 for ( j = 0u; j < chanCount; j += 2 ) {
568 for ( j = 0u; j < chanCount; j += 2 ) {
573 for ( j = 0u; j < chanCount; j += 2 ) {
578 for ( j = 0u; j < chanCount; j += 2 ) {
593 verify ( connections == backgroundConnCount );
595 for ( j = 0u; j < chanCount; j++ ) {
624 for ( j = 0u; j < chanCount; j++ ) {
629 for ( j = 0u; j < chanCount; j++ ) {
703 status =
ca_search ( pChans[0].name, &pChans[0].channel );
731 SEVCHK (status,
"DBR_GR_ENUM ca_get()");
738 printf (
"Enum state str = {");
739 count = (unsigned) ge.
no_str;
740 for (i=0; i<count; i++) {
756 double slice = 3.14159 / nElem;
763 printf (
"skipped ctrl dbl test - no write access\n");
768 printf (
"skipped ctrl dbl test - not an analog type\n");
775 pDbl = malloc (size);
781 for (i=0; i<nElem; i++) {
782 pDbl[
i] = sin (i*slice);
791 SEVCHK (status,
"ctrlDoubleTest, ca_array_put");
803 SEVCHK (status,
"ctrlDoubleTest, ca_array_get");
810 for (i=0; i<nElem; i++) {
811 double diff = pDbl[
i] - sin (i*slice);
812 verify (fabs(diff) < DBL_EPSILON*4);
840 "short tmo get block test failed - val written %d\n", req );
842 "short tmo tmo get block test failed - val read %d\n", resp );
846 else if ( resp != -100 ) {
847 printf (
"CA didnt block for get to return?\n" );
857 "long tmo get block test failed - val written %d\n", req);
859 "long tmo get block test failed - val read %d\n", resp);
865 printf (
"skipped pend IO block test - no read access\n");
881 for ( i=0; i < iterations; i++ ) {
889 if ( fabs ( fval - fretval ) > epsilon ) {
890 printf (
"float test failed val written %f\n", fval );
891 printf (
"float test failed val read %f\n", fretval );
911 for ( i = 0; i < iterations; i++ ) {
919 if ( fabs ( fval - fretval ) > epsilon ) {
920 printf (
"double test failed val written %f\n", fval );
921 printf (
"double test failed val read %f\n", fretval );
933 int minExp,
int maxExp,
double epsilon,
unsigned interestLevel )
943 printf (
"skipped analog test - no write access\n");
948 printf (
"skipped analog test - not an analog type\n");
954 epsil = epsilon * 4.0;
956 for ( i = minExp; i <= maxExp; i += maxExp / 10 ) {
957 incr = ldexp ( 0.5, i );
958 if ( fabs (incr) > max /10.0 ) {
959 iter = ( unsigned ) ( max / fabs (incr) );
977 for ( i = minExp; i <= maxExp; i += maxExp / 10 ) {
978 incr = - ldexp ( 0.5, i );
979 if ( fabs (incr) > max / 10.0 ) {
980 iter = (unsigned) ( max / fabs (incr) );
998 for ( i = minExp; i <= maxExp; i += maxExp / 10 ) {
999 incr = ldexp ( 0.5, i );
1000 if ( fabs (incr) > max / 10.0 ) {
1001 iter = (unsigned) ( max / fabs ( incr ) );
1037 SEVCHK ( status,
"control long fetch failed\n" );
1039 SEVCHK ( status,
"control long pend failed\n" );
1054 SEVCHK ( status,
"get pend failed\n" );
1060 printf (
"strange limits configured for channel \"%s\"\n",
ca_name (chan) );
1080 SEVCHK ( status,
"control short fetch failed\n" );
1082 SEVCHK ( status,
"control short pend failed\n" );
1099 SEVCHK ( status,
"get pend failed\n" );
1105 printf (
"Strange limits configured for channel \"%s\"\n",
ca_name (chan) );
1121 for ( i=0; i<10000; i++ ) {
1130 printf (
"Skipped highthroughput read test - no read access\n" );
1141 for ( i=0; i<10000; i++ ) {
1150 printf(
"Skipped multiple put test - no write access\n");
1164 unsigned count = 0u;
1166 for ( i=0; i<10000; i++ ) {
1172 while ( count < 10000u ) {
1179 printf (
"Skipped multiple get cb test - no read access\n" );
1193 unsigned count = 0u;
1196 for ( i=0; i<10000; i++ ) {
1207 "verifyHighThroughputWriteCallback, verification get" );
1210 "verifyHighThroughputWriteCallback, verification get pend" );
1215 printf (
"Skipped multiple put cb test - no write access\n" );
1230 memset (stimStr,
'a',
sizeof (stimStr) );
1233 sprintf ( stimStr,
"%u", 8u );
1240 if ( strcmp ( stimStr, respStr ) ) {
1242 "Test fails if stim \"%s\" isnt roughly equiv to resp \"%s\"\n",
1248 printf (
"Skipped bad string test - no write access\n" );
1262 for ( i=0; i < 1000; i++ ) {
1287 printf (
"skipping sync group test - server is on wrong version\n" );
1305 SEVCHK ( status,
"SYNC GRP2" );
1307 SEVCHK ( status,
"SYNC GRP1" );
1309 SEVCHK ( status,
"SYNC GRP1" );
1311 SEVCHK ( status,
"SYNC GRP2" );
1321 SEVCHK ( status,
"SYNC GRP1" );
1323 SEVCHK ( status,
"SYNC GRP2" );
1332 #define multiSubscrDestroyNoLateCallbackEventCount 500 1363 static void multiSubscrDestroyNoLateCallbackThread (
void * pParm )
1376 SEVCHK ( status,
"multiSubscrDestroyLateNoCallbackTest: channel connect failed" );
1382 for ( i=0; i < 10000; i++ ) {
1383 unsigned int priorityOfTestThread;
1435 if ( i % 1000 == 0 ) {
1451 static void multiSubscrDestroyNoLateCallbackTest (
const char *pName,
unsigned interestLevel )
1464 "multiSubscrDestroyNoLateCallbackTest",
1467 multiSubscrDestroyNoLateCallbackThread,
1496 unsigned count = 0u;
1505 &count, &mid[i]) ,
NULL );
1572 unsigned count = 0u;
1579 for ( i=0; i < 1000; i++ ){
1582 &count, &sid) ,
NULL );
1584 if ( i % 100 == 0 ) {
1606 "singleSubscriptionDeleteTest - one of multiple puts" );
1625 unsigned count = 0u;
1632 for ( i=0; i < 1000; i++ ) {
1638 SEVCHK ( status,
"channelClearWithEventTrafficTest: channel connect failed" );
1643 &count, &sid ) ,
NULL );
1688 evid monix1, monix2, monix3;
1726 0, &globalEventID );
1733 acctstExceptionCount++;
1736 static unsigned arrayEventExceptionNotifyComplete = 0;
1741 "arrayEventExceptionNotify: expected " 1742 "exception but didnt receive one against \"%s\" \n",
1746 arrayEventExceptionNotifyComplete = 1;
1762 acctstExceptionCount = 0u;
1764 SEVCHK ( status,
"exception notify install failed" );
1770 SEVCHK ( status,
"array read request failed" );
1774 while ( acctstExceptionCount < 1u ) {
1781 SEVCHK ( status,
"exception notify install failed" );
1789 arrayEventExceptionNotifyComplete = 0u;
1794 arrayEventExceptionNotifyComplete = 1;
1799 while ( ! arrayEventExceptionNotifyComplete ) {
1813 arrayEventExceptionNotifyComplete = 0u;
1818 arrayEventExceptionNotifyComplete = 1;
1823 while ( ! arrayEventExceptionNotifyComplete ) {
1830 SEVCHK ( status,
"subscription clear failed" );
1840 acctstExceptionCount = 0u;
1842 SEVCHK ( status,
"exception notify install failed" );
1847 strcpy ( pWS[i],
"@#$%" );
1850 ca_element_count (chan), chan, pWS );
1853 acctstExceptionCount++;
1858 while ( acctstExceptionCount < 1u ) {
1865 SEVCHK ( status,
"exception notify install failed" );
1879 strcpy ( pWS[i],
"@#$%" );
1881 arrayEventExceptionNotifyComplete = 0u;
1883 ca_element_count (chan), chan, pWS,
1886 arrayEventExceptionNotifyComplete = 1;
1891 while ( ! arrayEventExceptionNotifyComplete ) {
1909 static unsigned arrayReadNotifyComplete = 0;
1910 static unsigned arrayWriteNotifyComplete = 0;
1916 for ( i = 0; i < args.
count; i++ ) {
1917 verify ( pWF[i] == pRF[i] );
1919 arrayReadNotifyComplete = 1;
1924 arrayWriteNotifyComplete = 1;
1927 printf (
"arrayWriteNotify: update failed for \"%s\" because \"%s\"",
1940 printf (
"skipping array test - no write access\n" );
1961 SEVCHK ( status,
"array write request failed" );
1968 SEVCHK ( status,
"array read request failed" );
1970 SEVCHK ( status,
"array read failed" );
1976 if ( pWF[i] != pRF[i] ) {
1977 printf (
"i=%u, pWF[i]=%f, pRF[i]=%f\n",
1980 verify ( pWF[i] == pRF[i] );
1990 if ( size <= maxArrayBytes ) {
1995 ca_element_count (chan), chan, pRS );
1996 SEVCHK ( status,
"array read request failed" );
1998 SEVCHK ( status,
"array read failed" );
2002 printf (
"skipping the fetch array in string data type test - does not fit\n" );
2015 SEVCHK ( status,
"array write notify request failed" );
2018 SEVCHK ( status,
"array read notify request failed" );
2020 while ( ! arrayWriteNotifyComplete || ! arrayReadNotifyComplete ) {
2032 arrayReadNotifyComplete = 0;
2035 SEVCHK ( status,
"array write notify request failed" );
2038 SEVCHK ( status,
"array subscription request failed" );
2040 while ( ! arrayReadNotifyComplete ) {
2045 SEVCHK ( status,
"clear event request failed" );
2052 acctstExceptionCount = 0u;
2054 SEVCHK ( status,
"exception notify install failed" );
2056 ca_element_count (chan)+1, chan, pRF );
2059 while ( acctstExceptionCount < 1u ) {
2070 SEVCHK ( status,
"exception notify install failed" );
2088 unsigned connections;
2096 verify ( connections == 0u );
2106 printf (
"skipping unequal buffer size test - no write access\n" );
2169 accuracy = 100.0*(delay-
request)/request;
2170 printf (
"CA pend event delay = %f sec results in error = %f %%\n",
2171 request, accuracy );
2172 verify ( fabs(accuracy) < 10.0 );
2234 return ( (
float) iter ) * 10.12345f + 10.7f;
2241 SEVCHK ( status,
"clearChannelInXxxxCallbackTest clear channel" );
2258 SEVCHK ( status,
"clearChannelInGetCallbackTest create channel" );
2261 SEVCHK ( status,
"clearChannelInGetCallbackTest connect channel" );
2264 SEVCHK ( status,
"clearChannelInGetCallbackTest get callback" );
2289 SEVCHK ( status,
"clearChannelInPutCallbackTest create channel" );
2292 SEVCHK ( status,
"clearChannelInPutCallbackTest connect channel" );
2296 SEVCHK ( status,
"clearChannelInPutCallbackTest get callback" );
2320 SEVCHK ( status,
"clearChannelInSubscrCallbackTest create channel" );
2323 SEVCHK ( status,
"clearChannelInSubscrCallbackTest connect channel" );
2327 SEVCHK ( status,
"clearChannelInSubscrCallbackTest subscribe" );
2340 unsigned * pEventCount = (
unsigned * )
ca_puser ( args.
chid );
2342 verify ( *pEventCount == 0u );
2346 SEVCHK ( status,
"monitorAddConnectionCallback create subscription" );
2349 fprintf (
stderr,
"disconnect during monitorAddConnectionCallbackTest?\n" );
2364 unsigned eventCount = 0u;
2376 SEVCHK ( status,
"monitorAddConnectionCallbackTest create channel" );
2378 while ( eventCount < 2 ) {
2381 verify ( eventCount >= 2u );
2384 SEVCHK ( status,
"monitorAddConnectionCallback get callback" );
2385 while ( getCallbackCount == 0 ) {
2388 verify ( eventCount >= 2u );
2389 verify ( getCallbackCount == 1u );
2392 SEVCHK ( status,
"monitorAddConnectionCallbackTest clear channel" );
2395 SEVCHK ( status,
"monitorAddConnectionCallbackTest flush" );
2413 unsigned flowCtrlCount = 0u;
2414 unsigned prevPassCount;
2418 printf (
"skipped monitorUpdateTest test - no write access\n");
2423 printf (
"skipped monitorUpdateTest test - not an analog type\n");
2435 for ( i = 0; i <
NELEMENTS(test); i++ ) {
2439 &test[i], &test[i].
id),
NULL);
2460 unsigned nFailed = 0u;
2463 for ( i = 0; i <
NELEMENTS ( test ); i++ ) {
2464 if ( test[i].count > 0 ) {
2465 if ( test[i].lastValue != temp ) {
2473 if ( nFailed == 0u ) {
2488 for ( i = 0; i < 10; i++ ) {
2489 for ( j = 0; j <
NELEMENTS(test); j++ ) {
2494 &test[j], &test[j].
id ) ,
NULL );
2497 for ( j = 0; j <=
i; j++ ) {
2509 if ( getResp != temp ) {
2510 printf (
"getResp=%f, temp=%f\n", getResp, temp );
2511 verify ( getResp == temp );
2519 unsigned passCount = 0;
2520 unsigned tmpFlowCtrlCount = 0u;
2523 for ( j = 0; j <
NELEMENTS ( test ); j++ ) {
2528 verify ( test[j].count <= i + 2 );
2529 if ( test[j].lastValue == temp ) {
2530 if ( test[j].count < i + 1 ) {
2536 if ( passCount == NELEMENTS ( test ) ) {
2537 flowCtrlCount += tmpFlowCtrlCount;
2540 if ( passCount == prevPassCount ) {
2541 verify ( tries++ < 500 );
2542 if ( tries % 50 == 0 ) {
2543 for ( j = 0; j <=
i; j++ ) {
2545 if ( pat == test[0].lastValue ) {
2558 prevPassCount = passCount;
2567 for ( i = 0; i <
NELEMENTS ( test ); i++ ) {
2586 double beaconPeriod;
2587 double watchDogDelay;
2593 printf (
"Beacon anomalies detected since program start %u\n",
2597 printf (
"Estimated beacon period for channel %s = %g sec.\n",
2598 ca_name ( chan ), beaconPeriod );
2601 verify ( watchDogDelay >= 0.0 );
2603 printf (
"busy: receive watchdog for \"%s\" expires in %g sec.\n",
2604 ca_name ( chan ), watchDogDelay );
2610 for ( i = 0u; i < 15u; i++ ) {
2614 if ( interestLevel > 0 ) {
2619 verify ( watchDogDelay >= 0.0 );
2621 printf (
"inactive: receive watchdog for \"%s\" expires in %g sec.\n",
2622 ca_name ( chan ), watchDogDelay );
2637 status =
ca_pend ( 100000.0, 1 );
2639 status =
ca_pend ( 1e-12, 0 );
2661 SEVCHK ( status,
"fetch of dbr time double failed\n" );
2666 SEVCHK ( status,
"fetch of dbr time double failed\n" );
2671 "%a %b %d %Y %H:%M:%S.%f", & first.
stamp );
2673 printf (
"Processing time of channel \"%s\" was \"%s\"\n",
2677 printf (
"Time difference between two successive reads was %g sec\n",
2681 printf (
"Time difference between client and server %g sec\n",
2693 static const unsigned nPrio = 30;
2698 for ( i = 0u; i < nPrio; i++ ) {
2702 unsigned priority0, priority1;
2717 priority0, &chan0 );
2718 SEVCHK ( status,
"prioritized channel create failed" );
2721 priority1, &chan1 );
2722 SEVCHK ( status,
"prioritized channel create failed" );
2725 SEVCHK ( status,
"prioritized channel connect failed" );
2730 SEVCHK ( status,
"prioritized channel put failed" );
2732 SEVCHK ( status,
"prioritized channel put failed" );
2735 SEVCHK ( status,
"prioritized channel flush failed" );
2738 SEVCHK ( status,
"prioritized channel get failed" );
2740 SEVCHK ( status,
"prioritized channel get failed" );
2743 SEVCHK ( status,
"prioritized channel pend io failed" );
2746 SEVCHK ( status,
"prioritized channel clear failed" );
2748 SEVCHK ( status,
"prioritized channel clear failed" );
2756 unsigned interestLevel )
2758 static const unsigned chanCount = 20;
2759 static const unsigned loopCount = 100;
2761 chid *
const pChans = (
chid *
const) calloc ( chanCount,
sizeof ( *pChans ) );
2762 double *
const pValues = (
double *
const) calloc ( chanCount,
sizeof ( *pValues ) );
2765 verify ( pChans && pValues );
2769 for ( i = 0u; i < loopCount; i++ ) {
2773 for ( j = 0; j < chanCount; j++ ) {
2775 SEVCHK ( status,
"immediate tear down channel create failed" );
2778 SEVCHK ( status,
"immediate tear down channel connect failed" );
2781 for ( j = 0; j < chanCount; j++ ) {
2783 SEVCHK ( status,
"immediate tear down channel get failed" );
2787 SEVCHK ( status,
"immediate tear down get pend io failed" );
2803 unsigned interestLevel )
2809 for ( i = 0u; i < 100; i++ ) {
2816 SEVCHK ( status,
"immediate tear down channel create failed" );
2818 SEVCHK ( status,
"immediate tear down channel connect failed" );
2827 SEVCHK ( status,
"immediate tear down channel get failed" );
2829 SEVCHK ( status,
"immediate tear down channel get failed" );
2830 if ( currentValue != ( (i - 1) % 8 ) ) {
2831 printf (
"currentValue = %i, i = %i\n", currentValue, i );
2832 verify ( currentValue == ( (i - 1) % 8 ) );
2836 SEVCHK ( status,
"immediate tear down channel put failed" );
2838 SEVCHK ( status,
"immediate tear down channel clear failed" );
2841 if ( i % 10 == 0 ) {
2883 char m_chanName[100u];
2896 static void testMultithreadSubscrSubscrCallback
2903 static void testMultithreadSubscrCreateSubscr (
void * pParm )
2905 static unsigned nElem = 0;
2906 int testComplete =
FALSE;
2917 verify ( firstUpdateEvent );
2921 pMultiThreadSubscrTest->
m_chan,
2923 testMultithreadSubscrSubscrCallback,
2931 firstUpdateEvent, 60.0 * 10 );
2942 if ( testComplete ) {
2957 char threadname[64];
2959 sprintf(threadname,
"testSubscr%06u", i);
2963 testMultithreadSubscrCreateSubscr,
2964 pMultiThreadSubscrTest );
2985 pMultiThreadSubscrTest,
2987 & pMultiThreadSubscrTest->
m_chan );
2994 int success =
FALSE;
3006 if ( i++ % 100 == 0u )
3024 static unsigned nSubscr = 3000;
3029 verify ( pMultiThreadSubscrTest);
3038 strncpy ( pMultiThreadSubscrTest->
m_chanName, pName,
3039 sizeof ( pMultiThreadSubscrTest->
m_chanName ) );
3041 [
sizeof ( pMultiThreadSubscrTest->
m_chanName ) - 1u ] =
'\0';
3045 "testMultithreadSubscr",
3059 free ( pMultiThreadSubscrTest );
3069 unsigned eventCount = 0u;
3099 while ( eventCount < 1 ) {
3125 if ( delay >= 1.0 ) {
3128 verify ( eventCount++ < 100 );
3146 const char *pName,
unsigned interestLevel )
3149 chid bogusChan[300];
3155 for ( i= 0u; i <
NELEMENTS ( bogusChan ); i++ ) {
3157 sprintf ( buf,
"aChannelThatShouldNeverNeverNeverExist%u", i );
3166 for ( i= 0u; i < 10; i++ ) {
3186 for ( i= 0u; i <
NELEMENTS ( bogusChan ); i++ ) {
3200 *pDisconnectFlag = 1;
3209 const char * pName,
unsigned interestLevel )
3211 int disconnectFlag = 0;
3219 & disconnectFlag, 0, & chan0 );
3222 fprintf (
stdout,
"Waiting for test channel to connect." );
3226 if ( count++%50 == 0 ) {
3231 fprintf (
stdout,
"confirmed.\n" );
3247 fprintf (
stdout,
"Please force test channel to disconnect." );
3251 if ( count++%50 == 0 ) {
3255 }
while ( ! disconnectFlag );
3256 fprintf (
stdout,
"confirmed.\n" );
3260 pName, 0, 0, 0, & chan1 );
3263 fprintf (
stdout,
"Waiting for test channel to connect." );
3272 fprintf (
stdout,
"confirmed.\n" );
3279 const char * pName,
unsigned interestLevel )
3283 pName, 0, 0, 0, & chan );
3285 if ( strcmp ( pName,
ca_name ( chan ) ) != 0 ) {
3286 printf (
"Canonical name for channel was \"%s\"\n",
ca_name ( chan ) );
3298 for ( i=0u; i < 1000; i++ ) {
3305 SEVCHK ( status,
"context create failed" );
3316 SEVCHK ( status,
"channel connect failed" );
3319 SEVCHK ( status,
"channel put failed" );
3332 SEVCHK ( status,
"context create failed" );
3342 SEVCHK ( status,
"channel connect failed" );
3345 SEVCHK ( status,
"channel get failed" );
3348 SEVCHK ( status,
"get, pend io failed" );
3358 if ( i % 100 == 0 ) {
3367 const char * pName,
unsigned interestLevel )
3376 SEVCHK ( status,
"context create failed" );
3378 for ( i = 0; i <
NELEMENTS ( chan ); i++ ) {
3391 SEVCHK ( status,
"channel connect failed" );
3398 int acctst (
const char * pName,
unsigned interestLevel,
unsigned channelCount,
3405 unsigned connections;
3406 unsigned maxArrayBytes = 10000000;
3408 printf (
"CA Client V%s, channel name \"%s\", timeout %g\n",
3411 printf (
"Preemptive call back is enabled.\n" );
3416 sprintf ( tmpString,
"%u", maxArrayBytes );
3417 epicsEnvSet (
"EPICS_CA_MAX_ARRAY_BYTES", tmpString );
3423 multiSubscrDestroyNoLateCallbackTest ( pName, interestLevel );
3435 verify ( connections == 0u );
3449 printf (
"native type was %s, native count was %lu\n",
3454 verify ( connections == 1u || connections == 0u );
3455 if ( connections == 0u ) {
3456 printf (
"testing with a local channel\n" );
3467 arrayTest ( chan, maxArrayBytes, interestLevel );
3473 FLT_MIN_EXP, FLT_MAX_EXP, FLT_EPSILON, interestLevel );
3475 DBL_MIN_EXP, DBL_MAX_EXP, DBL_EPSILON, interestLevel );
3506 pChans = calloc ( channelCount,
sizeof ( *pChans ) );
3509 for ( i = 0; i < channelCount; i++ ) {
3510 strncpy ( pChans[ i ].
name, pName,
sizeof ( pChans[ i ].name ) );
3511 pChans[
i ].
name[
sizeof ( pChans[
i].
name ) - 1 ] =
'\0';
3548 printf (
"\nTest Complete\n" );
void verifyDataTypeMacros(void)
LIBCA_API int epicsStdCall ca_replace_access_rights_event(chid chan, caArh *pfunc)
void ctrlDoubleTest(chid chan, unsigned interestLevel)
void arrayReadNotify(struct event_handler_args args)
void noopSubscriptionStateChange(struct event_handler_args args)
void verifyClear(appChan *pChans, unsigned interestLevel)
LIBCOM_API void epicsEventMustTrigger(epicsEventId id)
Trigger an event.
void monitorAddConnectionCallback(struct connection_handler_args args)
int epicsStdCall ca_task_exit()
void noopExceptionCallback(struct exception_handler_args args)
void verifyClearChannelOnDisconnectCallback(struct connection_handler_args args)
epicsThreadId epicsStdCall epicsThreadMustCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
void nUpdatesTester(struct event_handler_args args)
LIBCOM_API int epicsStdCall fdmgr_pend_event(fdctx *pfdctx, struct timeval *ptimeout)
LIBCA_API int epicsStdCall ca_array_get_callback(chtype type, unsigned long count, chid chanId, caEventCallBackFunc *pFunc, void *pArg)
dbr_long_t upper_ctrl_limit
LIBCA_API unsigned epicsStdCall ca_write_access(chid chan)
struct epicsEventOSD * epicsEventId
An identifier for an epicsEvent for use with the C API.
#define dbf_type_to_DBR_STS(type)
LIBCA_API int epicsStdCall ca_v42_ok(chid chan)
void verifyName(const char *pName, unsigned interestLevel)
#define dbf_type_to_text(type)
#define multiSubscrDestroyNoLateCallbackEventCount
unsigned epicsStdCall ca_beacon_anomaly_count()
#define CA_PRIORITY_DEFAULT
void epicsStdCall epicsMutexDestroy(epicsMutexId pmutexNode)
Destroy an epicsMutex semaphore.
void monitorAddConnectionCallbackTest(const char *pName, unsigned interestLevel)
#define epicsThreadPriorityMedium
An EPICS-specific replacement for ANSI C's assert.
void monitorUpdateTest(chid chan, unsigned interestLevel)
void ioTesterEvent(struct event_handler_args args)
void singleSubscriptionDeleteTest(chid chan, unsigned interestLevel)
void monitorSubscriptionFirstUpdateTest(const char *pName, chid chan, unsigned interestLevel)
void verifyContextRundownFlush(const char *pName, unsigned interestLevel)
void verifyBlockingConnect(appChan *pChans, unsigned chanCount, unsigned repetitionCount, unsigned interestLevel)
size_t m_nUpdatesRequired
void clearChannelInPutCallbackTest(const char *pName, unsigned level)
void caTaskExitTest(unsigned interestLevel)
ca_preemptive_callback_select
unsigned acctstExceptionCount
LIBCA_API int epicsStdCall ca_array_put_callback(chtype type, unsigned long count, chid chanId, const void *pValue, caEventCallBackFunc *pFunc, void *pArg)
int epicsStdCall ca_create_channel(const char *name_str, caCh *conn_func, void *puser, capri priority, chid *chanptr)
void clearChannelInGetCallbackTest(const char *pName, unsigned level)
void verifyContextRundownChanStillExist(const char *pName, unsigned interestLevel)
void verifyShortIO(chid chan, unsigned interestLevel)
LIBCA_API unsigned long epicsStdCall ca_element_count(chid chan)
LIBCA_API enum channel_state epicsStdCall ca_state(chid chan)
int epicsStdCall ca_search_and_connect(const char *name_str, chid *chanptr, caCh *conn_func, void *puser)
dbr_long_t lower_ctrl_limit
void epicsStdCall ca_self_test()
struct ca_client_context * m_pCtx
void arrayTest(chid chan, unsigned maxArrayBytes, unsigned interestLevel)
void showProgressBegin(const char *pTestName, unsigned interestLevel)
Routines to get and set EPICS environment parameters.
void floatTest(chid chan, dbr_float_t beginValue, dbr_float_t increment, dbr_float_t epsilon, unsigned iterations)
void verifyHighThroughputWriteCallback(chid chan, unsigned interestLevel)
void showProgressEnd(unsigned interestLevel)
void acctstExceptionNotify(struct exception_handler_args args)
int epicsStdCall ca_pend_io(ca_real timeout)
unsigned epicsStdCall ca_get_ioc_connection_count()
pvd::StructureConstPtr type
size_t m_nUpdatesReceived
#define INVALID_DB_REQ(x)
LIBCA_API void *epicsStdCall ca_puser(chid chan)
#define epicsMutexMustCreate()
Create an epicsMutex semaphore for use from C code.
#define dbf_type_to_DBR(type)
void callbackClearsChannel(struct event_handler_args args)
void grEnumTest(chid chan, unsigned interestLevel)
unsigned connectionUpdateCount
LIBCA_API int epicsStdCall ca_sg_array_put(const CA_SYNC_GID gid, chtype type, unsigned long count, chid chan, const void *pValue)
void verifyTimeStamps(chid chan, unsigned interestLevel)
LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout(epicsEventId id, double timeOut)
Wait an the event or until the specified timeout period is over.
void channelClearWithEventTrafficTest(const char *pName, unsigned interestLevel)
#define dbr_type_is_SHORT(type)
int epicsStdCall ca_attach_context(struct ca_client_context *pCtx)
LIBCOM_API epicsEventId epicsEventMustCreate(epicsEventInitialState initialState)
Create an epicsEvent for use from C code.
void test_sync_groups(chid chan, unsigned interestLevel)
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
void multiSubscriptionDeleteTest(chid chan, unsigned interestLevel)
void getCallbackStateChange(struct event_handler_args args)
Miscellaneous macro definitions.
LIBCA_API int epicsStdCall ca_sg_delete(const CA_SYNC_GID gid)
LIBCA_API short epicsStdCall ca_field_type(chid chan)
LIBCA_API int epicsStdCall ca_change_connection_event(chid chan, caCh *pfunc)
#define dbr_type_is_valid(type)
#define ca_put(type, chan, pValue)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
LIBCOM_API void epicsEventMustWait(epicsEventId id)
Wait for an event (see epicsEventWait()).
LIBCOM_API int epicsStdCall fdmgr_delete(fdctx *pfdctx)
LIBCA_API int epicsStdCall ca_sg_create(CA_SYNC_GID *pgid)
void arrayEventExceptionNotify(struct event_handler_args args)
int epicsStdCall ca_client_status(unsigned level)
void verifyTearDownWhenChannelConnected(const char *pName, enum ca_preemptive_callback_select select, unsigned interestLevel)
LIBCOM_API void epicsStdCall epicsEnvSet(const char *name, const char *value)
Set an environment variable's value.
epicsThreadId epicsStdCall epicsThreadCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
dbr_short_t lower_ctrl_limit
void fdManagerVerify(const char *pName, unsigned interestLevel)
#define dbf_type_to_DBR_GR(type)
unsigned subscriptionUpdateCount
#define dbr_type_to_text(type)
#define DBR_STSACK_STRING
#define ca_put_callback(type, chan, pValue, pFunc, pArg)
dbr_float_t monitorUpdateTestPattern(unsigned iter)
void multiple_sg_requests(chid chix, CA_SYNC_GID gid)
void verifyBadString(chid chan, unsigned interestLevel)
int epicsStdCall ca_context_create(ca_preemptive_callback_select premptiveCallbackSelect)
int epicsStdCall ca_pend_event(ca_real timeout)
dbr_double_t upper_ctrl_limit
void unequalServerBufferSizeTest(const char *pName, unsigned interestLevel)
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime(char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
Convert epicsTimeStamp to string. See epicsTime::strftime()
#define dbf_text_to_type(text, type)
struct MultiSubscrDestroyNoLateCallbackTestData * m_pTestData
#define dbr_text_to_type(text, type)
dbr_short_t upper_ctrl_limit
#define ca_add_array_event(TYPE, COUNT, CHID, ENTRY, ARG, P_DELTA, N_DELTA, TO, EVID)
void verifyAnalogIO(chid chan, int dataType, double min, double max, int minExp, int maxExp, double epsilon, unsigned interestLevel)
void pend_event_delay_test(dbr_double_t request)
void verifyImmediateTearDown(const char *pName, enum ca_preemptive_callback_select select, unsigned interestLevel)
#define epicsEventSignal(ID)
A synonym for epicsEventTrigger().
void showProgress(unsigned interestLevel)
void eventClearAndMultipleMonitorTest(chid chan, unsigned interestLevel)
LIBCA_API int epicsStdCall ca_array_put(chtype type, unsigned long count, chid chanId, const void *pValue)
APIs for the epicsMutex mutual exclusion semaphore.
int epicsStdCall ca_add_exception_event(caExceptionHandler *pfunc, void *arg)
int epicsStdCall ca_flush_io()
#define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING)
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
int epicsStdCall ca_pend(ca_real timeout, int early)
#define ca_get(type, chan, pValue)
void verifyConnectionHandlerConnect(appChan *pChans, unsigned chanCount, unsigned repetitionCount, unsigned interestLevel)
#define epicsThreadPriorityLow
void fdRegCB(void *parg, int fd, int opened)
LIBCOM_API void epicsExit(int status)
Calls epicsExitCallAtExits(), then the OS exit() routine.
LIBCA_API int epicsStdCall ca_clear_subscription(evid pMon)
LIBCA_API int epicsStdCall ca_array_get(chtype type, unsigned long count, chid chanId, void *pValue)
BSD and SRV5 Unix timestamp.
Extended replacement for the Posix exit and atexit routines.
epicsFloat64 dbr_double_t
LIBCA_API const char *epicsStdCall ca_name(chid chan)
void verifyConnectWithDisconnectedChannels(const char *pName, unsigned interestLevel)
dbr_double_t lower_ctrl_limit
LIBCOM_API void epicsEventDestroy(epicsEventId id)
Destroy an epicsEvent and any resources it holds.
LIBCOM_API int epicsStdCall fdmgr_clear_callback(fdctx *pfdctx, SOCKET fd, enum fdi_type fdi)
int epicsStdCall ca_task_initialize(void)
int epicsStdCall ca_add_fd_registration(CAFDHANDLER *func, void *arg)
LIBCA_API unsigned epicsStdCall ca_read_access(chid chan)
void testMultithreadSubscrConnHandler(struct connection_handler_args args)
void connectionStateChange(struct connection_handler_args args)
epicsOldString dbr_string_t
int epicsStdCall ca_clear_event(evid pMon)
int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
void verifyReasonableBeaconPeriod(chid chan, unsigned interestLevel)
int epicsStdCall ca_clear_channel(chid pChan)
unsigned accessUpdateCount
#define ca_search(pChanName, pChanID)
LIBCA_API int epicsStdCall ca_sg_test(const CA_SYNC_GID gid)
struct MultiSubscrDestroyNoLateCallbackEventData m_eventData[multiSubscrDestroyNoLateCallbackEventCount]
void verifyDisconnect(const char *pName, unsigned interestLevel)
APIs for the epicsEvent binary semaphore.
void verifyBlockInPendIO(chid chan, unsigned interestLevel)
LIBCA_API int epicsStdCall ca_sg_array_get(const CA_SYNC_GID gid, chtype type, unsigned long count, chid chan, void *pValue)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void)
LIBCA_API double epicsStdCall ca_beacon_period(chid chan)
void doubleTest(chid chan, dbr_double_t beginValue, dbr_double_t increment, dbr_double_t epsilon, unsigned iterations)
void verifyHighThroughputWrite(chid chan, unsigned interestLevel)
epicsMutexLockStatus epicsStdCall epicsMutexLock(epicsMutexId pmutexNode)
Claim the semaphore, waiting until it's free if currently owned owned by a different thread...
const char *epicsStdCall ca_message(long ca_status)
void clearChannelInSubscrCallbackTest(const char *pName, unsigned level)
const char *epicsStdCall ca_version()
epicsEventId m_testCompleteEvent
void arrayWriteNotify(struct event_handler_args args)
LIBCA_API double epicsStdCall ca_receive_watchdog_delay(chid chan)
#define epicsThreadPriorityHigh
LIBCOM_API int epicsStdCall fdmgr_add_callback(fdctx *pfdctx, SOCKET fd, enum fdi_type fdi, pCallBackFDMgr pFunc, void *pParam)
EPICS time stamp, for use from C code.
LIBCOM_API fdctx *epicsStdCall fdmgr_init(void)
void testMultithreadSubscr(void *pParm)
void verifyLongIO(chid chan, unsigned interestLevel)
#define dbr_size_n(TYPE, COUNT)
void verifyHighThroughputReadCallback(chid chan, unsigned interestLevel)
void selfDeleteEvent(struct event_handler_args args)
void subscriptionStateChange(struct event_handler_args args)
void exceptionTest(chid chan, unsigned interestLevel)
LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds)
Block the calling thread for at least the specified time.
#define epicsEventWaitOK
Old name provided for backwards compatibility.
void accessRightsStateChange(struct access_rights_handler_args args)
epicsEventId m_threadExitEvent
LIBCOM_API double epicsStdCall epicsTimeDiffInSeconds(const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
Time difference between left and right in seconds.
void verifyHighThroughputRead(chid chan, unsigned interestLevel)
#define dbf_type_is_valid(type)
int acctst(const char *pName, unsigned interestLevel, unsigned channelCount, unsigned repetitionCount, enum ca_preemptive_callback_select select)
LIBCA_API int epicsStdCall ca_sg_reset(const CA_SYNC_GID gid)
epicsUInt16 dbr_put_acks_t
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
epicsEventId m_testDoneEvent
void verifyOldPend(unsigned interestLevel)
void epicsStdCall ca_context_destroy()
#define epicsEventWaitStatus
Old name provided for backwards compatibility.
void updateTestEvent(struct event_handler_args args)
void verifyMonitorSubscriptionFlushIO(chid chan, unsigned interestLevel)
void verifyMultithreadSubscr(const char *pName, unsigned interestLevel)
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
void ioTesterGet(struct event_handler_args args)
struct ca_client_context *epicsStdCall ca_current_context()
epicsUInt16 dbr_put_ackt_t
void eventClearTest(chid chan)
void verifyChannelPriorities(const char *pName, unsigned interestLevel)
#define ca_add_event(type, chan, pFunc, pArg, pEventID)
LIBCA_API int epicsStdCall ca_sg_block(const CA_SYNC_GID gid, ca_real timeout)
unsigned getCallbackCount
#define ca_get_callback(type, chan, pFunc, pArg)
LIBCA_API int epicsStdCall ca_create_subscription(chtype type, unsigned long count, chid chanId, long mask, caEventCallBackFunc *pFunc, void *pArg, evid *pEventID)
#define ECA_UNAVAILINSERV
unsigned char accessRightsHandlerInstalled
LIBCOM_API void epicsStdCall epicsThreadSetPriority(epicsThreadId id, unsigned int priority)
#define dbf_type_to_DBR_CTRL(type)
int epicsStdCall ca_test_io()
char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void)
#define dbf_type_to_DBR_TIME(type)