From 490c50473690b2b8004d00e3c3ad774cc776ad29 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 10 May 2018 09:26:01 -0400 Subject: [PATCH 01/11] scanEventTest: use dbUnitTest.h for IOC lifecycle --- src/std/rec/test/scanEventTest.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/std/rec/test/scanEventTest.c b/src/std/rec/test/scanEventTest.c index 77acbbeca..971820850 100644 --- a/src/std/rec/test/scanEventTest.c +++ b/src/std/rec/test/scanEventTest.c @@ -65,21 +65,18 @@ MAIN(scanEventTest) testPlan(NELEMENTS(events)*2+(MAXEV+1)*5); + testdbPrepare(); + memset(aliases, 0, sizeof(aliases)); memset(expected_count, 0, sizeof(expected_count)); - if (dbReadDatabase(&pdbbase, "scanEventTest.dbd", - "." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR - "../O.Common" OSI_PATH_LIST_SEPARATOR "O.Common", NULL)) - testAbort("Database description 'scanEventTest.dbd' not found"); + testdbReadDatabase("scanEventTest.dbd", NULL, NULL); scanEventTest_registerRecordDeviceDriver(pdbbase); for (i = 0; i < NELEMENTS(events); i++) { char substitutions[256]; sprintf(substitutions, "N=%d,EVENT=%s", i, events[i].name); - if (dbReadDatabase(&pdbbase, "scanEventTest.db", - "." OSI_PATH_LIST_SEPARATOR "..", substitutions)) - testAbort("Error reading test database 'scanEventTest.db'"); + testdbReadDatabase("scanEventTest.db", NULL, substitutions); } testIocInitOk(); testDiag("Test if eventNameToHandle() strips spaces and handles numeric events"); @@ -138,5 +135,9 @@ MAIN(scanEventTest) testdbGetFieldEqual(pvname, DBR_LONG, expected_count[INDX(i)]); } + testIocShutdownOk(); + + testdbCleanup(); + return testDone(); } From 00a974ce528277de9a95987cfda538ff18e38d8c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 14 May 2018 09:56:26 -0700 Subject: [PATCH 02/11] callback.h: add epicsCallback alternative to CALLBACK Add epicsCallback as an IDE friendly alternative to CALLBACK. IDEs like qtcreator have long been confused by the use of CALLBACK, a name which has long been used by other libraries, which prevents code using it from being parsed correctly. --- src/ioc/db/callback.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ioc/db/callback.h b/src/ioc/db/callback.h index 34224f475..9011446dc 100644 --- a/src/ioc/db/callback.h +++ b/src/ioc/db/callback.h @@ -42,7 +42,9 @@ typedef struct callbackPvt { int priority; void *user; /*for use by callback user*/ void *timer; /*for use by callback itself*/ -}CALLBACK; +}epicsCallback; + +typedef epicsCallback CALLBACK; typedef void (*CALLBACKFUNC)(struct callbackPvt*); From 3b7e348a8c7f01d8a7a17a2f604819c65f89cc3c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 14 May 2018 10:35:16 -0700 Subject: [PATCH 03/11] dbUnitTest.h add callback sync. and global mutex Add testSyncCallback() to wait for in queued and in-progress callbacks to complete. Also add testGlobalLock() to help tests avoid use after free when destroying sync. primitives. --- src/ioc/db/callback.c | 84 +++++++++++++++++++++++++++++++++++++++++ src/ioc/db/dbUnitTest.c | 24 ++++++++++++ src/ioc/db/dbUnitTest.h | 59 +++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+) diff --git a/src/ioc/db/callback.c b/src/ioc/db/callback.c index 903ca3f43..b805c1c16 100644 --- a/src/ioc/db/callback.c +++ b/src/ioc/db/callback.c @@ -46,6 +46,7 @@ #include "epicsExport.h" #include "link.h" #include "recSup.h" +#include "dbUnitTest.h" /* for testSyncCallback() */ static int callbackQueueSize = 2000; @@ -353,3 +354,86 @@ void callbackRequestProcessCallbackDelayed(CALLBACK *pcallback, callbackSetProcess(pcallback, Priority, pRec); callbackRequestDelayed(pcallback, seconds); } + +/* Sync. process of testSyncCallback() + * + * 1. For each priority, make a call to callbackRequest() for each worker. + * 2. Wait until all callbacks are concurrently being executed + * 3. Last worker to begin executing signals success and begins waking up other workers + * 4. Last worker to wake signals testSyncCallback() to complete + */ +typedef struct { + epicsEventId wait_phase2, wait_phase4; + int nphase2, nphase3; + epicsCallback cb; +} sync_helper; + +static void sync_callback(epicsCallback *cb) +{ + sync_helper *helper; + callbackGetUser(helper, cb); + + testGlobalLock(); + + assert(helper->nphase2 > 0); + if(--helper->nphase2!=0) { + /* we are _not_ the last to start. */ + testGlobalUnlock(); + epicsEventMustWait(helper->wait_phase2); + testGlobalLock(); + } + + /* we are either the last to start, or have been + * woken by the same and must pass the wakeup along + */ + epicsEventMustTrigger(helper->wait_phase2); + + assert(helper->nphase2 == 0); + assert(helper->nphase3 > 0); + + if(--helper->nphase3==0) { + /* we are the last to wake up. wake up testSyncCallback() */ + epicsEventMustTrigger(helper->wait_phase4); + } + + testGlobalUnlock(); +} + +void testSyncCallback(void) +{ + sync_helper helper[NUM_CALLBACK_PRIORITIES]; + unsigned i; + + testDiag("Begin testSyncCallback()"); + + for(i=0; i Date: Mon, 14 May 2018 10:40:01 -0700 Subject: [PATCH 04/11] scanEventTest: use testSyncCallback() --- src/std/rec/test/scanEventTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/std/rec/test/scanEventTest.c b/src/std/rec/test/scanEventTest.c index 971820850..6b90a413b 100644 --- a/src/std/rec/test/scanEventTest.c +++ b/src/std/rec/test/scanEventTest.c @@ -126,7 +126,7 @@ MAIN(scanEventTest) } } /* Allow records to finish processing */ - epicsThreadSleep(0.1); + testSyncCallback(); testDiag("Check if events have been processed the expected number of times"); for (i = 0; i < NELEMENTS(events); i++) { char pvname[100]; From ca22d508312b823b3d686206ea8d16cdda2c1c11 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 10 May 2018 10:39:11 -0400 Subject: [PATCH 05/11] rec: consistent get_alarm_double() for longin/longout (fixes lp #1770292) --- src/rec/longinRecord.c | 8 ++++---- src/rec/longoutRecord.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rec/longinRecord.c b/src/rec/longinRecord.c index 58d9ccfbf..12da09c60 100644 --- a/src/rec/longinRecord.c +++ b/src/rec/longinRecord.c @@ -201,10 +201,10 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) longinRecord *prec=(longinRecord *)paddr->precord; if(paddr->pfield==(void *)&prec->val){ - pad->upper_alarm_limit = prec->hihi; - pad->upper_warning_limit = prec->high; - pad->lower_warning_limit = prec->low; - pad->lower_alarm_limit = prec->lolo; + pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; + pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN; + pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN; + pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN; } else recGblGetAlarmDouble(paddr,pad); return(0); } diff --git a/src/rec/longoutRecord.c b/src/rec/longoutRecord.c index a57d52829..c6ba45a4c 100644 --- a/src/rec/longoutRecord.c +++ b/src/rec/longoutRecord.c @@ -242,10 +242,10 @@ static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) int fieldIndex = dbGetFieldIndex(paddr); if(fieldIndex == longoutRecordVAL) { - pad->upper_alarm_limit = prec->hihi; - pad->upper_warning_limit = prec->high; - pad->lower_warning_limit = prec->low; - pad->lower_alarm_limit = prec->lolo; + pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; + pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN; + pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN; + pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN; } else recGblGetAlarmDouble(paddr,pad); return(0); } From 2d9c5e99a191f15ca7d20a8546be922057eb9598 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 15 May 2018 11:17:49 +0200 Subject: [PATCH 06/11] db: correctly convert NaN alarm levels to integers (fixes lp #1771298) --- src/db/dbAccess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index ef27afafb..b60594fed 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -297,10 +297,10 @@ static void get_alarm(DBADDR *paddr, char **ppbuffer, if (*options & DBR_AL_LONG) { struct dbr_alLong *pal = (struct dbr_alLong*) pbuffer; - pal->upper_alarm_limit = (epicsInt32) ald.upper_alarm_limit; - pal->upper_warning_limit = (epicsInt32) ald.upper_warning_limit; - pal->lower_warning_limit = (epicsInt32) ald.lower_warning_limit; - pal->lower_alarm_limit = (epicsInt32) ald.lower_alarm_limit; + pal->upper_alarm_limit = isfinite(ald.upper_alarm_limit) ? (epicsInt32) ald.upper_alarm_limit : 0; + pal->upper_warning_limit = isfinite(ald.upper_warning_limit) ? (epicsInt32) ald.upper_warning_limit : 0; + pal->lower_warning_limit = isfinite(ald.lower_warning_limit) ? (epicsInt32) ald.lower_warning_limit : 0; + pal->lower_alarm_limit = isfinite(ald.lower_alarm_limit) ? (epicsInt32) ald.lower_alarm_limit : 0; if (no_data) *options ^= DBR_AL_LONG; /*Turn off option*/ From 3bc0805a89f765819d5d9f7354e647719b01e88e Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 18 May 2018 09:54:42 +0200 Subject: [PATCH 07/11] rec: fix missing includes in longin/longout --- src/rec/longinRecord.c | 1 + src/rec/longoutRecord.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/rec/longinRecord.c b/src/rec/longinRecord.c index 12da09c60..611bedb34 100644 --- a/src/rec/longinRecord.c +++ b/src/rec/longinRecord.c @@ -21,6 +21,7 @@ #include "dbDefs.h" #include "epicsPrint.h" +#include "epicsMath.h" #include "alarm.h" #include "dbAccess.h" #include "dbEvent.h" diff --git a/src/rec/longoutRecord.c b/src/rec/longoutRecord.c index c6ba45a4c..0a83f7732 100644 --- a/src/rec/longoutRecord.c +++ b/src/rec/longoutRecord.c @@ -19,6 +19,7 @@ #include "dbDefs.h" #include "epicsPrint.h" +#include "epicsMath.h" #include "alarm.h" #include "dbAccess.h" #include "dbEvent.h" From a732539eee73e137ed55e4333f21c28964e01297 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 19 May 2018 21:14:36 -0500 Subject: [PATCH 08/11] epicsMath.h defines 'finite()' not 'isfinite()' --- src/db/dbAccess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index b60594fed..0d84e7ebf 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -297,10 +297,10 @@ static void get_alarm(DBADDR *paddr, char **ppbuffer, if (*options & DBR_AL_LONG) { struct dbr_alLong *pal = (struct dbr_alLong*) pbuffer; - pal->upper_alarm_limit = isfinite(ald.upper_alarm_limit) ? (epicsInt32) ald.upper_alarm_limit : 0; - pal->upper_warning_limit = isfinite(ald.upper_warning_limit) ? (epicsInt32) ald.upper_warning_limit : 0; - pal->lower_warning_limit = isfinite(ald.lower_warning_limit) ? (epicsInt32) ald.lower_warning_limit : 0; - pal->lower_alarm_limit = isfinite(ald.lower_alarm_limit) ? (epicsInt32) ald.lower_alarm_limit : 0; + pal->upper_alarm_limit = finite(ald.upper_alarm_limit) ? (epicsInt32) ald.upper_alarm_limit : 0; + pal->upper_warning_limit = finite(ald.upper_warning_limit) ? (epicsInt32) ald.upper_warning_limit : 0; + pal->lower_warning_limit = finite(ald.lower_warning_limit) ? (epicsInt32) ald.lower_warning_limit : 0; + pal->lower_alarm_limit = finite(ald.lower_alarm_limit) ? (epicsInt32) ald.lower_alarm_limit : 0; if (no_data) *options ^= DBR_AL_LONG; /*Turn off option*/ From c1ece40f41ed44fef855e3253bb75fbd83394111 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 19 May 2018 22:42:23 -0500 Subject: [PATCH 09/11] Updated Release Notes for Base-3.14.12.8 --- documentation/RELEASE_NOTES.html | 50 ++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 20ff8f460..b454da0d6 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -3,16 +3,60 @@ - EPICS Base R3.14.12.7 Release Notes + EPICS Base R3.14.12.8 Release Notes -

