From 49371cfe006b71bf43bc44c0c4a5289c1b0770ef Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 12 May 2018 22:25:15 -0500 Subject: [PATCH] Fix RTEMS build in src/std/rec/test Also back-ported Michael's change from commit b9b8cde5f6a to avoid using callocMustSucceed() in eventNameToHandle() --- src/ioc/db/dbScan.c | 10 ++++++---- src/std/rec/test/Makefile | 4 +++- src/std/rec/test/epicsRunRecordTests.c | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ioc/db/dbScan.c b/src/ioc/db/dbScan.c index e9dc178a2..311297441 100644 --- a/src/ioc/db/dbScan.c +++ b/src/ioc/db/dbScan.c @@ -6,7 +6,7 @@ * Copyright (c) 2013 Helmholtz-Zentrum Berlin * für Materialien und Energie GmbH. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbScan.c */ /* tasks and subroutines to scan the database */ @@ -502,9 +502,10 @@ event_list *eventNameToHandle(const char *eventname) break; } if (pel == NULL) { - pel = dbCalloc(1, sizeof(event_list) + namelength); - if (eventnumber > 0) - { + pel = calloc(1, sizeof(event_list) + namelength); + if (!pel) + goto done; + if (eventnumber > 0) { /* backward compatibility: make all numeric events look like integers */ sprintf(pel->eventname, "%i", (int)eventnumber); pevent_list[(int)eventnumber] = pel; @@ -521,6 +522,7 @@ event_list *eventNameToHandle(const char *eventname) pel->next=pevent_list[0]; pevent_list[0]=pel; } +done: epicsMutexUnlock(event_lock); return pel; } diff --git a/src/std/rec/test/Makefile b/src/std/rec/test/Makefile index 70b6e173e..9a7e58320 100644 --- a/src/std/rec/test/Makefile +++ b/src/std/rec/test/Makefile @@ -4,7 +4,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in the file LICENSE that is included with this distribution. +# in the file LICENSE that is included with this distribution. #************************************************************************* TOP=../../../.. @@ -43,6 +43,8 @@ scanEventTest_DBD += base.dbd TESTPROD_HOST += scanEventTest scanEventTest_SRCS += scanEventTest.c scanEventTest_SRCS += scanEventTest_registerRecordDeviceDriver.cpp +testHarness_SRCS += scanEventTest.c +testHarness_SRCS += scanEventTest_registerRecordDeviceDriver.cpp TESTFILES += $(COMMON_DIR)/scanEventTest.dbd ../scanEventTest.db TESTS += scanEventTest diff --git a/src/std/rec/test/epicsRunRecordTests.c b/src/std/rec/test/epicsRunRecordTests.c index 1a7133c19..b3ee4dd85 100644 --- a/src/std/rec/test/epicsRunRecordTests.c +++ b/src/std/rec/test/epicsRunRecordTests.c @@ -23,6 +23,7 @@ void epicsRunRecordTests(void) runTest(analogMonitorTest); runTest(arrayOpTest); + runTest(scanEventTest); epicsExit(0); /* Trigger test harness */