installed some limited self test capabilities so that the hash tables

can be verified during regression testing
This commit is contained in:
Jeff Hill
2001-06-28 22:12:54 +00:00
parent 22abff43bf
commit 69545bc772
6 changed files with 59 additions and 18 deletions

View File

@@ -95,24 +95,27 @@ extern "C" int epicsShareAPI ca_context_create ( int preemptiveCallBackEnable )
{
oldCAC *pcac;
epicsThreadOnce ( &caClientContextIdOnce, ca_init_client_context, 0);
try {
epicsThreadOnce ( &caClientContextIdOnce, ca_init_client_context, 0);
if ( caClientContextId == 0 ) {
return ECA_ALLOCMEM;
}
if ( caClientContextId == 0 ) {
pcac = ( oldCAC * ) epicsThreadPrivateGet ( caClientContextId );
if ( pcac ) {
return ECA_NORMAL;
}
pcac = new oldCAC ( preemptiveCallBackEnable ? true : false );
if ( ! pcac ) {
return ECA_ALLOCMEM;
}
epicsThreadPrivateSet ( caClientContextId, (void *) pcac );
}
catch ( ... ) {
return ECA_ALLOCMEM;
}
pcac = ( oldCAC * ) epicsThreadPrivateGet ( caClientContextId );
if ( pcac ) {
return ECA_NORMAL;
}
pcac = new oldCAC ( preemptiveCallBackEnable ? true : false );
if ( ! pcac ) {
return ECA_ALLOCMEM;
}
epicsThreadPrivateSet ( caClientContextId, (void *) pcac );
return ECA_NORMAL;
}
@@ -963,9 +966,7 @@ extern "C" int epicsShareAPI ca_current_context ( caClientCtx *pCurrentContext )
*/
extern "C" int epicsShareAPI ca_attach_context ( caClientCtx context )
{
oldCAC *pcac;
pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
oldCAC *pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
if ( pcac && context != 0 ) {
return ECA_ISATTACHED;
}
@@ -973,6 +974,15 @@ extern "C" int epicsShareAPI ca_attach_context ( caClientCtx context )
return ECA_NORMAL;
}
extern "C" void epicsShareAPI ca_self_test ()
{
oldCAC *pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
if ( ! pcac ) {
return;
}
pcac->selfTest ();
}
extern "C" epicsShareDef const int epicsTypeToDBR_XXXX [lastEpicsType+1] = {
DBR_SHORT, /* forces conversion fronm uint8 to int16 */
DBR_CHAR,

View File

@@ -393,6 +393,8 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, unsig
}
}
ca_self_test ();
showProgress ();
for ( j = 0u; j < chanCount; j += 2 ) {
@@ -400,6 +402,8 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, unsig
SEVCHK ( status, NULL );
}
ca_self_test ();
showProgress ();
for ( j = 0u; j < chanCount; j++ ) {
@@ -407,6 +411,8 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, unsig
SEVCHK ( status, NULL );
}
ca_self_test ();
showProgress ();
}
@@ -497,6 +503,8 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, unsigned repet
status = ca_pend_io ( 1000.0 );
SEVCHK ( status, NULL );
ca_self_test ();
showProgress ();
assert ( ca_test_io () == ECA_IODONE );
@@ -510,6 +518,8 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, unsigned repet
SEVCHK ( ca_clear_channel ( pChans[j].channel ), NULL );
}
ca_self_test ();
showProgress ();
/*
@@ -576,6 +586,9 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, unsigned repet
}
status = ca_clear_channel( pChans[0].channel );
SEVCHK ( status, NULL );
ca_self_test ();
showProgressEnd ();
}

View File

@@ -1748,3 +1748,12 @@ void cac::decrementOutstandingIO ( unsigned sequenceNo )
this->ioDone.signal ();
}
}
void cac::selfTest ()
{
this->chanTable.verify ();
this->ioTable.verify ();
this->sgTable.verify ();
this->beaconTable.verify ();
}

View File

@@ -134,6 +134,7 @@ public:
unsigned largeBufferSizeTCP () const;
char * allocateLargeBufferTCP ();
void releaseLargeBufferTCP ( char * );
void selfTest ();
private:
ipAddrToAsciiEngine ipToAEngine;

View File

@@ -929,6 +929,8 @@ epicsShareFunc int epicsShareAPI ca_attach_context (caClientCtx context);
epicsShareFunc int epicsShareAPI ca_client_status (unsigned level);
epicsShareFunc void epicsShareAPI ca_self_test ();
/*
* deprecated
*/

View File

@@ -213,6 +213,7 @@ public:
void installCASG ( CASG & );
void uninstallCASG ( CASG & );
void blockForEventAndEnableCallbacks ( epicsEvent &event, double timeout );
void selfTest ();
// perhaps these should be eliminated in deference to the exception mechanism
int printf ( const char *pformat, ... ) const;
int vPrintf ( const char *pformat, va_list args ) const;
@@ -504,4 +505,9 @@ inline void oldCAC::vSignal ( int ca_status, const char *pfilenm,
lineno, pFormat, args );
}
inline void oldCAC::selfTest ()
{
this->clientCtx.selfTest ();
}
#endif // ifndef oldAccessh