EPICS Base Release 3.14.12.7

+

EPICS Base Release 3.14.12.8

-

Changes between 3.14.12.6 and 3.14.12.7

+

Changes between 3.14.12.7 and 3.14.12.8

+

Fixes for Launchpad bugs

+ +

The following launchpad bugs have fixes included:

+ + + +

Updated VxWorks Timezone settings

+ +

Removed the settings for 2017; fixed the hour of the change for MET.

+ +

Back-port podToHtml.pl and Rules from Base-3.15

+ +

This script permits Base to be built with Perl installations that do not +provide the podchecker and pod2html scripts (e.g. Fedora 27).

+ +

Fixed camonitor server side relative timestamps bug

+ +

Initialize the first time-stamp from the first monitor, not the client-side +current time in this configuration.

+ +

Build changes for MSVC

+ +

Windows builds using Visual Studio 2015 and later now use the -FS +compiler option to allow parallel builds to work properly.

+ +

We now give the -FC option to tell the compiler to print absolute +paths for source files in diagnostic messages.

+ +

Changes between 3.14.12.6 and 3.14.12.7

+

Extend maximum Posix epicsEventWaitWithTimeout() delay

The Posix implementation of epicsEventWaitWithTimeout() was limiting the From 7e7d230d8c6f89d62b0d569d354b1e793ccfeebf Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 23 May 2018 09:24:56 +0200 Subject: [PATCH 10/11] templates: fix warnings for xxxRecord.c in exampleApp (fixes #1772833) --- src/makeBaseApp/top/exampleApp/src/xxxRecord.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/makeBaseApp/top/exampleApp/src/xxxRecord.c b/src/makeBaseApp/top/exampleApp/src/xxxRecord.c index 4281eb983..109bd45dd 100644 --- a/src/makeBaseApp/top/exampleApp/src/xxxRecord.c +++ b/src/makeBaseApp/top/exampleApp/src/xxxRecord.c @@ -198,8 +198,8 @@ static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) static void checkAlarms(xxxRecord *prec) { - double val; - float hyst, lalm, hihi, high, low, lolo; + double val, hyst, lalm; + float hihi, high, low, lolo; unsigned short hhsv, llsv, hsv, lsv; if(prec->udf == TRUE ){ From 67844bacc30e460fa43552e260f347065b1bb0c7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 28 May 2018 16:13:14 -0500 Subject: [PATCH 11/11] Perl s/use vars/our/ --- src/tools/convertRelease.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/convertRelease.pl b/src/tools/convertRelease.pl index fb2153a34..62e3d3eb3 100644 --- a/src/tools/convertRelease.pl +++ b/src/tools/convertRelease.pl @@ -21,8 +21,7 @@ use Getopt::Std; use EPICS::Path; use EPICS::Release; -use vars qw($arch $top $iocroot $root); - +our ($arch, $top, $iocroot, $root); our ($opt_a, $opt_t, $opt_T); $Getopt::Std::OUTPUT_HELP_VERSION = 1;