From eacfbeeea8a73822b16c62e5b948941dc10c46de Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 27 May 2018 15:04:19 -0400 Subject: [PATCH 1/4] Building testCa requires src/ca --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9914eca..249e8b3 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ testApp_DEPEND_DIRS = src DIRS += testCa -testCa_DEPEND_DIRS = src +testCa_DEPEND_DIRS = src src/ca DIRS += examples From 206d080de18b1815295318daf5ac5eef4ed83978 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 27 May 2018 15:05:54 -0400 Subject: [PATCH 2/4] testCa: Fix version check for Base-3.14 builds --- testCa/testCaProvider.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testCa/testCaProvider.cpp b/testCa/testCaProvider.cpp index 15dfc16..8b5f439 100644 --- a/testCa/testCaProvider.cpp +++ b/testCa/testCaProvider.cpp @@ -15,7 +15,8 @@ #include #include -#if defined(VERSION_INT) && EPICS_VERSION_INT >= VERSION_INT(3,15,0,1) +#ifdef EPICS_VERSION_INT + #if EPICS_VERSION_INT >= VERSION_INT(3,15,0,1) #define USE_DBUNITTEST // USE_TYPED_RSET prevents deprecation warnings #define USE_TYPED_RSET @@ -25,8 +26,11 @@ #include extern "C" int testIoc_registerRecordDeviceDriver(struct dbBase *pbase); -#else - #define EXIT_TESTS 1 + #endif +#endif + +#ifndef EXIT_TESTS + #define EXIT_TESTS 1 #endif #include From 6681bdc4c6083da3ebc9ae2c1675d3a251d6857c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 27 May 2018 15:21:54 -0500 Subject: [PATCH 3/4] testCa: Embedded IOCs need Base-3.16.2 or higher --- testCa/Makefile | 8 ++++---- testCa/testCaProvider.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/testCa/Makefile b/testCa/Makefile index da17a17..90ab926 100644 --- a/testCa/Makefile +++ b/testCa/Makefile @@ -12,7 +12,7 @@ TESTPROD_HOST += testCaProvider testCaProvider_SRCS += testCaProvider.cpp caTestHarness_SRCS += testCaProvider.cpp TESTS += testCaProvider -ifdef BASE_3_15 +ifdef BASE_3_16 testCaProvider_SRCS += testIoc_registerRecordDeviceDriver.cpp REGRDDFLAGS = -l else @@ -20,8 +20,8 @@ else export EPICS_HOST_ARCH endif -ifdef BASE_3_15 - # Embedded OSes need dbUnitTest, Base-3.15 and higher only +ifdef BASE_3_16 + # Embedded OSes need Base-3.16.2 or higher to pass tests # The test collection is caTestHarness caTestHarness_SRCS += pvCaAllTests.c @@ -41,7 +41,7 @@ TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES -ifdef BASE_3_15 +ifdef BASE_3_16 $(COMMON_DIR)/testIoc.dbd: $(EPICS_BASE)/dbd/softIoc.dbd $(CP) $< $@ endif diff --git a/testCa/testCaProvider.cpp b/testCa/testCaProvider.cpp index 8b5f439..9b3c1e2 100644 --- a/testCa/testCaProvider.cpp +++ b/testCa/testCaProvider.cpp @@ -16,7 +16,7 @@ #include #ifdef EPICS_VERSION_INT - #if EPICS_VERSION_INT >= VERSION_INT(3,15,0,1) + #if EPICS_VERSION_INT >= VERSION_INT(3,16,2,0) #define USE_DBUNITTEST // USE_TYPED_RSET prevents deprecation warnings #define USE_TYPED_RSET @@ -704,8 +704,9 @@ void TestIoc::start() void TestIoc::run() { #ifndef USE_DBUNITTEST - // Base-3.14 doesn't provide the dbUnitTest APIs. - // This code only works on workstation targets, it runs the + // Base-3.14 doesn't provide the dbUnitTest APIs, and the CA + // tests with an embedded IOC fail with a Base before 3.16.2. + // This version only works on workstation targets, it runs the // softIoc from Base as a separate process, using system(). char * base; base = getenv("EPICS_BASE"); From 7bf404913a22dc6bb013a6279c7122e90982eb2a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 27 May 2018 15:35:04 -0500 Subject: [PATCH 4/4] testCa: Move IOC environment checks & configuration from run() to start() This lets us use testAbort() instead of throw to flag errors. --- testCa/testCaProvider.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/testCa/testCaProvider.cpp b/testCa/testCaProvider.cpp index 9b3c1e2..5a1664f 100644 --- a/testCa/testCaProvider.cpp +++ b/testCa/testCaProvider.cpp @@ -673,6 +673,8 @@ public: private: #ifndef USE_DBUNITTEST std::auto_ptr thread; + const char *base; + const char *arch; #endif }; @@ -692,7 +694,16 @@ void TestIoc::start() testIocInitOk(); eltc(1); #else - thread = std::auto_ptr(new epicsThread( + base = getenv("EPICS_BASE"); + if (!base) + testAbort("Environment variable $EPICS_BASE not defined"); + arch = getenv("EPICS_HOST_ARCH"); + if (!arch) + testAbort("Environment variable $EPICS_HOST_ARCH not defined"); + setenv("EPICS_CA_ADDR_LIST", "localhost", 1); + setenv("EPICS_CA_AUTO_ADDR_LIST", "NO", 1); + + thread = std::auto_ptr(new epicsThread( *this, "testIoc", epicsThreadGetStackSize(epicsThreadStackSmall), @@ -708,14 +719,6 @@ void TestIoc::run() // tests with an embedded IOC fail with a Base before 3.16.2. // This version only works on workstation targets, it runs the // softIoc from Base as a separate process, using system(). - char * base; - base = getenv("EPICS_BASE"); - if(base==NULL) throw std::runtime_error("TestIoc::run $EPICS_BASE not defined"); - char * arch; - arch = getenv("EPICS_HOST_ARCH"); - if(arch==NULL) throw std::runtime_error("TestIoc::run $$EPICS_HOST_ARCH not defined"); - setenv("EPICS_CA_ADDR_LIST", "localhost", 1); - setenv("EPICS_CA_AUTO_ADDR_LIST", "NO", 1); if(system("$EPICS_BASE/bin/$EPICS_HOST_ARCH/softIoc -x test -d ../testCaProvider.db")!=0) { string message(base); message += "/bin/";