From 23c2ed3484a2c5cf531c5f48a88032cca205ee2a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 27 Feb 2018 17:35:16 -0800 Subject: [PATCH 1/7] spamme respond to all spam match the prefix "spam" to allow clients to subscribe eg. "spam1" and "spam2" to test concurrent streaming and load balancing. --- examples/spamme.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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__<<" "< Date: Thu, 8 Mar 2018 11:42:56 -0500 Subject: [PATCH 2/7] fix potential *NULL from Get2PutProxy --- src/client/pvAccess.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) 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 From af2adf92485c749a525ea6f2daee14137d7a1554 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 8 Mar 2018 11:43:36 -0500 Subject: [PATCH 3/7] pvlist remove comma some shells will include the trailing ',' in selection when double clicking. Users find this annoying. --- pvtoolsSrc/pvlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvtoolsSrc/pvlist.cpp b/pvtoolsSrc/pvlist.cpp index f739ce6..e9840c6 100644 --- a/pvtoolsSrc/pvlist.cpp +++ b/pvtoolsSrc/pvlist.cpp @@ -580,7 +580,7 @@ int main (int argc, char *argv[]) { const ServerEntry& entry = iter->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(); From 0e61565308a62c3bffced2bacbbabd4e35f308af Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 12 Mar 2018 09:13:59 -0700 Subject: [PATCH 4/7] rename rtemsTestHarness -> pvaTestHarness avoid name clash with rtemsTestHarness from pvDataCPP. --- testApp/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testApp/Makefile b/testApp/Makefile index bc3a8f8..348b671 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -22,10 +22,10 @@ PROD_vxWorks = vxTestHarness vxTestHarness_SRCS += $(testHarness_SRCS) TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests -PROD_RTEMS += rtemsTestHarness -rtemsTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c -rtemsTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests +PROD_RTEMS += pvaTestHarness +pvaTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c +pvaTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_RTEMS = pvaTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests TESTSCRIPTS_HOST += $(TESTS:%=%.t) From 802efbd6c1e0c8aab95a3ed0288595b0df6754fa Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 13 Mar 2018 13:46:14 -0500 Subject: [PATCH 5/7] Rename vxTestHarness -> pvaTestHarness Integrate with Michael's similar changes for RTEMS. --- testApp/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/testApp/Makefile b/testApp/Makefile index 348b671..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) +# Build for vxWorks +PROD_vxWorks = pvaTestHarness +TESTSPEC_vxWorks = pvaTestHarness.$(MUNCH_SUFFIX); pvAccessAllTests + +# Build for RTEMS, with harness code & configuration PROD_RTEMS += pvaTestHarness -pvaTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c -pvaTestHarness_SRCS += $(testHarness_SRCS) +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 From 9687555c988cd2455d15589e6fa586ab0677b62d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 13 Mar 2018 13:46:56 -0500 Subject: [PATCH 6/7] Move epicsExit() call into pvAccessAllTests() Needed on VxWorks to display the test summary. --- testApp/pvAccessAllTests.c | 3 ++- testApp/rtemsTestHarness.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) 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..d2042f7 100644 --- a/testApp/rtemsTestHarness.c +++ b/testApp/rtemsTestHarness.c @@ -5,7 +5,6 @@ #include "rtemsNetworking.h" -#include #include rtems_task @@ -33,5 +32,4 @@ Init (rtems_task_argument ignored) extern void pvAccessAllTests(void); pvAccessAllTests(); - epicsExit(0); } From 8d262fc9fe48965a499979a4dbdeaa8973a5100b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 13 Mar 2018 18:55:49 -0700 Subject: [PATCH 7/7] simpler test harness main() --- testApp/rtemsTestHarness.c | 39 ++++++++------------------------------ 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/testApp/rtemsTestHarness.c b/testApp/rtemsTestHarness.c index d2042f7..18a9120 100644 --- a/testApp/rtemsTestHarness.c +++ b/testApp/rtemsTestHarness.c @@ -1,35 +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 - -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(); + pvAccessAllTests(); /* calls epicsExit(0) */ + return 0; }