From 2a8a1d37360bccdd9a44a4f97a916eb818d80a58 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Fri, 31 Oct 2014 06:42:52 -0400 Subject: [PATCH 01/15] tests: PROD_HOST to TESTPROD_HOST; VxWorks tests for testApp/pv PASSES --- testApp/copy/Makefile | 4 +-- testApp/misc/Makefile | 26 +++++++------- testApp/pv/Makefile | 62 +++++++++++++++++++------------- testApp/pv/epicsRunPVDataTests.c | 42 ++++++++++++++++++++++ testApp/pv/testPVUnion.cpp | 6 ++-- 5 files changed, 98 insertions(+), 42 deletions(-) create mode 100644 testApp/pv/epicsRunPVDataTests.c diff --git a/testApp/copy/Makefile b/testApp/copy/Makefile index dab7623..1b1301b 100644 --- a/testApp/copy/Makefile +++ b/testApp/copy/Makefile @@ -2,12 +2,12 @@ TOP=../.. include $(TOP)/configure/CONFIG -PROD_HOST += testCreateRequest +TESTPROD_HOST += testCreateRequest testCreateRequest_SRCS = testCreateRequest.cpp testCreateRequest_LIBS = pvData Com TESTS += testCreateRequest -PROD_HOST += testPVCopy +TESTPROD_HOST += testPVCopy testPVCopy_SRCS += testPVCopy.cpp testPVCopy_LIBS += pvData Com TESTS += testPVCopy diff --git a/testApp/misc/Makefile b/testApp/misc/Makefile index dbf99ad..30bf7dc 100644 --- a/testApp/misc/Makefile +++ b/testApp/misc/Makefile @@ -4,54 +4,54 @@ include $(TOP)/configure/CONFIG PROD_LIBS += pvData Com -PROD_HOST += testThread +TESTPROD_HOST += testThread testThread_SRCS += testThread.cpp TESTS += testThread -PROD_HOST += testTimer +TESTPROD_HOST += testTimer testTimer_SRCS += testTimer.cpp TESTS += testTimer -PROD_HOST += testBitSet +TESTPROD_HOST += testBitSet testBitSet_SRCS += testBitSet.cpp TESTS += testBitSet -PROD_HOST += testOverrunBitSet +TESTPROD_HOST += testOverrunBitSet testOverrunBitSet_SRCS += testOverrunBitSet.cpp TESTS += testOverrunBitSet -PROD_HOST += testByteOrder +TESTPROD_HOST += testByteOrder testByteOrder_SRCS += testByteOrder.cpp -PROD_HOST += testByteBuffer +TESTPROD_HOST += testByteBuffer testByteBuffer_SRCS += testByteBuffer.cpp TESTS += testByteBuffer -PROD_HOST += testBaseException +TESTPROD_HOST += testBaseException testBaseException_SRCS += testBaseException.cpp TESTS += testBaseException -PROD_HOST += testSharedVector +TESTPROD_HOST += testSharedVector testSharedVector_SRCS += testSharedVector.cpp TESTS += testSharedVector -PROD_HOST += testSerialization +TESTPROD_HOST += testSerialization testSerialization_SRCS += testSerialization.cpp TESTS += testSerialization -PROD_HOST += testTimeStamp +TESTPROD_HOST += testTimeStamp testTimeStamp_SRCS += testTimeStamp.cpp TESTS += testTimeStamp -PROD_HOST += testQueue +TESTPROD_HOST += testQueue testQueue_SRCS += testQueue.cpp TESTS += testQueue -PROD_HOST += testMessageQueue +TESTPROD_HOST += testMessageQueue testMessageQueue_SRCS += testMessageQueue.cpp TESTS += testMessageQueue -PROD_HOST += testTypeCast +TESTPROD_HOST += testTypeCast testTypeCast_SRCS += testTypeCast.cpp TESTS += testTypeCast diff --git a/testApp/pv/Makefile b/testApp/pv/Makefile index 2f7a4a3..cfa5e3a 100644 --- a/testApp/pv/Makefile +++ b/testApp/pv/Makefile @@ -2,66 +2,80 @@ TOP=../.. include $(TOP)/configure/CONFIG -PROD_HOST += testBitSetUtil +PROD_LIBS += pvData Com + +TESTPROD_HOST += testBitSetUtil testBitSetUtil_SRCS += testBitSetUtil.cpp -testBitSetUtil_LIBS += pvData Com +testHarness_SRCS += testBitSetUtil.cpp TESTS += testBitSetUtil -PROD_HOST += testIntrospect +TESTPROD_HOST += testIntrospect testIntrospect_SRCS += testIntrospect.cpp -testIntrospect_LIBS += pvData Com +testHarness_SRCS += testIntrospect.cpp TESTS += testIntrospect -PROD_HOST += testPVType +TESTPROD_HOST += testPVType testPVType_SRCS += testPVType.cpp -testPVType_LIBS += pvData Com +testHarness_SRCS += testPVType.cpp TESTS += testPVType -PROD_HOST += testStandardField +TESTPROD_HOST += testStandardField testStandardField_SRCS += testStandardField.cpp -testStandardField_LIBS += pvData Com +testHarness_SRCS += testStandardField.cpp TESTS += testStandardField -PROD_HOST += testStandardPVField +TESTPROD_HOST += testStandardPVField testStandardPVField_SRCS += testStandardPVField.cpp -testStandardPVField_LIBS += pvData Com +testHarness_SRCS += testStandardPVField.cpp TESTS += testStandardPVField -PROD_HOST += testPVData +TESTPROD_HOST += testPVData testPVData_SRCS += testPVData.cpp -testPVData_LIBS += pvData Com +testHarness_SRCS += testPVData.cpp TESTS += testPVData -PROD_HOST += testPVUnion +TESTPROD_HOST += testPVUnion testPVUnion_SRCS += testPVUnion.cpp -testPVUnion_LIBS += pvData Com +testHarness_SRCS += testPVUnion.cpp TESTS += testPVUnion -PROD_HOST += testConvert +TESTPROD_HOST += testConvert testConvert_SRCS += testConvert.cpp -testConvert_LIBS += pvData Com +testHarness_SRCS += testConvert.cpp TESTS += testConvert -PROD_HOST += testPVScalarArray +TESTPROD_HOST += testPVScalarArray testPVScalarArray_SRCS += testPVScalarArray.cpp -testPVScalarArray_LIBS += pvData Com +testHarness_SRCS += testPVScalarArray.cpp TESTS += testPVScalarArray -PROD_HOST += testPVStructureArray +TESTPROD_HOST += testPVStructureArray testPVStructureArray_SRCS += testPVStructureArray.cpp -testPVStructureArray_LIBS += pvData Com +testHarness_SRCS += testPVStructureArray.cpp TESTS += testPVStructureArray -PROD_HOST += testOperators +TESTPROD_HOST += testOperators testOperators_SRCS += testOperators.cpp -testOperators_LIBS += pvData Com +testHarness_SRCS += testOperators.cpp TESTS += testOperators -PROD_HOST += testFieldBuilder +TESTPROD_HOST += testFieldBuilder testFieldBuilder_SRCS += testFieldBuilder.cpp -testFieldBuilder_LIBS += pvData Com +testHarness_SRCS += testFieldBuilder.cpp TESTS += testFieldBuilder +# The testHarness runs all the test programs in a known working order. +testHarness_SRCS += epicsRunPVDataTests.c + +PROD_vxWorks = vxTestHarness +vxTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests + +#PROD_RTEMS += rtemsTestHarness +#rtemsTestHarness_SRCS += rtemsTestHarness.c +#rtemsTestHarness_SRCS += $(testHarness_SRCS) +#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests + TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES diff --git a/testApp/pv/epicsRunPVDataTests.c b/testApp/pv/epicsRunPVDataTests.c new file mode 100644 index 0000000..0c3d65b --- /dev/null +++ b/testApp/pv/epicsRunPVDataTests.c @@ -0,0 +1,42 @@ +/* + * Run pvData tests as a batch. + * + * Do *not* include performance measurements here, they don't help to + * prove functionality (which is the point of this convenience routine). + */ + +#include +#include +#include + +int testBitSetUtil(int); +int testConvert(int); +int testFieldBuilder(int); +int testIntrospect(int); +int testOperators(int); +int testPVData(int); +int testPVScalarArray(int); +int testPVStructureArray(int); +int testPVType(int); +int testPVUnion(int); +int testStandardField(int); +int testStandardPVField(int); + +void epicsRunPVDataTests(void) +{ + testHarness(); + + runTest(testBitSetUtil); + runTest(testConvert); + runTest(testFieldBuilder); + runTest(testIntrospect); + runTest(testOperators); + runTest(testPVData); + runTest(testPVScalarArray); + runTest(testPVStructureArray); + runTest(testPVType); + runTest(testPVUnion); + runTest(testStandardField); + runTest(testStandardPVField); + +} diff --git a/testApp/pv/testPVUnion.cpp b/testApp/pv/testPVUnion.cpp index 1ff0fc5..cb64321 100644 --- a/testApp/pv/testPVUnion.cpp +++ b/testApp/pv/testPVUnion.cpp @@ -37,7 +37,7 @@ static StandardFieldPtr standardField = getStandardField(); static StandardPVFieldPtr standardPVField = getStandardPVField(); static ConvertPtr convert = getConvert(); -static void testPVUnion() +static void testPVUnionType() { if(debug) std::cout << std::endl << "testPVUnion" << std::endl; @@ -115,10 +115,10 @@ static void testPVUnionArray() } -MAIN(testPVData) +MAIN(testPVUnion) { testPlan(6); - testPVUnion(); + testPVUnionType(); testPVUnionArray(); return testDone(); } From 80a537bc4c76c96cc8607f9340f50d9c67acd8ce Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Fri, 31 Oct 2014 07:57:20 -0400 Subject: [PATCH 02/15] vxWork tests for all subtests; still need to combine them all to one --- testApp/Makefile | 8 +++++ testApp/copy/Makefile | 20 ++++++++++--- testApp/copy/epicsRunPVDataTests.c | 22 ++++++++++++++ testApp/copy/testCreateRequest.cpp | 4 +-- testApp/misc/Makefile | 24 +++++++++++++++ testApp/misc/epicsRunPVDataTests.c | 41 ++++++++++++++++++++++++++ testApp/misc/testBaseException.cpp | 4 +-- testApp/misc/testOverrunBitSet.cpp | 2 +- testApp/misc/testTimeStamp.cpp | 4 +-- testApp/property/Makefile | 15 +++++++++- testApp/property/epicsRunPVDataTests.c | 20 +++++++++++++ testApp/pv/epicsRunPVDataTests.c | 24 +++++++-------- 12 files changed, 164 insertions(+), 24 deletions(-) create mode 100644 testApp/copy/epicsRunPVDataTests.c create mode 100644 testApp/misc/epicsRunPVDataTests.c create mode 100644 testApp/property/epicsRunPVDataTests.c diff --git a/testApp/Makefile b/testApp/Makefile index 6d49e69..fa71872 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -4,5 +4,13 @@ DIRS += misc DIRS += pv DIRS += property DIRS += copy + +# TODO combined test vxTestHarness +#PROD_vxWorks = vxTestHarness +#vxTestHarness_SRCS += pvDataAllTests +#vxTestHarness_OBJS += misc/ +#TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDataAllTests + include $(TOP)/configure/RULES_DIRS + diff --git a/testApp/copy/Makefile b/testApp/copy/Makefile index 1b1301b..21e998b 100644 --- a/testApp/copy/Makefile +++ b/testApp/copy/Makefile @@ -2,20 +2,32 @@ TOP=../.. include $(TOP)/configure/CONFIG +PROD_LIBS += pvData Com + TESTPROD_HOST += testCreateRequest testCreateRequest_SRCS = testCreateRequest.cpp -testCreateRequest_LIBS = pvData Com +testHarness_SRCS += testCreateRequest.cpp TESTS += testCreateRequest TESTPROD_HOST += testPVCopy testPVCopy_SRCS += testPVCopy.cpp -testPVCopy_LIBS += pvData Com +testHarness_SRCS += testPVCopy.cpp TESTS += testPVCopy +# The testHarness runs all the test programs in a known working order. +testHarness_SRCS += epicsRunPVDataTests.c + +PROD_vxWorks = vxTestHarness +vxTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests.c + +#PROD_RTEMS += rtemsTestHarness +#rtemsTestHarness_SRCS += rtemsTestHarness.c +#rtemsTestHarness_SRCS += $(testHarness_SRCS) +#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests.c + TESTSCRIPTS_HOST += $(TESTS:%=%.t) - - include $(TOP)/configure/RULES #---------------------------------------- # ADD RULES AFTER THIS LINE diff --git a/testApp/copy/epicsRunPVDataTests.c b/testApp/copy/epicsRunPVDataTests.c new file mode 100644 index 0000000..0530a6e --- /dev/null +++ b/testApp/copy/epicsRunPVDataTests.c @@ -0,0 +1,22 @@ +/* + * Run pvData tests as a batch. + * + * Do *not* include performance measurements here, they don't help to + * prove functionality (which is the point of this convenience routine). + */ + +#include +#include +#include + +int testCreateRequest(void); +int testPVCopy(void); + +void epicsRunPVDataTests(void) +{ + testHarness(); + + runTest(testCreateRequest); + runTest(testPVCopy); + +} diff --git a/testApp/copy/testCreateRequest.cpp b/testApp/copy/testCreateRequest.cpp index e957fc1..3c0db1c 100644 --- a/testApp/copy/testCreateRequest.cpp +++ b/testApp/copy/testCreateRequest.cpp @@ -20,7 +20,7 @@ using std::endl; static bool debug = false; -static void testCreateRequest() { +static void testCreateRequestInternal() { printf("testCreateRequest... \n"); CreateRequest::shared_pointer createRequest = CreateRequest::create(); PVStringPtr pvString; @@ -307,7 +307,7 @@ static void testCreateRequest() { MAIN(testCreateRequest) { testPlan(117); - testCreateRequest(); + testCreateRequestInternal(); return testDone(); } diff --git a/testApp/misc/Makefile b/testApp/misc/Makefile index 30bf7dc..d4e4004 100644 --- a/testApp/misc/Makefile +++ b/testApp/misc/Makefile @@ -6,18 +6,22 @@ PROD_LIBS += pvData Com TESTPROD_HOST += testThread testThread_SRCS += testThread.cpp +testHarness_SRCS += testThread.cpp TESTS += testThread TESTPROD_HOST += testTimer testTimer_SRCS += testTimer.cpp +testHarness_SRCS += testTimer.cpp TESTS += testTimer TESTPROD_HOST += testBitSet testBitSet_SRCS += testBitSet.cpp +testHarness_SRCS += testBitSet.cpp TESTS += testBitSet TESTPROD_HOST += testOverrunBitSet testOverrunBitSet_SRCS += testOverrunBitSet.cpp +testHarness_SRCS += testOverrunBitSet.cpp TESTS += testOverrunBitSet TESTPROD_HOST += testByteOrder @@ -25,36 +29,56 @@ testByteOrder_SRCS += testByteOrder.cpp TESTPROD_HOST += testByteBuffer testByteBuffer_SRCS += testByteBuffer.cpp +testHarness_SRCS += testByteBuffer.cpp TESTS += testByteBuffer TESTPROD_HOST += testBaseException testBaseException_SRCS += testBaseException.cpp +testHarness_SRCS += testBaseException.cpp TESTS += testBaseException TESTPROD_HOST += testSharedVector testSharedVector_SRCS += testSharedVector.cpp +testHarness_SRCS += testSharedVector.cpp TESTS += testSharedVector TESTPROD_HOST += testSerialization testSerialization_SRCS += testSerialization.cpp +testHarness_SRCS += testSerialization.cpp TESTS += testSerialization TESTPROD_HOST += testTimeStamp testTimeStamp_SRCS += testTimeStamp.cpp +testHarness_SRCS += testTimeStamp.cpp TESTS += testTimeStamp TESTPROD_HOST += testQueue testQueue_SRCS += testQueue.cpp +testHarness_SRCS += testQueue.cpp TESTS += testQueue TESTPROD_HOST += testMessageQueue testMessageQueue_SRCS += testMessageQueue.cpp +testHarness_SRCS += testMessageQueue.cpp TESTS += testMessageQueue TESTPROD_HOST += testTypeCast testTypeCast_SRCS += testTypeCast.cpp +testHarness_SRCS += testTypeCast.cpp TESTS += testTypeCast +# The testHarness runs all the test programs in a known working order. +testHarness_SRCS += epicsRunPVDataTests.c + +PROD_vxWorks = vxTestHarness +vxTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests + +#PROD_RTEMS += rtemsTestHarness +#rtemsTestHarness_SRCS += rtemsTestHarness.c +#rtemsTestHarness_SRCS += $(testHarness_SRCS) +#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests + TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES diff --git a/testApp/misc/epicsRunPVDataTests.c b/testApp/misc/epicsRunPVDataTests.c new file mode 100644 index 0000000..8871bb1 --- /dev/null +++ b/testApp/misc/epicsRunPVDataTests.c @@ -0,0 +1,41 @@ +/* + * Run pvData tests as a batch. + * + * Do *not* include performance measurements here, they don't help to + * prove functionality (which is the point of this convenience routine). + */ + +#include +#include +#include + +int testBaseException(void); +int testBitSet(void); +int testByteBuffer(void); +int testMessageQueue(void); +int testOverrunBitSet(void); +int testQueue(void); +int testSerialization(void); +int testSharedVector(void); +int testThread(void); +int testTimeStamp(void); +int testTimer(void); +int testTypeCast(void); + +void epicsRunPVDataTests(void) +{ + testHarness(); + + runTest(testBaseException); + runTest(testBitSet); + runTest(testByteBuffer); + runTest(testMessageQueue); + runTest(testOverrunBitSet); + runTest(testQueue); + runTest(testSerialization); + runTest(testSharedVector); + runTest(testThread); + runTest(testTimeStamp); + runTest(testTimer); + runTest(testTypeCast); +} diff --git a/testApp/misc/testBaseException.cpp b/testApp/misc/testBaseException.cpp index dad14d5..dcbf02c 100644 --- a/testApp/misc/testBaseException.cpp +++ b/testApp/misc/testBaseException.cpp @@ -42,7 +42,7 @@ void internalTestBaseException(int /*unused*/ = 0) } } -void testBaseException() { +void testBaseExceptionTest() { printf("testBaseException... "); try { @@ -86,7 +86,7 @@ MAIN(testBaseException) testPlan(2); testDiag("Tests base exception"); testLogicException(); - testBaseException(); + testBaseExceptionTest(); return testDone(); } diff --git a/testApp/misc/testOverrunBitSet.cpp b/testApp/misc/testOverrunBitSet.cpp index 0b8c778..0c0d560 100644 --- a/testApp/misc/testOverrunBitSet.cpp +++ b/testApp/misc/testOverrunBitSet.cpp @@ -132,7 +132,7 @@ void test() } -MAIN(testOverrunBitSet`) +MAIN(testOverrunBitSet) { testPlan(41); testDiag("Tests for changeBitSet and overrunBitSet"); diff --git a/testApp/misc/testTimeStamp.cpp b/testApp/misc/testTimeStamp.cpp index 0284724..c7bfd53 100644 --- a/testApp/misc/testTimeStamp.cpp +++ b/testApp/misc/testTimeStamp.cpp @@ -28,7 +28,7 @@ using namespace epics::pvData; static bool debug = false; -void testTimeStamp() +void testTimeStampInternal() { testOk1(nanoSecPerSec==1000000000); TimeStamp current; @@ -131,6 +131,6 @@ MAIN(testTimeStamp) { testPlan(37); testDiag("Tests timeStamp"); - testTimeStamp(); + testTimeStampInternal(); return testDone(); } diff --git a/testApp/property/Makefile b/testApp/property/Makefile index 5daa114..67c1aec 100644 --- a/testApp/property/Makefile +++ b/testApp/property/Makefile @@ -2,11 +2,24 @@ TOP=../.. include $(TOP)/configure/CONFIG +PROD_LIBS = pvData Com + TESTPROD_HOST += testProperty testProperty_SRCS += testProperty.cpp +testHarness_SRCS += testProperty.cpp TESTS += testProperty -testProperty_LIBS += pvData Com +# The testHarness runs all the test programs in a known working order. +testHarness_SRCS += epicsRunPVDataTests.c + +PROD_vxWorks = vxTestHarness +vxTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests + +#PROD_RTEMS += rtemsTestHarness +#rtemsTestHarness_SRCS += rtemsTestHarness.c +#rtemsTestHarness_SRCS += $(testHarness_SRCS) +#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests TESTSCRIPTS_HOST += $(TESTS:%=%.t) diff --git a/testApp/property/epicsRunPVDataTests.c b/testApp/property/epicsRunPVDataTests.c new file mode 100644 index 0000000..e9946dc --- /dev/null +++ b/testApp/property/epicsRunPVDataTests.c @@ -0,0 +1,20 @@ +/* + * Run pvData tests as a batch. + * + * Do *not* include performance measurements here, they don't help to + * prove functionality (which is the point of this convenience routine). + */ + +#include +#include +#include + +int testCreateRequest(void); + +void epicsRunPVDataTests(void) +{ + testHarness(); + + runTest(testCreateRequest); + +} diff --git a/testApp/pv/epicsRunPVDataTests.c b/testApp/pv/epicsRunPVDataTests.c index 0c3d65b..d79fc72 100644 --- a/testApp/pv/epicsRunPVDataTests.c +++ b/testApp/pv/epicsRunPVDataTests.c @@ -9,18 +9,18 @@ #include #include -int testBitSetUtil(int); -int testConvert(int); -int testFieldBuilder(int); -int testIntrospect(int); -int testOperators(int); -int testPVData(int); -int testPVScalarArray(int); -int testPVStructureArray(int); -int testPVType(int); -int testPVUnion(int); -int testStandardField(int); -int testStandardPVField(int); +int testBitSetUtil(void); +int testConvert(void); +int testFieldBuilder(void); +int testIntrospect(void); +int testOperators(void); +int testPVData(void); +int testPVScalarArray(void); +int testPVStructureArray(void); +int testPVType(void); +int testPVUnion(void); +int testStandardField(void); +int testStandardPVField(void); void epicsRunPVDataTests(void) { From 5b1b5ab904babbf6a5694d34df6df35ab1899787 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Fri, 31 Oct 2014 18:29:55 +0100 Subject: [PATCH 03/15] tests: refactored test building so that one test object can be created for VxWorks and RTEMS --- pvDataCPP.files | 223 ++++++++++++++++++ testApp/Makefile | 28 ++- testApp/copy/Makefile | 25 +- testApp/copy/epicsRunPVDataTests.c | 22 -- testApp/misc/Makefile | 25 +- testApp/misc/epicsRunPVDataTests.c | 41 ---- testApp/property/Makefile | 25 +- testApp/property/epicsRunPVDataTests.c | 20 -- testApp/pv/Makefile | 25 +- ...epicsRunPVDataTests.c => pvDataAllTests.c} | 45 ++++ 10 files changed, 294 insertions(+), 185 deletions(-) delete mode 100644 testApp/copy/epicsRunPVDataTests.c delete mode 100644 testApp/misc/epicsRunPVDataTests.c delete mode 100644 testApp/property/epicsRunPVDataTests.c rename testApp/{pv/epicsRunPVDataTests.c => pvDataAllTests.c} (51%) diff --git a/pvDataCPP.files b/pvDataCPP.files index 10cd1dc..abca695 100644 --- a/pvDataCPP.files +++ b/pvDataCPP.files @@ -234,3 +234,226 @@ testApp/pv/testPVType.cpp testApp/pv/testStandardField.cpp testApp/pv/testStandardPVField.cpp src/factory/printer.cpp +configure/O.darwin-x86/Makefile +configure/Makefile +include/pv/alarm.h +include/pv/bitSet.h +include/pv/bitSetUtil.h +include/pv/byteBuffer.h +include/pv/control.h +include/pv/convert.h +include/pv/createRequest.h +include/pv/current_function.h +include/pv/destroyable.h +include/pv/display.h +include/pv/epicsException.h +include/pv/event.h +include/pv/executor.h +include/pv/factory.h +include/pv/localStaticLock.h +include/pv/lock.h +include/pv/messageQueue.h +include/pv/monitor.h +include/pv/monitorPlugin.h +include/pv/noDefaultMethods.h +include/pv/printer.h +include/pv/pvAlarm.h +include/pv/pvControl.h +include/pv/pvCopy.h +include/pv/pvData.h +include/pv/pvDisplay.h +include/pv/pvEnumerated.h +include/pv/pvIntrospect.h +include/pv/pvSubArrayCopy.h +include/pv/pvTimeStamp.h +include/pv/pvType.h +include/pv/queue.h +include/pv/requester.h +include/pv/serialize.h +include/pv/serializeHelper.h +include/pv/sharedPtr.h +include/pv/sharedVector.h +include/pv/standardField.h +include/pv/standardPVField.h +include/pv/status.h +include/pv/templateMeta.h +include/pv/thread.h +include/pv/timeFunction.h +include/pv/timer.h +include/pv/timeStamp.h +include/pv/typeCast.h +src/copy/createRequest.cpp +src/copy/createRequest.h +src/copy/Makefile +src/copy/pvCopy.cpp +src/copy/pvCopy.h +src/factory/Compare.cpp +src/factory/Convert.cpp +src/factory/factory.h +src/factory/FieldCreateFactory.cpp +src/factory/Makefile +src/factory/printer.cpp +src/factory/PVArray.cpp +src/factory/PVDataCreateFactory.cpp +src/factory/PVField.cpp +src/factory/PVScalar.cpp +src/factory/PVScalarArray.cpp +src/factory/PVStructure.cpp +src/factory/PVStructureArray.cpp +src/factory/pvSubArrayCopy.cpp +src/factory/PVUnion.cpp +src/factory/PVUnionArray.cpp +src/factory/StandardField.cpp +src/factory/StandardPVField.cpp +src/factory/TypeFunc.cpp +src/misc/bitSet.cpp +src/misc/bitSet.h +src/misc/byteBuffer.cpp +src/misc/byteBuffer.h +src/misc/current_function.h +src/misc/destroyable.h +src/misc/epicsException.cpp +src/misc/epicsException.h +src/misc/event.cpp +src/misc/event.h +src/misc/executor.cpp +src/misc/executor.h +src/misc/localStaticLock.cpp +src/misc/localStaticLock.h +src/misc/lock.h +src/misc/Makefile +src/misc/messageQueue.cpp +src/misc/messageQueue.h +src/misc/noDefaultMethods.h +src/misc/parseToPOD.cpp +src/misc/queue.h +src/misc/requester.cpp +src/misc/requester.h +src/misc/serialize.h +src/misc/serializeHelper.cpp +src/misc/serializeHelper.h +src/misc/sharedPtr.h +src/misc/sharedVector.h +src/misc/status.cpp +src/misc/status.h +src/misc/templateMeta.h +src/misc/thread.h +src/misc/timeFunction.cpp +src/misc/timeFunction.h +src/misc/timer.cpp +src/misc/timer.h +src/misc/typeCast.cpp +src/misc/typeCast.h +src/monitor/Makefile +src/monitor/monitor.cpp +src/monitor/monitor.h +src/monitor/monitorPlugin.cpp +src/monitor/monitorPlugin.h +src/O.darwin-x86/Makefile +src/property/alarm.cpp +src/property/alarm.h +src/property/control.h +src/property/display.h +src/property/Makefile +src/property/pvAlarm.cpp +src/property/pvAlarm.h +src/property/pvControl.cpp +src/property/pvControl.h +src/property/pvDisplay.cpp +src/property/pvDisplay.h +src/property/pvEnumerated.cpp +src/property/pvEnumerated.h +src/property/pvTimeStamp.cpp +src/property/pvTimeStamp.h +src/property/timeStamp.cpp +src/property/timeStamp.h +src/pv/convert.h +src/pv/Makefile +src/pv/printer.h +src/pv/pvData.h +src/pv/pvIntrospect.h +src/pv/pvSubArrayCopy.h +src/pv/pvType.h +src/pv/standardField.h +src/pv/standardPVField.h +src/pvMisc/bitSetUtil.cpp +src/pvMisc/bitSetUtil.h +src/pvMisc/Makefile +src/Makefile +testApp/copy/epicsRunPVDataTests.c +testApp/copy/Makefile +testApp/copy/testCreateRequest.cpp +testApp/copy/testPVCopy.cpp +testApp/misc/epicsRunPVDataTests.c +testApp/misc/Makefile +testApp/misc/testBaseException.cpp +testApp/misc/testBitSet.cpp +testApp/misc/testByteBuffer.cpp +testApp/misc/testByteOrder.cpp +testApp/misc/testMessageQueue.cpp +testApp/misc/testOverrunBitSet.cpp +testApp/misc/testQueue.cpp +testApp/misc/testSerialization.cpp +testApp/misc/testSharedVector.cpp +testApp/misc/testThread.cpp +testApp/misc/testTimer.cpp +testApp/misc/testTimeStamp.cpp +testApp/misc/testTypeCast.cpp +testApp/property/epicsRunPVDataTests.c +testApp/property/Makefile +testApp/property/testProperty.cpp +testApp/pv/epicsRunPVDataTests.c +testApp/pv/Makefile +testApp/pv/testBitSetUtil.cpp +testApp/pv/testConvert.cpp +testApp/pv/testFieldBuilder.cpp +testApp/pv/testIntrospect.cpp +testApp/pv/testOperators.cpp +testApp/pv/testPVData.cpp +testApp/pv/testPVScalarArray.cpp +testApp/pv/testPVStructureArray.cpp +testApp/pv/testPVType.cpp +testApp/pv/testPVUnion.cpp +testApp/pv/testStandardField.cpp +testApp/pv/testStandardPVField.cpp +testApp/Makefile +Makefile +testApp/copy/epicsRunPVDataTests.c +testApp/copy/Makefile +testApp/copy/testCreateRequest.cpp +testApp/copy/testPVCopy.cpp +testApp/misc/epicsRunPVDataTests.c +testApp/misc/Makefile +testApp/misc/testBaseException.cpp +testApp/misc/testBitSet.cpp +testApp/misc/testByteBuffer.cpp +testApp/misc/testByteOrder.cpp +testApp/misc/testMessageQueue.cpp +testApp/misc/testOverrunBitSet.cpp +testApp/misc/testQueue.cpp +testApp/misc/testSerialization.cpp +testApp/misc/testSharedVector.cpp +testApp/misc/testThread.cpp +testApp/misc/testTimer.cpp +testApp/misc/testTimeStamp.cpp +testApp/misc/testTypeCast.cpp +testApp/O.darwin-x86/Makefile +testApp/property/epicsRunPVDataTests.c +testApp/property/Makefile +testApp/property/testProperty.cpp +testApp/pv/epicsRunPVDataTests.c +testApp/pv/Makefile +testApp/pv/testBitSetUtil.cpp +testApp/pv/testConvert.cpp +testApp/pv/testFieldBuilder.cpp +testApp/pv/testIntrospect.cpp +testApp/pv/testOperators.cpp +testApp/pv/testPVData.cpp +testApp/pv/testPVScalarArray.cpp +testApp/pv/testPVStructureArray.cpp +testApp/pv/testPVType.cpp +testApp/pv/testPVUnion.cpp +testApp/pv/testStandardField.cpp +testApp/pv/testStandardPVField.cpp +testApp/Makefile +testApp/pvDataAllTests.c diff --git a/testApp/Makefile b/testApp/Makefile index fa71872..3dd7a46 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -1,16 +1,24 @@ +# Makefile for the pvData tests + TOP = .. include $(TOP)/configure/CONFIG -DIRS += misc -DIRS += pv -DIRS += property -DIRS += copy -# TODO combined test vxTestHarness -#PROD_vxWorks = vxTestHarness -#vxTestHarness_SRCS += pvDataAllTests -#vxTestHarness_OBJS += misc/ -#TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDataAllTests +PVDATA_TEST = $(TOP)/testApp -include $(TOP)/configure/RULES_DIRS +PROD_LIBS += pvData Com + +include $(PVDATA_TEST)/misc/Makefile +include $(PVDATA_TEST)/pv/Makefile +include $(PVDATA_TEST)/property/Makefile +include $(PVDATA_TEST)/copy/Makefile + +PROD_vxWorks = vxTestHarness +vxTestHarness_SRCS += pvDataAllTests +vxTestHarness_OBJS += misc/ +TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDataAllTests + +TESTSCRIPTS_HOST += $(TESTS:%=%.t) + +include $(TOP)/configure/RULES diff --git a/testApp/copy/Makefile b/testApp/copy/Makefile index 21e998b..bee2227 100644 --- a/testApp/copy/Makefile +++ b/testApp/copy/Makefile @@ -1,8 +1,6 @@ -TOP=../.. +# This is a Makefile fragment, see ../Makefile -include $(TOP)/configure/CONFIG - -PROD_LIBS += pvData Com +SRC_DIRS += $(PVDATA_TEST)/copy TESTPROD_HOST += testCreateRequest testCreateRequest_SRCS = testCreateRequest.cpp @@ -13,22 +11,3 @@ TESTPROD_HOST += testPVCopy testPVCopy_SRCS += testPVCopy.cpp testHarness_SRCS += testPVCopy.cpp TESTS += testPVCopy - -# The testHarness runs all the test programs in a known working order. -testHarness_SRCS += epicsRunPVDataTests.c - -PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests.c - -#PROD_RTEMS += rtemsTestHarness -#rtemsTestHarness_SRCS += rtemsTestHarness.c -#rtemsTestHarness_SRCS += $(testHarness_SRCS) -#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests.c - -TESTSCRIPTS_HOST += $(TESTS:%=%.t) - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/testApp/copy/epicsRunPVDataTests.c b/testApp/copy/epicsRunPVDataTests.c deleted file mode 100644 index 0530a6e..0000000 --- a/testApp/copy/epicsRunPVDataTests.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Run pvData tests as a batch. - * - * Do *not* include performance measurements here, they don't help to - * prove functionality (which is the point of this convenience routine). - */ - -#include -#include -#include - -int testCreateRequest(void); -int testPVCopy(void); - -void epicsRunPVDataTests(void) -{ - testHarness(); - - runTest(testCreateRequest); - runTest(testPVCopy); - -} diff --git a/testApp/misc/Makefile b/testApp/misc/Makefile index d4e4004..06b95ed 100644 --- a/testApp/misc/Makefile +++ b/testApp/misc/Makefile @@ -1,8 +1,6 @@ -TOP=../.. +# This is a Makefile fragment, see ../Makefile -include $(TOP)/configure/CONFIG - -PROD_LIBS += pvData Com +SRC_DIRS += $(PVDATA_TEST)/misc TESTPROD_HOST += testThread testThread_SRCS += testThread.cpp @@ -66,22 +64,3 @@ TESTPROD_HOST += testTypeCast testTypeCast_SRCS += testTypeCast.cpp testHarness_SRCS += testTypeCast.cpp TESTS += testTypeCast - -# The testHarness runs all the test programs in a known working order. -testHarness_SRCS += epicsRunPVDataTests.c - -PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests - -#PROD_RTEMS += rtemsTestHarness -#rtemsTestHarness_SRCS += rtemsTestHarness.c -#rtemsTestHarness_SRCS += $(testHarness_SRCS) -#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests - -TESTSCRIPTS_HOST += $(TESTS:%=%.t) - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/testApp/misc/epicsRunPVDataTests.c b/testApp/misc/epicsRunPVDataTests.c deleted file mode 100644 index 8871bb1..0000000 --- a/testApp/misc/epicsRunPVDataTests.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Run pvData tests as a batch. - * - * Do *not* include performance measurements here, they don't help to - * prove functionality (which is the point of this convenience routine). - */ - -#include -#include -#include - -int testBaseException(void); -int testBitSet(void); -int testByteBuffer(void); -int testMessageQueue(void); -int testOverrunBitSet(void); -int testQueue(void); -int testSerialization(void); -int testSharedVector(void); -int testThread(void); -int testTimeStamp(void); -int testTimer(void); -int testTypeCast(void); - -void epicsRunPVDataTests(void) -{ - testHarness(); - - runTest(testBaseException); - runTest(testBitSet); - runTest(testByteBuffer); - runTest(testMessageQueue); - runTest(testOverrunBitSet); - runTest(testQueue); - runTest(testSerialization); - runTest(testSharedVector); - runTest(testThread); - runTest(testTimeStamp); - runTest(testTimer); - runTest(testTypeCast); -} diff --git a/testApp/property/Makefile b/testApp/property/Makefile index 67c1aec..c468d79 100644 --- a/testApp/property/Makefile +++ b/testApp/property/Makefile @@ -1,29 +1,8 @@ -TOP=../.. +# This is a Makefile fragment, see ../Makefile -include $(TOP)/configure/CONFIG - -PROD_LIBS = pvData Com +SRC_DIRS += $(PVDATA_TEST)/property TESTPROD_HOST += testProperty testProperty_SRCS += testProperty.cpp testHarness_SRCS += testProperty.cpp TESTS += testProperty - -# The testHarness runs all the test programs in a known working order. -testHarness_SRCS += epicsRunPVDataTests.c - -PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests - -#PROD_RTEMS += rtemsTestHarness -#rtemsTestHarness_SRCS += rtemsTestHarness.c -#rtemsTestHarness_SRCS += $(testHarness_SRCS) -#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests - -TESTSCRIPTS_HOST += $(TESTS:%=%.t) - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/testApp/property/epicsRunPVDataTests.c b/testApp/property/epicsRunPVDataTests.c deleted file mode 100644 index e9946dc..0000000 --- a/testApp/property/epicsRunPVDataTests.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Run pvData tests as a batch. - * - * Do *not* include performance measurements here, they don't help to - * prove functionality (which is the point of this convenience routine). - */ - -#include -#include -#include - -int testCreateRequest(void); - -void epicsRunPVDataTests(void) -{ - testHarness(); - - runTest(testCreateRequest); - -} diff --git a/testApp/pv/Makefile b/testApp/pv/Makefile index cfa5e3a..a32dedd 100644 --- a/testApp/pv/Makefile +++ b/testApp/pv/Makefile @@ -1,8 +1,6 @@ -TOP=../.. +# This is a Makefile fragment, see ../Makefile -include $(TOP)/configure/CONFIG - -PROD_LIBS += pvData Com +SRC_DIRS += $(PVDATA_TEST)/pv TESTPROD_HOST += testBitSetUtil testBitSetUtil_SRCS += testBitSetUtil.cpp @@ -63,22 +61,3 @@ TESTPROD_HOST += testFieldBuilder testFieldBuilder_SRCS += testFieldBuilder.cpp testHarness_SRCS += testFieldBuilder.cpp TESTS += testFieldBuilder - -# The testHarness runs all the test programs in a known working order. -testHarness_SRCS += epicsRunPVDataTests.c - -PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += $(testHarness_SRCS) -TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); epicsRunPVDataTests - -#PROD_RTEMS += rtemsTestHarness -#rtemsTestHarness_SRCS += rtemsTestHarness.c -#rtemsTestHarness_SRCS += $(testHarness_SRCS) -#TESTSPEC_RTEMS = rtemsTestHarness.boot; epicsRunPVDataTests - -TESTSCRIPTS_HOST += $(TESTS:%=%.t) - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/testApp/pv/epicsRunPVDataTests.c b/testApp/pvDataAllTests.c similarity index 51% rename from testApp/pv/epicsRunPVDataTests.c rename to testApp/pvDataAllTests.c index d79fc72..94660f8 100644 --- a/testApp/pv/epicsRunPVDataTests.c +++ b/testApp/pvDataAllTests.c @@ -9,6 +9,28 @@ #include #include +/* copy */ +int testCreateRequest(void); +int testPVCopy(void); + +/* misc */ +int testBaseException(void); +int testBitSet(void); +int testByteBuffer(void); +int testMessageQueue(void); +int testOverrunBitSet(void); +int testQueue(void); +int testSerialization(void); +int testSharedVector(void); +int testThread(void); +int testTimeStamp(void); +int testTimer(void); +int testTypeCast(void); + +/* property */ +int testCreateRequest(void); + +/* pv */ int testBitSetUtil(void); int testConvert(void); int testFieldBuilder(void); @@ -26,6 +48,28 @@ void epicsRunPVDataTests(void) { testHarness(); + /* copy */ + runTest(testCreateRequest); + runTest(testPVCopy); + + /* misc */ + runTest(testBaseException); + runTest(testBitSet); + runTest(testByteBuffer); + runTest(testMessageQueue); + runTest(testOverrunBitSet); + runTest(testQueue); + runTest(testSerialization); + runTest(testSharedVector); + runTest(testThread); + runTest(testTimeStamp); + runTest(testTimer); + runTest(testTypeCast); + + /* property */ + runTest(testCreateRequest); + + /* pv */ runTest(testBitSetUtil); runTest(testConvert); runTest(testFieldBuilder); @@ -40,3 +84,4 @@ void epicsRunPVDataTests(void) runTest(testStandardPVField); } + From 73c4896cce9db791cad6a421338609dc50b9c2fd Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Fri, 31 Oct 2014 17:49:10 -0400 Subject: [PATCH 04/15] tests: VxWorks tests are now ready to be run --- testApp/Makefile | 6 ++++-- testApp/pvDataAllTests.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/testApp/Makefile b/testApp/Makefile index 3dd7a46..59bf634 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -12,9 +12,11 @@ include $(PVDATA_TEST)/pv/Makefile include $(PVDATA_TEST)/property/Makefile include $(PVDATA_TEST)/copy/Makefile +# The testHarness runs all the test programs in a known working order. +testHarness_SRCS += pvDataAllTests.c + PROD_vxWorks = vxTestHarness -vxTestHarness_SRCS += pvDataAllTests -vxTestHarness_OBJS += misc/ +vxTestHarness_SRCS += $(testHarness_SRCS) TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDataAllTests TESTSCRIPTS_HOST += $(TESTS:%=%.t) diff --git a/testApp/pvDataAllTests.c b/testApp/pvDataAllTests.c index 94660f8..1abbaa7 100644 --- a/testApp/pvDataAllTests.c +++ b/testApp/pvDataAllTests.c @@ -44,7 +44,7 @@ int testPVUnion(void); int testStandardField(void); int testStandardPVField(void); -void epicsRunPVDataTests(void) +void pvDataAllTests(void) { testHarness(); From 63d181a0ac24eebb51e3e6fe9a1c8630802c852b Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 3 Nov 2014 12:37:12 +0100 Subject: [PATCH 05/15] RTEMS QEMU tests --- configure/CONFIG_SITE | 2 + pvDataCPP.files | 32 ++++ pvDataCPP.includes | 7 +- testApp/Makefile | 5 + testApp/misc/testSerialization.cpp | 1 - testApp/qemuRunTest.sh | 1 + testApp/rtemsConfig.c | 72 ++++++++ testApp/rtemsNetworking.h | 278 +++++++++++++++++++++++++++++ testApp/rtemsTestHarness.c | 37 ++++ 9 files changed, 433 insertions(+), 2 deletions(-) create mode 100755 testApp/qemuRunTest.sh create mode 100644 testApp/rtemsConfig.c create mode 100644 testApp/rtemsNetworking.h create mode 100644 testApp/rtemsTestHarness.c diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 3e3e0d5..34db176 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -28,3 +28,5 @@ USR_CPPFLAGS += --coverage USR_LDFLAGS += --coverage endif +CROSS_COMPILER_TARGET_ARCHS=RTEMS-pc386 + diff --git a/pvDataCPP.files b/pvDataCPP.files index abca695..6ed0127 100644 --- a/pvDataCPP.files +++ b/pvDataCPP.files @@ -457,3 +457,35 @@ testApp/pv/testStandardField.cpp testApp/pv/testStandardPVField.cpp testApp/Makefile testApp/pvDataAllTests.c +testApp/copy/testCreateRequest.cpp +testApp/copy/testPVCopy.cpp +testApp/misc/testBaseException.cpp +testApp/misc/testBitSet.cpp +testApp/misc/testByteBuffer.cpp +testApp/misc/testByteOrder.cpp +testApp/misc/testMessageQueue.cpp +testApp/misc/testOverrunBitSet.cpp +testApp/misc/testQueue.cpp +testApp/misc/testSerialization.cpp +testApp/misc/testSharedVector.cpp +testApp/misc/testThread.cpp +testApp/misc/testTimer.cpp +testApp/misc/testTimeStamp.cpp +testApp/misc/testTypeCast.cpp +testApp/property/testProperty.cpp +testApp/pv/testBitSetUtil.cpp +testApp/pv/testConvert.cpp +testApp/pv/testFieldBuilder.cpp +testApp/pv/testIntrospect.cpp +testApp/pv/testOperators.cpp +testApp/pv/testPVData.cpp +testApp/pv/testPVScalarArray.cpp +testApp/pv/testPVStructureArray.cpp +testApp/pv/testPVType.cpp +testApp/pv/testPVUnion.cpp +testApp/pv/testStandardField.cpp +testApp/pv/testStandardPVField.cpp +testApp/pvDataAllTests.c +testApp/rtemsConfig.c +testApp/rtemsNetworking.h +testApp/rtemsTestHarness.c diff --git a/pvDataCPP.includes b/pvDataCPP.includes index 56eba21..766a41f 100644 --- a/pvDataCPP.includes +++ b/pvDataCPP.includes @@ -3,4 +3,9 @@ /home/msekoranja/epicsV4/pvDataCPP/pvDataApp/monitor /home/msekoranja/epicsV4/pvDataCPP/pvDataApp/property /home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pv -/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pvMisc \ No newline at end of file +/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pvMisc +testApp/pv +testApp/copy +testApp/misc +testApp +testApp/property diff --git a/testApp/Makefile b/testApp/Makefile index 59bf634..7e5b083 100644 --- a/testApp/Makefile +++ b/testApp/Makefile @@ -19,6 +19,11 @@ PROD_vxWorks = vxTestHarness vxTestHarness_SRCS += $(testHarness_SRCS) TESTSPEC_vxWorks = vxTestHarness.$(MUNCH_SUFFIX); pvDataAllTests +PROD_RTEMS += rtemsTestHarness +rtemsTestHarness_SRCS += rtemsTestHarness.c rtemsConfig.c +rtemsTestHarness_SRCS += $(testHarness_SRCS) +TESTSPEC_RTEMS = rtemsTestHarness.$(MUNCH_SUFFIX); pvDataAllTests + TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES diff --git a/testApp/misc/testSerialization.cpp b/testApp/misc/testSerialization.cpp index 7f97a00..e88dbe9 100644 --- a/testApp/misc/testSerialization.cpp +++ b/testApp/misc/testSerialization.cpp @@ -790,7 +790,6 @@ MAIN(testSerialization) { delete control; delete flusher; - epicsExitCallAtExits(); return testDone(); } diff --git a/testApp/qemuRunTest.sh b/testApp/qemuRunTest.sh new file mode 100755 index 0000000..b9cd499 --- /dev/null +++ b/testApp/qemuRunTest.sh @@ -0,0 +1 @@ +qemu-system-i386 --kernel O.RTEMS-pc386/rtemsTestHarness -netdev user,id=mynet0 -device ne2k_isa,netdev=mynet0 -redir tcp:5075::5075 -redir udp:5076::5076 -m 1024 --no-reboot -curses diff --git a/testApp/rtemsConfig.c b/testApp/rtemsConfig.c new file mode 100644 index 0000000..ac3059f --- /dev/null +++ b/testApp/rtemsConfig.c @@ -0,0 +1,72 @@ +/*************************************************************************\ +* Copyright (c) 2002 The University of Saskatchewan +* EPICS BASE Versions 3.13.7 +* and higher are distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* + * RTEMS configuration for EPICS + * Revision-Id: anj@aps.anl.gov-20101005192737-disfz3vs0f3fiixd + * Author: W. Eric Norum + * norume@aps.anl.gov + * (630) 252-4793 + */ + +#include + +/* + *********************************************************************** + * RTEMS CONFIGURATION * + *********************************************************************** + */ +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#if __RTEMS_MAJOR__>4 || (__RTEMS_MAJOR__==4 && __RTEMS_MINOR__>9) || (__RTEMS_MAJOR__==4 && __RTEMS_MINOR__==9 && __RTEMS_REVISION__==99) +# define CONFIGURE_UNIFIED_WORK_AREAS +#else +# define CONFIGURE_EXECUTIVE_RAM_SIZE (2000*1024) +#endif + +#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(30) +#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(500) +#define CONFIGURE_MAXIMUM_TIMERS rtems_resource_unlimited(20) +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited(5) +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 + +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 150 +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#define CONFIGURE_MAXIMUM_DRIVERS 8 + +#define CONFIGURE_MICROSECONDS_PER_TICK 20000 + +#define CONFIGURE_INIT_TASK_PRIORITY 80 + +#define CONFIGURE_MALLOC_STATISTICS 1 + +#define CONFIGURE_INIT +#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \ + RTEMS_NO_TIMESLICE | \ + RTEMS_NO_ASR | \ + RTEMS_INTERRUPT_LEVEL(0)) +#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_LOCAL) +#define CONFIGURE_INIT_TASK_STACK_SIZE (16*1024) +rtems_task Init (rtems_task_argument argument); + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_FILESYSTEM_NFS +#define CONFIGURE_FILESYSTEM_IMFS + +/* + * This should be made BSP dependent, not CPU dependent but I know of no + * appropriate conditionals to use. + * The new general time support makes including the RTC driverr less important. + */ +#if !defined(mpc604) && !defined(__mc68040__) && !defined(__mcf5200__) && !defined(mpc7455) && !defined(__arm__) /* don't have RTC code */ +#define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER +#endif + + +#include +#include diff --git a/testApp/rtemsNetworking.h b/testApp/rtemsNetworking.h new file mode 100644 index 0000000..3a2e6d0 --- /dev/null +++ b/testApp/rtemsNetworking.h @@ -0,0 +1,278 @@ +/* + * Network configuration -- QEMU NOT using DHCP + * + ************************************************************ + * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION * + * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! * + ************************************************************ + * + * The dynamic probing is based upon the EPICS network + * configuration file written by: + * W. Eric Norum + * eric.norum@usask.ca + * (306) 966-5394 + */ + +#ifndef _RTEMS_NETWORKCONFIG_H_ +#define _RTEMS_NETWORKCONFIG_H_ + +/* #define USE_LIBBSDPORT */ + +#if defined(USE_LIBBSDPORT) + #include + #define CONFIGURE_MAXIMUM_TIMERS 10 +#endif +/* + * For TFTP test application + */ +#if (defined (RTEMS_USE_BOOTP)) +#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST" +#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE" +#else +#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ" +#define RTEMS_TFTP_TEST_FILE_NAME "tftptest" +#endif + +/* + * For NFS test application + * + * NFS mount and a directory to ls once mounted + */ +#define RTEMS_NFS_SERVER "192.168.1.210" +#define RTEMS_NFS_SERVER_PATH "/home" +#define RTEMS_NFS_LS_PATH "/mnt/nfstest" + + + +/* + * This file can be copied to an application source dirctory + * and modified to override the values shown below. + * + * The following CPP symbols may be passed from the Makefile: + * + * symbol default description + * + * NETWORK_TASK_PRIORITY 150 can be read by app from public + * var 'gesysNetworkTaskPriority' + * FIXED_IP_ADDR hardcoded IP address (e.g., + * "192.168.0.10"); disables BOOTP; + * must also define FIXED_NETMASK + * FIXED_NETMASK IP netmask string + * (e.g. "255.255.255.0") + * MULTI_NETDRIVER ugly hack; if defined try to probe + * a variety of PCI and ISA drivers + * (i386 ONLY) use is discouraged! + * NIC_NAME Ethernet driver name (e.g. "pcn1"); + * must also define NIC_ATTACH + * NIC_ATTACH Ethernet driver attach function + * (e.g., rtems_fxp_attach). + * If these are undefined then + * a) MULTI_NETDRIVER is used + * (if defined) + * b) RTEMS_BSP_NETWORK_DRIVER_NAME/ + * RTEMS_BSP_NETWORK_DRIVER_ATTACH + * are tried + * MEMORY_CUSTOM Allocate the defined amount of + * memory for mbufs and mbuf clusters, + * respectively. Define to a comma ',' + * separated pair of two numerical + * values, e.g: 100*1024,200*1024 + * MEMORY_SCARCE Allocate few memory for mbufs + * (hint for how much memory the + * board has) + * MEMORY_HUGE Allocate a lot of memory for mbufs + * (hint for how much memory the + * board has) + * If none of MEMORY_CUSTOM/ + * MEMORY_SCARCE/MEMORY_HUGE are + * defined then a medium amount of + * memory is allocated for mbufs. + */ + +#include +#include +#include + +#if 0 +#ifdef HAVE_CONFIG_H +#include +#else +#include "verscheck.h" +#endif +#endif + +//#define MULTI_NETDRIVER +//#define RTEMS_BSP_NETWORK_DRIVER_NAME 1 + +#define FIXED_IP_ADDR "192.168.1.249" +#define FIXED_NETMASK "255.255.255.0" + +#ifndef NETWORK_TASK_PRIORITY +#define NETWORK_TASK_PRIORITY 150 /* within EPICS' range */ +#endif + +/* make publicily available for startup scripts... */ +const int gesysNetworkTaskPriority = NETWORK_TASK_PRIORITY; + +#ifdef FIXED_IP_ADDR +#define RTEMS_DO_BOOTP 0 +#else +#define RTEMS_DO_BOOTP rtems_bsdnet_do_bootp +#define FIXED_IP_ADDR 0 +#undef FIXED_NETMASK +#define FIXED_NETMASK 0 +#endif + +#if !defined(NIC_NAME) + +#ifdef MULTI_NETDRIVER + +#if 0 + #if RTEMS_VERSION_ATLEAST(4,6,99) + #define pcib_init pci_initialize + #endif +#endif + +extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *, int); +extern int rtems_fxp_attach (struct rtems_bsdnet_ifconfig *, int); +extern int rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *, int); +extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *, int); + +/* these don't probe and will be used even if there's no device :-( */ +extern int rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *, int); +extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *, int); + +static struct rtems_bsdnet_ifconfig isa_netdriver_config[] = { + { + "ep0", rtems_3c509_driver_attach, isa_netdriver_config + 1, + }, + { + "ne1", rtems_ne_driver_attach, 0, irno: 9 /* qemu cannot configure irq-no :-(; has it hardwired to 9 */ + }, +}; + +static struct rtems_bsdnet_ifconfig pci_netdriver_config[]={ + { + "dc1", rtems_dec21140_driver_attach, pci_netdriver_config+1, + }, + #if !defined(USE_LIBBSDPORT) + { + "fxp1", rtems_fxp_attach, pci_netdriver_config+2, + }, + #else + { + "", libbsdport_netdriver_attach, pci_netdriver_config+2, + }, + #endif + { + "elnk1", rtems_elnk_driver_attach, isa_netdriver_config, + }, +}; + +static int pci_check(struct rtems_bsdnet_ifconfig *ocfg, int attaching) +{ +struct rtems_bsdnet_ifconfig *cfg; +int if_index_pre; +extern int if_index; + if ( attaching ) { + cfg = pci_initialize() ? + isa_netdriver_config : pci_netdriver_config; + } + while ( cfg ) { + printk("Probing '%s'", cfg->name); + /* unfortunately, the return value is unreliable - some drivers report + * success even if they fail. + * Check if they chained an interface (ifnet) structure instead + */ + if_index_pre = if_index; + cfg->attach(cfg, attaching); + if ( if_index > if_index_pre ) { + /* assume success */ + printk(" .. seemed to work\n"); + ocfg->name = cfg->name; + ocfg->attach = cfg->attach; + return 0; + } + printk(" .. failed\n"); + cfg = cfg->next; + } + return -1; +} + + +#define NIC_NAME "dummy" +#define NIC_ATTACH pci_check + +#else + +#if defined(RTEMS_BSP_NETWORK_DRIVER_NAME) /* Use NIC provided by BSP */ +# define NIC_NAME BSP_NE2000_NETWORK_DRIVER_NAME +# define NIC_ATTACH BSP_NE2000_NETWORK_DRIVER_ATTACH +#endif + +#endif /* ifdef MULTI_NETDRIVER */ +#endif + + +#ifdef NIC_NAME + +extern int NIC_ATTACH(); + +static char ethernet_address[6] = { 0x00, 0xab, 0xcd, 0xef, 0x12, 0x34 }; +static struct rtems_bsdnet_ifconfig netdriver_config[1] = {{ + NIC_NAME, /* name */ + (int (*)(struct rtems_bsdnet_ifconfig*,int))NIC_ATTACH, /* attach function */ + 0, /* link to next interface */ + FIXED_IP_ADDR, + FIXED_NETMASK, + ethernet_address, + irno:9, + port:0xc100 +}}; +#else +#warning "NO KNOWN NETWORK DRIVER FOR THIS BSP -- YOU MAY HAVE TO EDIT networkconfig.h" +#endif + +struct rtems_bsdnet_config rtems_bsdnet_config = { +#ifdef NIC_NAME + netdriver_config, /* link to next interface */ + RTEMS_DO_BOOTP, /* Use BOOTP to get network configuration */ +#else + 0, + 0, +#endif + NETWORK_TASK_PRIORITY, /* Network task priority */ +#if defined(MEMORY_CUSTOM) + MEMORY_CUSTOM, +#elif defined(MEMORY_SCARCE) + 100*1024, /* MBUF space */ + 200*1024, /* MBUF cluster space */ +#elif defined(MEMORY_HUGE) + 2*1024*1024, /* MBUF space */ + 5*1024*1024, /* MBUF cluster space */ +#else + 180*1024, /* MBUF space */ + 350*1024, /* MBUF cluster space */ +#endif +#if (!defined (RTEMS_USE_BOOTP)) && defined(ON_RTEMS_LAB_WINSYSTEMS) + "rtems", /* Host name */ + "nodomain.com", /* Domain name */ + "192.168.1.14", /* Gateway */ + "192.168.1.1", /* Log host */ + {"89.212.75.6" }, /* Name server(s) */ + {"192.168.1.1" }, /* NTP server(s) */ +#else + NULL, /* Host name */ + NULL, /* Domain name */ + NULL, /* Gateway */ + NULL, /* Log host */ + { NULL }, /* Name server(s) */ + { NULL }, /* NTP server(s) */ +#endif /* !RTEMS_USE_BOOTP */ + 0, /* efficiency */ + 0, /* udp TX buffer */ + 0, /* udp RX buffer */ + 0, /* tcp TX buffer */ + 0, /* tcp RX buffer */ +}; +#endif /* _RTEMS_NETWORKCONFIG_H_ */ diff --git a/testApp/rtemsTestHarness.c b/testApp/rtemsTestHarness.c new file mode 100644 index 0000000..b6ef3ba --- /dev/null +++ b/testApp/rtemsTestHarness.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#include "rtemsNetworking.h" + +#include +#include + +rtems_task +Init (rtems_task_argument ignored) +{ + 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 pvDataAllTests(void); + pvDataAllTests(); + epicsExit(0); +} From 6db5cf60dcdb0d107031434dbff80e0345be3b2b Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 3 Nov 2014 12:41:09 +0100 Subject: [PATCH 06/15] removing file should not have been commited --- configure/CONFIG_SITE | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 34db176..3e3e0d5 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -28,5 +28,3 @@ USR_CPPFLAGS += --coverage USR_LDFLAGS += --coverage endif -CROSS_COMPILER_TARGET_ARCHS=RTEMS-pc386 - From 80e1dfd1424887182d95cf1857aca9fac943ac3b Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 3 Nov 2014 13:51:21 +0100 Subject: [PATCH 07/15] removed forces NE2K card or non i386 builds --- testApp/rtemsNetworking.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/testApp/rtemsNetworking.h b/testApp/rtemsNetworking.h index 3a2e6d0..e8d37f6 100644 --- a/testApp/rtemsNetworking.h +++ b/testApp/rtemsNetworking.h @@ -206,8 +206,18 @@ extern int if_index; #else #if defined(RTEMS_BSP_NETWORK_DRIVER_NAME) /* Use NIC provided by BSP */ + +/* force ne2k_isa on i386 for qemu */ +#if defined(__i386__) # define NIC_NAME BSP_NE2000_NETWORK_DRIVER_NAME # define NIC_ATTACH BSP_NE2000_NETWORK_DRIVER_ATTACH + +#else + +# define NIC_NAME RTEMS_BSP_NETWORK_DRIVER_NAME +# define NIC_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH +#endif + #endif #endif /* ifdef MULTI_NETDRIVER */ @@ -218,16 +228,22 @@ extern int if_index; extern int NIC_ATTACH(); +#if RTEMS_BSP_NETWORK_DRIVER_ATTACH == BSP_NE2000_NETWORK_DRIVER_ATTACH static char ethernet_address[6] = { 0x00, 0xab, 0xcd, 0xef, 0x12, 0x34 }; +#endif + static struct rtems_bsdnet_ifconfig netdriver_config[1] = {{ NIC_NAME, /* name */ (int (*)(struct rtems_bsdnet_ifconfig*,int))NIC_ATTACH, /* attach function */ 0, /* link to next interface */ FIXED_IP_ADDR, - FIXED_NETMASK, + FIXED_NETMASK +#if RTEMS_BSP_NETWORK_DRIVER_ATTACH == BSP_NE2000_NETWORK_DRIVER_ATTACH + , ethernet_address, irno:9, port:0xc100 +#endif }}; #else #warning "NO KNOWN NETWORK DRIVER FOR THIS BSP -- YOU MAY HAVE TO EDIT networkconfig.h" From 554dc06edabecef54ca60a57777d491885f27407 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Wed, 5 Nov 2014 13:52:10 +0100 Subject: [PATCH 08/15] ScalarTypeID mapping fixed in case 'int' == 'long', e.g. RTEMS-i386 --- src/pv/pvIntrospect.h | 2 +- testApp/misc/testSharedVector.cpp | 60 ++++++++++++++++--------------- testApp/pv/testIntrospect.cpp | 6 ++-- testApp/pvDataAllTests.c | 35 +++++++++--------- 4 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/pv/pvIntrospect.h b/src/pv/pvIntrospect.h index 1dab6d9..540d88f 100644 --- a/src/pv/pvIntrospect.h +++ b/src/pv/pvIntrospect.h @@ -1153,7 +1153,7 @@ epicsShareExtern FieldCreatePtr getFieldCreate(); * value (eg -1). */ template -struct ScalarTypeID { enum {value=-1}; }; +struct ScalarTypeID {}; /** * Static mapping from ScalarType enum to value type. diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index fc7666e..bcea65a 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -19,11 +19,12 @@ #include "pv/sharedVector.h" using std::string; +using namespace epics::pvData; static void testEmpty() { testDiag("Test empty vector"); - epics::pvData::shared_vector empty, empty2; + epics::pvData::shared_vector empty, empty2; testOk1(empty.size()==0); testOk1(empty.empty()); @@ -42,7 +43,7 @@ static void testInternalAlloc() { testDiag("Test vector alloc w/ new[]"); - epics::pvData::shared_vector internal(5); + epics::pvData::shared_vector internal(5); testOk1(internal.size()==5); testOk1(!internal.empty()); @@ -57,7 +58,7 @@ static void testInternalAlloc() internal[2] = 42; testOk1(internal[2]==42); - epics::pvData::shared_vector internal2(15, 500); + epics::pvData::shared_vector internal2(15, 500); testOk1(internal2.size()==15); testOk1(internal2[1]==500); @@ -79,7 +80,7 @@ namespace { //Note: STL shared_ptr requires that deletors be copy constructable template struct callCounter { - std::tr1::shared_ptr count; + std::tr1::shared_ptr count; callCounter():count(new int){*count=0;} callCounter(const callCounter& o):count(o.count) {}; callCounter& operator=(const callCounter& o){count=o.count;} @@ -93,7 +94,7 @@ static void testExternalAlloc() // Simulate a failed malloc() or similar int *oops=0; - epics::pvData::shared_vector nullPtr(oops, 42, 100); + epics::pvData::shared_vector nullPtr(oops, 42, 100); testOk1(nullPtr.size()==0); testOk1(nullPtr.empty()); @@ -103,7 +104,7 @@ static void testExternalAlloc() testOk1(nullPtr.data()==NULL); int *raw=new int[5]; - epics::pvData::shared_vector newData(raw, 1, 4); + epics::pvData::shared_vector newData(raw, 1, 4); testOk1(newData.size()==4); testOk1(!newData.empty()); @@ -117,7 +118,7 @@ static void testExternalAlloc() callCounter tracker; testOk1(*tracker.count==0); - epics::pvData::shared_vector locvar(localVar, + epics::pvData::shared_vector locvar(localVar, tracker, 0, 4); @@ -137,8 +138,8 @@ static void testShare() { testDiag("Test vector Sharing"); - epics::pvData::shared_vector one, two(15); - epics::pvData::shared_vector three(two); + epics::pvData::shared_vector one, two(15); + epics::pvData::shared_vector three(two); testOk1(one.unique()); testOk1(!two.unique()); @@ -199,10 +200,10 @@ static void testConst() { testDiag("Test constant vector"); - epics::pvData::shared_vector writable(15, 100); + epics::pvData::shared_vector writable(15, 100); - epics::pvData::shared_vector::reference wr = writable[0]; - epics::pvData::shared_vector::const_reference ror = writable[0]; + epics::pvData::shared_vector::reference wr = writable[0]; + epics::pvData::shared_vector::const_reference ror = writable[0]; testOk1(wr==ror); @@ -240,9 +241,9 @@ static void testSlice() { testDiag("Test vector slicing"); - epics::pvData::shared_vector original(10, 100); + epics::pvData::shared_vector original(10, 100); - epics::pvData::shared_vector half1(original), half2(original), half2a(original); + epics::pvData::shared_vector half1(original), half2(original), half2a(original); half1.slice(0, 5); half2.slice(5, 5); @@ -290,7 +291,7 @@ static void testCapacity() { testDiag("Test vector capacity"); - epics::pvData::shared_vector vect(10, 100); + epics::pvData::shared_vector vect(10, 100); int *peek = vect.dataPtr().get(); @@ -330,7 +331,7 @@ static void testCapacity() static void testPush() { - epics::pvData::shared_vector vect; + epics::pvData::shared_vector vect; testDiag("Test push_back optimizations"); @@ -357,7 +358,7 @@ static void testVoid() { testDiag("Test vecter cast to/from void"); - epics::pvData::shared_vector typed(4); + epics::pvData::shared_vector typed(4); epics::pvData::shared_vector untyped2(epics::pvData::static_shared_vector_cast(typed)); @@ -366,7 +367,7 @@ static void testVoid() untyped2.slice(sizeof(int), 2*sizeof(int)); - typed = epics::pvData::static_shared_vector_cast(untyped2); + typed = epics::pvData::static_shared_vector_cast(untyped2); testOk1(typed.dataOffset()==1); testOk1(typed.size()==2); @@ -406,7 +407,7 @@ static void testVectorConvert() { testDiag("Test shared_vector_convert"); - epics::pvData::shared_vector ints(6, 42), moreints; + epics::pvData::shared_vector ints(6, 42), moreints; epics::pvData::shared_vector floats; epics::pvData::shared_vector strings; epics::pvData::shared_vector voids; @@ -414,7 +415,7 @@ static void testVectorConvert() testOk1(ints.unique()); // no-op convert. Just returns another reference - moreints = epics::pvData::shared_vector_convert(ints); + moreints = epics::pvData::shared_vector_convert(ints); testOk1(!ints.unique()); moreints.clear(); @@ -432,11 +433,12 @@ static void testVectorConvert() voids = epics::pvData::shared_vector_convert(ints); testOk1(!ints.unique()); - testOk1(voids.size()==ints.size()*sizeof(int)); + testOk1(voids.size()==ints.size()*sizeof(int32)); // convert from void uses shared_vector::original_type() - // to find that the actual type is 'int'. + // to find that the actual type is 'int32'. // returns a new vector + testOk1(voids.original_type()==epics::pvData::pvInt); strings = epics::pvData::shared_vector_convert(voids); voids.clear(); @@ -450,11 +452,11 @@ static void testWeak() { testDiag("Test weak_ptr counting"); - epics::pvData::shared_vector data(6); + epics::pvData::shared_vector data(6); testOk1(data.unique()); - std::tr1::shared_ptr pdata(data.dataPtr()); + std::tr1::shared_ptr pdata(data.dataPtr()); testOk1(!data.unique()); @@ -462,7 +464,7 @@ static void testWeak() testOk1(data.unique()); - std::tr1::weak_ptr wdata(data.dataPtr()); + std::tr1::weak_ptr wdata(data.dataPtr()); testOk1(data.unique()); // True, but I wish it wasn't!!! @@ -475,7 +477,7 @@ static void testICE() { testDiag("Test freeze and thaw"); - epics::pvData::shared_vector A(6, 42), C; + epics::pvData::shared_vector A(6, 42), C; epics::pvData::shared_vector B, D; int *check = A.data(); @@ -537,11 +539,11 @@ static void testICE() MAIN(testSharedVector) { - testPlan(162); + testPlan(163); testDiag("Tests for shared_vector"); - testDiag("sizeof(shared_vector)=%lu", - (unsigned long)sizeof(epics::pvData::shared_vector)); + testDiag("sizeof(shared_vector)=%lu", + (unsigned long)sizeof(epics::pvData::shared_vector)); testEmpty(); testInternalAlloc(); diff --git a/testApp/pv/testIntrospect.cpp b/testApp/pv/testIntrospect.cpp index 1ddc910..ab2e6a9 100644 --- a/testApp/pv/testIntrospect.cpp +++ b/testApp/pv/testIntrospect.cpp @@ -289,6 +289,9 @@ static void testError() static void testMapping() { #define OP(TYPE, ENUM) \ + printf(#TYPE ": sizeof %u typeid '%s' ScalarTypeID %d\n",\ + (unsigned)sizeof(TYPE), typeid(TYPE).name(),\ + epics::pvData::ScalarTypeID::value);\ testOk1(typeid(ScalarTypeTraits::type)==typeid(TYPE)); \ testOk1(ENUM==(ScalarType)ScalarTypeID::value); \ testOk1(ENUM==(ScalarType)ScalarTypeID::value); @@ -306,12 +309,11 @@ static void testMapping() OP(string, pvString) #undef OP - testOk1((ScalarType)ScalarTypeID::value==(ScalarType)-1); } MAIN(testIntrospect) { - testPlan(327); + testPlan(326); fieldCreate = getFieldCreate(); pvDataCreate = getPVDataCreate(); standardField = getStandardField(); diff --git a/testApp/pvDataAllTests.c b/testApp/pvDataAllTests.c index 1abbaa7..5868c90 100644 --- a/testApp/pvDataAllTests.c +++ b/testApp/pvDataAllTests.c @@ -48,9 +48,19 @@ void pvDataAllTests(void) { testHarness(); - /* copy */ - runTest(testCreateRequest); - runTest(testPVCopy); + /* pv */ + runTest(testBitSetUtil); + runTest(testConvert); + runTest(testFieldBuilder); + runTest(testIntrospect); + runTest(testOperators); + runTest(testPVData); + runTest(testPVScalarArray); + runTest(testPVStructureArray); + runTest(testPVType); + runTest(testPVUnion); + runTest(testStandardField); + runTest(testStandardPVField); /* misc */ runTest(testBaseException); @@ -66,22 +76,11 @@ void pvDataAllTests(void) runTest(testTimer); runTest(testTypeCast); + /* copy */ + runTest(testCreateRequest); + runTest(testPVCopy); + /* property */ runTest(testCreateRequest); - - /* pv */ - runTest(testBitSetUtil); - runTest(testConvert); - runTest(testFieldBuilder); - runTest(testIntrospect); - runTest(testOperators); - runTest(testPVData); - runTest(testPVScalarArray); - runTest(testPVStructureArray); - runTest(testPVType); - runTest(testPVUnion); - runTest(testStandardField); - runTest(testStandardPVField); - } From f506fe1c0e5fa51e5d0a14620a93ee003a165017 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Wed, 5 Nov 2014 14:05:28 +0100 Subject: [PATCH 09/15] int/int32 compilation fix; now all test spass on RTEMS-i386 --- testApp/misc/testSharedVector.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index bcea65a..5cc4455 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -81,7 +81,7 @@ namespace { template struct callCounter { std::tr1::shared_ptr count; - callCounter():count(new int){*count=0;} + callCounter():count(new int32){*count=0;} callCounter(const callCounter& o):count(o.count) {}; callCounter& operator=(const callCounter& o){count=o.count;} void operator()(E){*count=1;} @@ -93,7 +93,7 @@ static void testExternalAlloc() testDiag("Test vector external alloc"); // Simulate a failed malloc() or similar - int *oops=0; + int32 *oops=0; epics::pvData::shared_vector nullPtr(oops, 42, 100); testOk1(nullPtr.size()==0); @@ -103,7 +103,7 @@ static void testExternalAlloc() testOk1(nullPtr.data()==NULL); - int *raw=new int[5]; + int32 *raw=new int32[5]; epics::pvData::shared_vector newData(raw, 1, 4); testOk1(newData.size()==4); @@ -114,8 +114,8 @@ static void testExternalAlloc() testOk1(newData[0]==14); // Check use of custom deleter - int localVar[4] = {1,2,3,4}; - callCounter tracker; + int32 localVar[4] = {1,2,3,4}; + callCounter tracker; testOk1(*tracker.count==0); epics::pvData::shared_vector locvar(localVar, @@ -207,15 +207,15 @@ static void testConst() testOk1(wr==ror); - int *compare = writable.data(); + int32 *compare = writable.data(); testOk1(writable.unique()); // can re-target container, but data is R/O - epics::pvData::shared_vector rodata(freeze(writable)); + epics::pvData::shared_vector rodata(freeze(writable)); - epics::pvData::shared_vector::reference wcr = rodata[0]; - epics::pvData::shared_vector::const_reference rocr = rodata[0]; + epics::pvData::shared_vector::reference wcr = rodata[0]; + epics::pvData::shared_vector::const_reference rocr = rodata[0]; testOk1(wcr==rocr); @@ -228,7 +228,7 @@ static void testConst() testOk1(rodata.data()==compare); - epics::pvData::shared_vector rodata2(rodata); + epics::pvData::shared_vector rodata2(rodata); testOk1(rodata.data()==rodata2.data()); @@ -293,7 +293,7 @@ static void testCapacity() epics::pvData::shared_vector vect(10, 100); - int *peek = vect.dataPtr().get(); + int32 *peek = vect.dataPtr().get(); vect.slice(0, 5); @@ -478,9 +478,9 @@ static void testICE() testDiag("Test freeze and thaw"); epics::pvData::shared_vector A(6, 42), C; - epics::pvData::shared_vector B, D; + epics::pvData::shared_vector B, D; - int *check = A.data(); + int32 *check = A.data(); // check freeze w/ unique reference From c86e31ad99288ef80b97694c936251e328a9c392 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 6 Nov 2014 12:38:01 +0100 Subject: [PATCH 10/15] vxWorks: type cast fixes --- src/misc/parseToPOD.cpp | 87 ++++++++++++++++++++++++++++++++++- src/pv/pvType.h | 2 +- testApp/misc/testTypeCast.cpp | 9 ++-- 3 files changed, 92 insertions(+), 6 deletions(-) diff --git a/src/misc/parseToPOD.cpp b/src/misc/parseToPOD.cpp index fa9bc85..d3c1598 100644 --- a/src/misc/parseToPOD.cpp +++ b/src/misc/parseToPOD.cpp @@ -308,6 +308,71 @@ noconvert: return 0; } +#if defined(__vxworks) +/* vxworks version of std::istringstream >>uint64_t is buggy, we use out own implementation */ +static +unsigned long long strtoull(const char *nptr, char **endptr, int base) +{ + const char *s = nptr; + unsigned long long acc; + int c; + unsigned long long cutoff; + int neg = 0, any, cutlim; + + do + c = *s++; + while (isspace(c)); + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) + { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + cutoff = (unsigned long long) UINT64_MAX / (unsigned long long) base; + cutlim = (unsigned long long) UINT64_MAX % (unsigned long long) base; + + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) + { + acc = UINT64_MAX; + errno = ERANGE; + } + else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (char *) s - 1 : (char *) nptr; + return (acc); +} +#else static unsigned long long strtoull(const char *ptr, char ** endp, int base) { @@ -350,7 +415,7 @@ noconvert: *endp = (char*)ptr; return 0; } - +#endif #endif /* do we need long long? */ @@ -486,6 +551,26 @@ void parseToPOD(const string& in, float *out) { void parseToPOD(const string& in, double *out) { int err = epicsParseDouble(in.c_str(), out, NULL); if(err) handleParseError(err); +#if defined(__vxworks) + /* vxWorks strtod returns [-]epicsINF when it should return ERANGE error + * if [-]epicsINF is returned and first char is a digit then translate this into ERANGE error + */ + else if (*out == epicsINF || *out == -epicsINF) { + const char* s = in.c_str(); + int c; + + /* skip spaces and the sign */ + do { + c = *s++; + } while (isspace(c)); + + if (c == '-' || c == '+') + c = *s++; + + if (isdigit(c)) + handleParseError(S_stdlib_overflow); + } +#endif } }}} diff --git a/src/pv/pvType.h b/src/pv/pvType.h index 506b835..89ec667 100644 --- a/src/pv/pvType.h +++ b/src/pv/pvType.h @@ -29,7 +29,7 @@ typedef int intptr_t; typedef unsigned int uintptr_t; #ifndef INT64_MAX #define INT64_MAX (0x7fffffffffffffffLL) -#define UINT64_MAX (0xffffffffffffffffLL) +#define UINT64_MAX (0xffffffffffffffffULL) #endif #else #include diff --git a/testApp/misc/testTypeCast.cpp b/testApp/misc/testTypeCast.cpp index efd46d8..cab5fb7 100644 --- a/testApp/misc/testTypeCast.cpp +++ b/testApp/misc/testTypeCast.cpp @@ -37,11 +37,11 @@ namespace { }; template<> struct testequal { - static bool op(double A, double B) {return fabs(A-B)<1e-300; } + static bool op(double A, double B) {return fabs(A-B)<1e-15; } }; template<> struct testequal { - static bool op(float A, float B) {return fabs(A-B)<1e-30; } + static bool op(float A, float B) {return fabs(A-B)<1e-7; } }; template @@ -117,7 +117,7 @@ namespace { MAIN(testTypeCast) { - testPlan(122); + testPlan(123); try { @@ -387,7 +387,8 @@ try { FAIL(int8_t, string, "1000"); FAIL(int8_t, string, "-1000"); - FAIL(double, string, "1e+10000000"); + FAIL(double, string, "1e+1000"); + FAIL(double, string, "-1e+1000"); FAIL(epics::pvData::boolean, string, "hello"); FAIL(epics::pvData::boolean, string, "1"); From 611703586331cc818a3d2607af90a46c1735cfc4 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 6 Nov 2014 12:48:57 +0100 Subject: [PATCH 11/15] null element handling for structure/union array --- src/factory/Compare.cpp | 16 ++++++++++++++-- src/factory/PVStructureArray.cpp | 9 +++++++-- src/factory/PVUnionArray.cpp | 9 +++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/factory/Compare.cpp b/src/factory/Compare.cpp index 6d902df..06b4e27 100644 --- a/src/factory/Compare.cpp +++ b/src/factory/Compare.cpp @@ -251,7 +251,13 @@ bool compareField(const PVStructureArray* left, const PVStructureArray* right) lit!=lend; ++lit, ++rit) { - if(**lit != **rit) + // element can be null + if (!(*lit) || !(*rit)) + { + if (*lit || *rit) + return false; + } + else if (**lit != **rit) return false; } return true; @@ -304,7 +310,13 @@ bool compareField(const PVUnionArray* left, const PVUnionArray* right) lit!=lend; ++lit, ++rit) { - if(**lit != **rit) + // element can be null + if (!(*lit) || !(*rit)) + { + if (*lit || *rit) + return false; + } + else if (**lit != **rit) return false; } return true; diff --git a/src/factory/PVStructureArray.cpp b/src/factory/PVStructureArray.cpp index 29e4663..b54ff85 100644 --- a/src/factory/PVStructureArray.cpp +++ b/src/factory/PVStructureArray.cpp @@ -232,8 +232,13 @@ std::ostream& PVStructureArray::dumpValue(std::ostream& o) const std::ostream& PVStructureArray::dumpValue(std::ostream& o, std::size_t index) const { const_svector temp(view()); - if(index Date: Thu, 6 Nov 2014 13:03:59 +0100 Subject: [PATCH 12/15] fixed undeterministic serialization test on clang --- testApp/misc/testSerialization.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testApp/misc/testSerialization.cpp b/testApp/misc/testSerialization.cpp index e88dbe9..8e619aa 100644 --- a/testApp/misc/testSerialization.cpp +++ b/testApp/misc/testSerialization.cpp @@ -716,7 +716,9 @@ void testArraySizeType() { serializationFieldTest(s); PVStructurePtr pvs = getPVDataCreate()->createPVStructure(s); - pvs->getSubField("fixedArray")->setLength(10); + PVDoubleArray::shared_pointer pvDA = pvs->getSubField("fixedArray"); + PVDoubleArray::svector vec(10, 42); + pvDA->replace(freeze(vec)); serializationTest(pvs); } From f36c8ce280b1634511a03c9e146f107aecc3cfdf Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 6 Nov 2014 14:28:49 +0100 Subject: [PATCH 13/15] testByteOrder: use MAIN instead of main --- testApp/misc/testByteOrder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testApp/misc/testByteOrder.cpp b/testApp/misc/testByteOrder.cpp index 123bfc3..57d7aa3 100644 --- a/testApp/misc/testByteOrder.cpp +++ b/testApp/misc/testByteOrder.cpp @@ -1,7 +1,8 @@ +#include #include #include -int main() +MAIN(testByteOrder) { printf("EPICS_BYTE_ORDER: %s\n", (EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE) ? "little" : "big"); printf("EPICS_FLOAT_WORD_ORDER: %s\n", (EPICS_FLOAT_WORD_ORDER == EPICS_ENDIAN_LITTLE) ? "little" : "big"); From 4e671a1c217478bd3d1f0ab78c0b9b8cf255620c Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 6 Nov 2014 22:18:58 +0100 Subject: [PATCH 14/15] win32 indent problem: local static DLL saga --- src/factory/PVStructureArray.cpp | 2 +- src/factory/PVUnionArray.cpp | 2 +- src/factory/printer.cpp | 9 ++++++++- src/pv/pvIntrospect.h | 6 +----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/factory/PVStructureArray.cpp b/src/factory/PVStructureArray.cpp index b54ff85..1536ad5 100644 --- a/src/factory/PVStructureArray.cpp +++ b/src/factory/PVStructureArray.cpp @@ -237,7 +237,7 @@ std::ostream& PVStructureArray::dumpValue(std::ostream& o, std::size_t index) co if (temp[index]) o << *temp[index]; else - o << "(none)" << std::endl; + o << format::indent() << "(none)" << std::endl; } return o; } diff --git a/src/factory/PVUnionArray.cpp b/src/factory/PVUnionArray.cpp index ccce916..0239ec1 100644 --- a/src/factory/PVUnionArray.cpp +++ b/src/factory/PVUnionArray.cpp @@ -236,7 +236,7 @@ std::ostream& PVUnionArray::dumpValue(std::ostream& o, std::size_t index) const if (temp[index]) o << *temp[index]; else - o << "(none)" << std::endl; + o << format::indent() << "(none)" << std::endl; } return o; } diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp index 85c9cdc..b225d80 100644 --- a/src/factory/printer.cpp +++ b/src/factory/printer.cpp @@ -26,7 +26,14 @@ namespace epics { namespace pvData { namespace format { - std::ostream& operator<<(std::ostream& os, indent_level const& indent) + static int indent_index = std::ios_base::xalloc(); + + long& indent_value(std::ios_base& ios) + { + return ios.iword(indent_index); + } + + std::ostream& operator<<(std::ostream& os, indent_level const& indent) { indent_value(os) = indent.level; return os; diff --git a/src/pv/pvIntrospect.h b/src/pv/pvIntrospect.h index 540d88f..4a966ad 100644 --- a/src/pv/pvIntrospect.h +++ b/src/pv/pvIntrospect.h @@ -32,11 +32,7 @@ struct indent_level indent_level(long l) : level(l) {} }; -inline long& indent_value(std::ios_base& ios) -{ - static int indent_index = std::ios_base::xalloc(); - return ios.iword(indent_index); -} +epicsShareExtern long& indent_value(std::ios_base& ios); epicsShareExtern std::ostream& operator<<(std::ostream& os, indent_level const& indent); From 278e5318061a00baec69d52ee842b4d5aec6a833 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 10 Nov 2014 21:30:48 +0100 Subject: [PATCH 15/15] PVUnion copy allways shallow --- src/factory/Convert.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/factory/Convert.cpp b/src/factory/Convert.cpp index ce00129..15a700a 100644 --- a/src/factory/Convert.cpp +++ b/src/factory/Convert.cpp @@ -462,17 +462,14 @@ void Convert::copyUnion(PVUnionPtr const & from, PVUnionPtr const & to) PVFieldPtr fromValue = from->get(); if (from->getUnion()->isVariant()) { - if (fromValue.get() == 0) - to->set(PVFieldPtr()); - else - to->set(getPVDataCreate()->createPVField(fromValue)); // clone value // TODO cache getPVDataCreate() + to->set(from->get()); } else { if (fromValue.get() == 0) to->select(PVUnion::UNDEFINED_INDEX); else - to->set(from->getSelectedFieldName(),from->get()); + to->set(from->getSelectedIndex(),from->get()); } }