Permit multiple test programs to be run sequentially in the same process

(for RTEMS and vxWorks).
This commit is contained in:
Andrew Johnson
2006-10-26 19:28:30 +00:00
parent 594a28d221
commit 5dd24b7ad2

View File

@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include "epicsThread.h"
#include "epicsMutex.h"
#define epicsExportSharedSymbols
@@ -31,13 +32,20 @@ static int skipped;
static int bonus;
static const char *todo;
void testPlan(int tests) {
if (testLock) abort();
static epicsThreadOnceId onceFlag = EPICS_THREAD_ONCE_INIT;
static void testInit(void *dummy) {
testLock = epicsMutexMustCreate();
}
void testPlan(int tests) {
epicsThreadOnce(&onceFlag, testInit, NULL);
epicsMutexMustLock(testLock);
plan = tests;
tests = passed = failed = skipped = bonus = 0;
todo = NULL;
if (plan) printf("1..%d\n", plan);
epicsMutexUnlock(testLock);
}
int testOk(int pass, const char *desc) {