From 3bfc6dcf64bb07db842a610bf1714e6f697ecceb Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Jul 2012 17:47:56 -0500 Subject: [PATCH] errlog in tests Take eltc(0) out of testPlan() and explicitly add it to those tests that should suppress expected errlog output. --- src/libCom/misc/epicsUnitTest.c | 1 - src/libCom/test/epicsThreadOnceTest.c | 4 +++- src/libCom/test/macEnvExpandTest.c | 8 ++------ src/libCom/test/taskwdTest.c | 3 +++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libCom/misc/epicsUnitTest.c b/src/libCom/misc/epicsUnitTest.c index 21f3b5b1c..140ad6cb0 100644 --- a/src/libCom/misc/epicsUnitTest.c +++ b/src/libCom/misc/epicsUnitTest.c @@ -65,7 +65,6 @@ void testPlan(int plan) { planned = plan; tested = passed = failed = skipped = bonus = 0; todo = NULL; - eltc(0); /* Silence errlog output */ if (plan) printf("1..%d\n", plan); epicsMutexUnlock(testLock); } diff --git a/src/libCom/test/epicsThreadOnceTest.c b/src/libCom/test/epicsThreadOnceTest.c index 5e9088442..0939a2aae 100644 --- a/src/libCom/test/epicsThreadOnceTest.c +++ b/src/libCom/test/epicsThreadOnceTest.c @@ -9,6 +9,7 @@ #include #include +#include "errlog.h" #include "epicsEvent.h" #include "epicsExit.h" #include "epicsMutex.h" @@ -102,7 +103,7 @@ MAIN(epicsThreadOnceTest) testOk(doneCount == NUM_ONCE_THREADS, "doneCount = %d", doneCount); testDiag("init was run by %s", initBy); - testDiag("Expecting thread recurse to suspend:"); + eltc(0); tid = epicsThreadCreate("recurse", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackSmall), recurseThread, 0); @@ -111,5 +112,6 @@ MAIN(epicsThreadOnceTest) } while (!epicsThreadIsSuspended(tid)); testPass("Recursive epicsThreadOnce() detected"); + eltc(1); return testDone(); } diff --git a/src/libCom/test/macEnvExpandTest.c b/src/libCom/test/macEnvExpandTest.c index 99464873a..b56cc366a 100644 --- a/src/libCom/test/macEnvExpandTest.c +++ b/src/libCom/test/macEnvExpandTest.c @@ -21,15 +21,11 @@ #include "epicsUnitTest.h" #include "testMain.h" -int warn; - static void check(const char *str, const char *expect) { char *got = macEnvExpand(str); int pass = -1; - if (expect == NULL) ++warn; - if (expect && !got) { testDiag("Got NULL, expected \"%s\".\n", expect); pass = 0; @@ -47,7 +43,7 @@ static void check(const char *str, const char *expect) MAIN(macEnvExpandTest) { - warn = 0; + eltc(0); testPlan(71); check("FOO", "FOO"); @@ -158,6 +154,6 @@ MAIN(macEnvExpandTest) check("${FOO=$(BAR),BAR=$(FOO)}", NULL); errlogFlush(); - testDiag("%d warning messages from macLib were expected above.\n", warn); + eltc(1); return testDone(); } diff --git a/src/libCom/test/taskwdTest.c b/src/libCom/test/taskwdTest.c index d7222dfa7..3fb2319fe 100644 --- a/src/libCom/test/taskwdTest.c +++ b/src/libCom/test/taskwdTest.c @@ -13,6 +13,7 @@ #include #include "taskwd.h" +#include "errlog.h" #include "epicsThread.h" #include "epicsUnitTest.h" #include "testMain.h" @@ -66,6 +67,7 @@ void testTask2(void *arg) MAIN(taskwdTest) { + eltc(0); testPlan(8); taskwdInit(); @@ -87,6 +89,7 @@ MAIN(taskwdTest) taskwdMonitorDel(&monFuncs, NULL); taskwdAnyRemove(NULL); + eltc(1); return testDone(); }