epicsTimerTest testImpreciseTiming()
This commit is contained in:
@@ -72,6 +72,7 @@ make -j2 RTEMS_QEMU_FIXUPS=YES CMD_CFLAGS="${CMD_CFLAGS}" CMD_CXXFLAGS="${CMD_CX
|
||||
|
||||
if [ "$TEST" != "NO" ]
|
||||
then
|
||||
export EPICS_TEST_IMPRECISE_TIMING=YES
|
||||
make -j2 tapfiles
|
||||
make -s test-results
|
||||
fi
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <crtdbg.h>
|
||||
@@ -248,6 +249,17 @@ int testDone(void) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
static int impreciseTiming;
|
||||
|
||||
int testImpreciseTiming(void)
|
||||
{
|
||||
if(impreciseTiming==0) {
|
||||
const char* env = getenv("EPICS_TEST_IMPRECISE_TIMING");
|
||||
|
||||
impreciseTiming = (env && strcmp(env, "YES")==0) ? 1 : -1;
|
||||
}
|
||||
return impreciseTiming>0;
|
||||
}
|
||||
|
||||
/* Our test harness, for RTEMS and vxWorks */
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ epicsShareFunc int testDone(void);
|
||||
|
||||
#define testOk1(cond) testOk(cond, "%s", #cond)
|
||||
|
||||
epicsShareFunc
|
||||
int testImpreciseTiming(void);
|
||||
|
||||
typedef int (*TESTFUNC)(void);
|
||||
epicsShareFunc void testHarness(void);
|
||||
|
||||
@@ -112,9 +112,13 @@ double delayVerify::checkError () const
|
||||
double actualDelay = this->expireStamp - this->beginStamp;
|
||||
double measuredError = actualDelay - this->expectedDelay;
|
||||
double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay;
|
||||
if(testImpreciseTiming())
|
||||
testTodoBegin("imprecise");
|
||||
testOk ( percentError < messageThresh, "%f < %f, delay = %f s, error = %f s (%.1f %%)",
|
||||
percentError, messageThresh,
|
||||
this->expectedDelay, measuredError, percentError );
|
||||
if(testImpreciseTiming())
|
||||
testTodoEnd();
|
||||
return measuredError;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user