diff --git a/Makefile b/Makefile index 71c65d9..9914eca 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ pvtoolsSrc_DEPEND_DIRS = src src/ca DIRS += testApp testApp_DEPEND_DIRS = src + +DIRS += testCa +testCa_DEPEND_DIRS = src + + DIRS += examples examples_DEPEND_DIRS += src src/ca diff --git a/testApp/Makefile b/testApp/Makefile index d23979e..4d59b61 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -10,11 +10,10 @@ USR_CPPFLAGS += -I$(TOP)/src/remoteClient PVACCESS_TEST = $(TOP)/testApp -PROD_LIBS += pvAccess pvAccessCA pvData Com +PROD_LIBS += pvAccess pvData Com include $(PVACCESS_TEST)/utils/Makefile include $(PVACCESS_TEST)/remote/Makefile -include $(PVACCESS_TEST)/ca/Makefile # pvAccessAllTests runs all the test programs in a known working order. testHarness_SRCS += pvAccessAllTests.c diff --git a/testApp/ca/Makefile b/testApp/ca/Makefile deleted file mode 100644 index 5c38178..0000000 --- a/testApp/ca/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# This is a Makefile fragment, see ../Makefile - -SRC_DIRS += $(PVACCESS_TEST)/ca - -TESTPROD_HOST += testCaProvider -testCaProvider += testCaProvider.cpp -testHarness_SRCS += testCaProvider.cpp -TESTS += testCaProvider diff --git a/testApp/pvAccessAllTests.c b/testApp/pvAccessAllTests.c index 7ec5c33..c4932fc 100644 --- a/testApp/pvAccessAllTests.c +++ b/testApp/pvAccessAllTests.c @@ -19,9 +19,6 @@ int testInetAddressUtils(void); int testCodec(void); int testChannelAccess(void); -/* ca */ -int testCaProvider(void); - void pvAccessAllTests(void) { testHarness(); @@ -34,8 +31,6 @@ void pvAccessAllTests(void) /* remote */ runTest(testCodec); runTest(testChannelAccess); - /* ca */ - runTest(testCaProvider); epicsExit(0); /* Trigger test harness */ } diff --git a/testCa/Makefile b/testCa/Makefile new file mode 100644 index 0000000..905b2b5 --- /dev/null +++ b/testCa/Makefile @@ -0,0 +1,33 @@ +# Makefile for the ca tests + +TOP = .. +include $(TOP)/configure/CONFIG + +USR_CPPFLAGS += -I$(TOP)/src/ca + +CAPROVIDER_TEST = $(TOP)/testCa + +PROD_LIBS += pvAccess pvAccessCA pvData Com + +TESTPROD_HOST += testCaProvider +testCaProvider_SRCS += testCaProvider.cpp +testHarness_SRCS += testCaProvider.cpp +TESTS += testCaProvider + + +# Name the application caTestHarness +caTestHarness_SRCS = $(testHarness_SRCS) + +# Build for vxWorks +PROD_vxWorks = caTestHarness +TESTSPEC_vxWorks = caTestHarness.$(MUNCH_SUFFIX); pvCaAllTests + +# Build for RTEMS, with harness code & configuration +PROD_RTEMS += caTestHarness +caTestHarness_SRCS_RTEMS += rtemsTestHarness.c +TESTSPEC_RTEMS = caTestHarness.$(MUNCH_SUFFIX); pvCaAllTests + +# Build test scripts for hosts +TESTSCRIPTS_HOST += $(TESTS:%=%.t) + +include $(TOP)/configure/RULES diff --git a/testCa/rtemsTestHarness.c b/testCa/rtemsTestHarness.c new file mode 100644 index 0000000..9c09d22 --- /dev/null +++ b/testCa/rtemsTestHarness.c @@ -0,0 +1,12 @@ +/* + * Copyright information and license terms for this software can be + * found in the file LICENSE that is included with the distribution + */ + +extern void pvCaAllTests(void); + +int main(int argc, char **argv) +{ + pvCaAllTests(); /* calls epicsExit(0) */ + return 0; +} diff --git a/testApp/ca/testCaProvider.cpp b/testCa/testCaProvider.cpp similarity index 96% rename from testApp/ca/testCaProvider.cpp rename to testCa/testCaProvider.cpp index 38a879c..f62482d 100644 --- a/testApp/ca/testCaProvider.cpp +++ b/testCa/testCaProvider.cpp @@ -7,14 +7,14 @@ #include #include -#include #include #include #include -#include +#include #include + #include #include #include @@ -355,14 +355,16 @@ void TestChannelPut::connect() void TestChannelPut::waitConnect(double timeout) { if(waitForConnect.wait(timeout)) return; - throw std::runtime_error(testChannel->getChannelName() + " TestChannelPut::waitConnect failed "); + throw std::runtime_error(testChannel->getChannelName() + + " TestChannelPut::waitConnect failed "); } void TestChannelPut::put(string const & value) { PVFieldPtr pvField(pvStructure->getSubField("value")); - if(!pvField) throw std::runtime_error(testChannel->getChannelName() + " TestChannelPut::put no value "); + if(!pvField) throw std::runtime_error(testChannel->getChannelName() + + " TestChannelPut::put no value "); FieldConstPtr field(pvField->getField()); Type type(field->getType()); if(type==scalar) { @@ -372,7 +374,8 @@ void TestChannelPut::put(string const & value) channelPut->put(pvStructure,bitSet); return; } - throw std::runtime_error(testChannel->getChannelName() + " TestChannelPut::put not supported type"); + throw std::runtime_error(testChannel->getChannelName() + + " TestChannelPut::put not supported type"); } class TestChannelMonitor; @@ -476,7 +479,8 @@ void TestChannelMonitor::unlisten(MonitorPtr const & monitor) void TestChannelMonitor::connect() { channelMonitor = testChannel->getChannel()->createMonitor(shared_from_this(),pvRequest); - if(!channelMonitor) throw std::runtime_error(testChannel->getChannelName() + " TestChannelMonitor::connect failed "); + if(!channelMonitor) throw std::runtime_error(testChannel->getChannelName() + + " TestChannelMonitor::connect failed "); } void TestChannelMonitor::waitConnect(double timeout) @@ -485,7 +489,8 @@ void TestChannelMonitor::waitConnect(double timeout) channelMonitor->start(); return; } - throw std::runtime_error(testChannel->getChannelName() + " TestChannelMonitor::waitConnect failed "); + throw std::runtime_error(testChannel->getChannelName() + + " TestChannelMonitor::waitConnect failed "); } void TestChannelMonitor::stopEvents() @@ -636,19 +641,20 @@ void TestIoc::start() void TestIoc::run() { - system("softIoc -d ../ca/testCaProvider.db"); + system("softIoc -d ../testCaProvider.db"); } MAIN(testCaProvider) { + + TestIocPtr testIoc(new TestIoc()); + testIoc->start(); testPlan(11); testDiag("===Test caProvider==="); CAClientFactory::start(); ChannelProviderRegistry::shared_pointer reg(ChannelProviderRegistry::clients()); ChannelProvider::shared_pointer channelProvider(reg->getProvider("ca")); try{ - TestIocPtr testIoc(new TestIoc()); - testIoc->start(); if(!channelProvider) { throw std::runtime_error(" provider ca not registered"); } @@ -672,6 +678,7 @@ MAIN(testCaProvider) scalarout = TestClient::create(channelName,pvRequest); testOk(scalarout!=NULL,"DBRexit not null"); scalarout->put("1"); + scalarout->stopEvents(); }catch(std::exception& e){ PRINT_EXCEPTION(e); testAbort("Unexpected Exception: %s", e.what()); diff --git a/testApp/ca/testCaProvider.db b/testCa/testCaProvider.db similarity index 100% rename from testApp/ca/testCaProvider.db rename to testCa/testCaProvider.db