diff --git a/examples/spamme.cpp b/examples/spamme.cpp index 6c37e2e..d66942b 100644 --- a/examples/spamme.cpp +++ b/examples/spamme.cpp @@ -247,9 +247,9 @@ struct SpamProvider : public pva::ChannelProvider, virtual pva::ChannelFind::shared_pointer channelFind(std::string const & name, pva::ChannelFindRequester::shared_pointer const & requester) OVERRIDE FINAL { - std::cerr<<"XXX "<channelName) { + if(name.size()>=this->channelName.size() && strncmp(name.c_str(), this->channelName.c_str(), this->channelName.size())==0) { ret = shared_from_this(); } std::cout<<__FUNCTION__<<" "< ret; - if(name==channelName) { + if(name.size()>=this->channelName.size() && strncmp(name.c_str(), this->channelName.c_str(), this->channelName.size())==0) { ret.reset(new SpamChannel(shared_from_this(), channelName, requester)); } std::cout<<__FUNCTION__<<" "<second; - cout << "GUID 0x" << entry.guid << ", version " << (int)entry.version << ": " + cout << "GUID 0x" << entry.guid << " version " << (int)entry.version << ": " << entry.protocol << "@["; size_t count = entry.addresses.size(); diff --git a/src/client/pvAccess.cpp b/src/client/pvAccess.cpp index 3238b9d..e78f740 100644 --- a/src/client/pvAccess.cpp +++ b/src/client/pvAccess.cpp @@ -259,19 +259,39 @@ struct Get2PutProxy : public ChannelGet ChannelPut::shared_pointer op; // the put we wrap std::tr1::shared_ptr op_request; // keep our Req alive + ChannelPut::shared_pointer OP() { + epicsGuard G(op_request->mutex); + return op; + } + Get2PutProxy() {} virtual ~Get2PutProxy() {} virtual void destroy() OVERRIDE FINAL - { op->destroy(); } + { + ChannelPut::shared_pointer O(OP()); + if(O) O->destroy(); + } virtual std::tr1::shared_ptr getChannel() OVERRIDE FINAL - { return op->getChannel(); } + { + ChannelPut::shared_pointer O(OP()); + return O ? O->getChannel() : std::tr1::shared_ptr(); + } virtual void cancel() OVERRIDE FINAL - { op->cancel(); } + { + ChannelPut::shared_pointer O(OP()); + if(O) O->cancel(); + } virtual void lastRequest() OVERRIDE FINAL - { op->lastRequest(); } + { + ChannelPut::shared_pointer O(OP()); + if(O) O->lastRequest(); + } virtual void get() OVERRIDE FINAL - { op->get(); } + { + ChannelPut::shared_pointer O(OP()); + if(O) O->get(); + } }; }// namespace diff --git a/testApp/Makefile b/testApp/Makefile index bc3a8f8..8a254a7 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -15,18 +15,22 @@ PROD_LIBS += pvAccess pvData Com include $(PVACCESS_TEST)/utils/Makefile include $(PVACCESS_TEST)/remote/Makefile -# The testHarness runs all the test programs in a known working order. +# pvAccessAllTests runs all the test programs in a known working order. testHarness_SRCS += pvAccessAllTests.c -PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests +# Name the application pvaTestHarness +pvaTestHarness_SRCS = $(testHarness_SRCS) -PROD_RTEMS += rtemsTestHarness -rtemsTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c -rtemsTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests +# Build for vxWorks +PROD_vxWorks = pvaTestHarness +TESTSPEC_vxWorks = pvaTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests +# Build for RTEMS, with harness code & configuration +PROD_RTEMS += pvaTestHarness +pvaTestHarness_SRCS_RTEMS += rtemsTestHarness.c rtemsConfig.c +TESTSPEC_RTEMS = pvaTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests + +# Build test scripts for hosts TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES diff --git a/testApp/pvAccessAllTests.c b/testApp/pvAccessAllTests.c index e9a299e..c4932fc 100644 --- a/testApp/pvAccessAllTests.c +++ b/testApp/pvAccessAllTests.c @@ -8,6 +8,7 @@ #include #include #include +#include /* utils */ int testAtomicBoolean(void); @@ -31,5 +32,5 @@ void pvAccessAllTests(void) runTest(testCodec); runTest(testChannelAccess); + epicsExit(0); /* Trigger test harness */ } - diff --git a/testApp/rtemsTestHarness.c b/testApp/rtemsTestHarness.c index 0b22320..18a9120 100644 --- a/testApp/rtemsTestHarness.c +++ b/testApp/rtemsTestHarness.c @@ -1,37 +1,12 @@ -#include -#include -#include -#include +/* + * Copyright information and license terms for this software can be + * found in the file LICENSE that is included with the distribution + */ -#include "rtemsNetworking.h" +extern void pvAccessAllTests(void); -#include -#include - -rtems_task -Init (rtems_task_argument ignored) +int main(int argc, char **argv) { - rtems_bsdnet_initialize_network (); - //rtems_bsdnet_show_if_stats (); - - rtems_time_of_day timeOfDay; - if (rtems_clock_get(RTEMS_CLOCK_GET_TOD,&timeOfDay) != RTEMS_SUCCESSFUL) { - timeOfDay.year = 2014; - timeOfDay.month = 1; - timeOfDay.day = 1; - timeOfDay.hour = 0; - timeOfDay.minute = 0; - timeOfDay.second = 0; - timeOfDay.ticks = 0; - - rtems_status_code ret = rtems_clock_set(&timeOfDay); - if (ret != RTEMS_SUCCESSFUL) { - printf("**** Can't set time %s\n", rtems_status_text(ret)); - } - } - osdTimeRegister(); - - extern void pvAccessAllTests(void); - pvAccessAllTests(); - epicsExit(0); + pvAccessAllTests(); /* calls epicsExit(0) */ + return 0; }