Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
354fdd412f | ||
|
|
f3f6141e6a | ||
|
|
b9592eeb8c | ||
|
|
6a62f9c082 | ||
|
|
c5112ffa11 | ||
|
|
7b9fda4e81 | ||
|
|
278e531806 | ||
|
|
047de40642 | ||
|
|
4e671a1c21 | ||
|
|
f36c8ce280 | ||
|
|
e77f2c91d7 | ||
|
|
82b0d5ce5f | ||
|
|
6117035863 | ||
|
|
c86e31ad99 | ||
|
|
f506fe1c0e | ||
|
|
554dc06eda | ||
|
|
80e1dfd142 | ||
|
|
6db5cf60dc | ||
|
|
63d181a0ac | ||
|
|
73c4896cce | ||
|
|
5b1b5ab904 | ||
|
|
80a537bc4c | ||
|
|
2a8a1d3736 | ||
|
|
61fbfa0684 | ||
|
|
f06a6bfe7b |
4
.hgtags
4
.hgtags
@@ -14,3 +14,7 @@ d70c5ad29163306f50979a95b5aebbe9a93cfe76 2.0-BETA
|
|||||||
1348c22b125861ecb9da95b23f20314b167ee155 4.0.0
|
1348c22b125861ecb9da95b23f20314b167ee155 4.0.0
|
||||||
1348c22b125861ecb9da95b23f20314b167ee155 4.0.0
|
1348c22b125861ecb9da95b23f20314b167ee155 4.0.0
|
||||||
9c62aaa83b9db6ad69740a6bb46d6529e0e60b78 4.0.0
|
9c62aaa83b9db6ad69740a6bb46d6529e0e60b78 4.0.0
|
||||||
|
9c62aaa83b9db6ad69740a6bb46d6529e0e60b78 4.0.0
|
||||||
|
f9f187685032ebf4b108c759be196fda055c9e42 4.0.0
|
||||||
|
b0d39d12d743b82038066955db6bb957b1f2f767 4.0.1
|
||||||
|
af82285f71aae5d08fa8cf333b03772c5e689aff 4.0.2
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ CHECK_RELEASE = YES
|
|||||||
# INSTALL_LOCATION here.
|
# INSTALL_LOCATION here.
|
||||||
#INSTALL_LOCATION=</path/name/to/install/top>
|
#INSTALL_LOCATION=</path/name/to/install/top>
|
||||||
|
|
||||||
|
-include $(TOP)/../CONFIG_SITE.local
|
||||||
-include $(TOP)/configure/CONFIG_SITE.local
|
-include $(TOP)/configure/CONFIG_SITE.local
|
||||||
-include $(TOP)/../CONFIG.local
|
|
||||||
|
|
||||||
ifdef WITH_COVERAGE
|
ifdef WITH_COVERAGE
|
||||||
USR_CPPFLAGS += --coverage
|
USR_CPPFLAGS += --coverage
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<h1>EPICS pvDataCPP</h1>
|
<h1>EPICS pvDataCPP</h1>
|
||||||
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
||||||
|
|
||||||
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 08-Oct-2014</h2>
|
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 10-Nov-2014</h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Latest version:</dt>
|
<dt>Latest version:</dt>
|
||||||
@@ -46,11 +46,11 @@
|
|||||||
</dd>
|
</dd>
|
||||||
<dt>This version:</dt>
|
<dt>This version:</dt>
|
||||||
<dd><a
|
<dd><a
|
||||||
href="pvDataCPP_20140723.html">pvDataCPP_20140723.html</a>
|
href="pvDataCPP_20141110.html">pvDataCPP_20141110.html</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>Previous version:</dt>
|
<dt>Previous version:</dt>
|
||||||
<dd><a
|
<dd><a
|
||||||
href="pvDataCPP_20140708.html">pvDataCPP_20140708.html</a>
|
href="pvDataCPP_20140723.html">pvDataCPP_20140723.html</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>Editors:</dt>
|
<dt>Editors:</dt>
|
||||||
<dd>Marty Kraimer, BNL</dd>
|
<dd>Marty Kraimer, BNL</dd>
|
||||||
@@ -79,7 +79,7 @@ V4 control system programming environment:<br />
|
|||||||
|
|
||||||
<h2 class="nocount">Status of this Document</h2>
|
<h2 class="nocount">Status of this Document</h2>
|
||||||
|
|
||||||
<p>This is the 08-Oct-2014 version of the C++ implementation of pvData.
|
<p>This is the 10-Nov-2014 version of the C++ implementation of pvData.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>RELEASE_NOTES.md provides changes since the last release.
|
<p>RELEASE_NOTES.md provides changes since the last release.
|
||||||
|
|||||||
5478
documentation/pvDataCPP_20141110.html
Normal file
5478
documentation/pvDataCPP_20141110.html
Normal file
File diff suppressed because it is too large
Load Diff
255
pvDataCPP.files
255
pvDataCPP.files
@@ -234,3 +234,258 @@ testApp/pv/testPVType.cpp
|
|||||||
testApp/pv/testStandardField.cpp
|
testApp/pv/testStandardField.cpp
|
||||||
testApp/pv/testStandardPVField.cpp
|
testApp/pv/testStandardPVField.cpp
|
||||||
src/factory/printer.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
|
||||||
|
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
|
||||||
|
|||||||
@@ -3,4 +3,9 @@
|
|||||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/monitor
|
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/monitor
|
||||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/property
|
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/property
|
||||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pv
|
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pv
|
||||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pvMisc
|
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pvMisc
|
||||||
|
testApp/pv
|
||||||
|
testApp/copy
|
||||||
|
testApp/misc
|
||||||
|
testApp
|
||||||
|
testApp/property
|
||||||
|
|||||||
@@ -322,149 +322,155 @@ public:
|
|||||||
virtual PVStructurePtr createRequest(
|
virtual PVStructurePtr createRequest(
|
||||||
string const & crequest)
|
string const & crequest)
|
||||||
{
|
{
|
||||||
string request = crequest;
|
|
||||||
if (!request.empty()) removeBlanks(request);
|
|
||||||
if (request.empty())
|
|
||||||
{
|
|
||||||
return pvDataCreate->createPVStructure(fieldCreate->createStructure());
|
|
||||||
}
|
|
||||||
size_t offsetRecord = request.find("record[");
|
|
||||||
size_t offsetField = request.find("field(");
|
|
||||||
size_t offsetPutField = request.find("putField(");
|
|
||||||
size_t offsetGetField = request.find("getField(");
|
|
||||||
if(offsetRecord==string::npos
|
|
||||||
&& offsetField==string::npos
|
|
||||||
&& offsetPutField==string::npos
|
|
||||||
&& offsetGetField==string::npos)
|
|
||||||
{
|
|
||||||
request = "field(" + request + ")";
|
|
||||||
offsetField = request.find("field(");
|
|
||||||
}
|
|
||||||
int numParan = 0;
|
|
||||||
int numBrace = 0;
|
|
||||||
int numBracket = 0;
|
|
||||||
for(size_t i=0; i< request.length() ; ++i) {
|
|
||||||
char chr = request[i];
|
|
||||||
if(chr=='(') numParan++;
|
|
||||||
if(chr==')') numParan--;
|
|
||||||
if(chr=='{') numBrace++;
|
|
||||||
if(chr=='}') numBrace--;
|
|
||||||
if(chr=='[') numBracket++;
|
|
||||||
if(chr==']') numBracket--;
|
|
||||||
}
|
|
||||||
if(numParan!=0) {
|
|
||||||
ostringstream oss;
|
|
||||||
oss << "mismatched () " << numParan;
|
|
||||||
message = oss.str();
|
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
|
||||||
if(numBrace!=0) {
|
|
||||||
ostringstream oss;
|
|
||||||
oss << "mismatched {} " << numBrace;
|
|
||||||
message = oss.str();
|
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
|
||||||
if(numBracket!=0) {
|
|
||||||
ostringstream oss;
|
|
||||||
oss << "mismatched [] " << numBracket;
|
|
||||||
message = oss.str();
|
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
|
||||||
vector<Node> top;
|
|
||||||
try {
|
try {
|
||||||
if(offsetRecord!=string::npos) {
|
string request = crequest;
|
||||||
fullFieldName = "record";
|
if (!request.empty()) removeBlanks(request);
|
||||||
size_t openBracket = request.find('[', offsetRecord);
|
if (request.empty())
|
||||||
size_t closeBracket = request.find(']', openBracket);
|
{
|
||||||
if(closeBracket==string::npos) {
|
return pvDataCreate->createPVStructure(fieldCreate->createStructure());
|
||||||
message = request.substr(offsetRecord) +
|
}
|
||||||
"record[ does not have matching ]";
|
size_t offsetRecord = request.find("record[");
|
||||||
return PVStructurePtr();
|
size_t offsetField = request.find("field(");
|
||||||
|
size_t offsetPutField = request.find("putField(");
|
||||||
|
size_t offsetGetField = request.find("getField(");
|
||||||
|
if(offsetRecord==string::npos
|
||||||
|
&& offsetField==string::npos
|
||||||
|
&& offsetPutField==string::npos
|
||||||
|
&& offsetGetField==string::npos)
|
||||||
|
{
|
||||||
|
request = "field(" + request + ")";
|
||||||
|
offsetField = request.find("field(");
|
||||||
|
}
|
||||||
|
int numParan = 0;
|
||||||
|
int numBrace = 0;
|
||||||
|
int numBracket = 0;
|
||||||
|
for(size_t i=0; i< request.length() ; ++i) {
|
||||||
|
char chr = request[i];
|
||||||
|
if(chr=='(') numParan++;
|
||||||
|
if(chr==')') numParan--;
|
||||||
|
if(chr=='{') numBrace++;
|
||||||
|
if(chr=='}') numBrace--;
|
||||||
|
if(chr=='[') numBracket++;
|
||||||
|
if(chr==']') numBracket--;
|
||||||
|
}
|
||||||
|
if(numParan!=0) {
|
||||||
|
ostringstream oss;
|
||||||
|
oss << "mismatched () " << numParan;
|
||||||
|
message = oss.str();
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(numBrace!=0) {
|
||||||
|
ostringstream oss;
|
||||||
|
oss << "mismatched {} " << numBrace;
|
||||||
|
message = oss.str();
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(numBracket!=0) {
|
||||||
|
ostringstream oss;
|
||||||
|
oss << "mismatched [] " << numBracket;
|
||||||
|
message = oss.str();
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
vector<Node> top;
|
||||||
|
try {
|
||||||
|
if(offsetRecord!=string::npos) {
|
||||||
|
fullFieldName = "record";
|
||||||
|
size_t openBracket = request.find('[', offsetRecord);
|
||||||
|
size_t closeBracket = request.find(']', openBracket);
|
||||||
|
if(closeBracket==string::npos) {
|
||||||
|
message = request.substr(offsetRecord) +
|
||||||
|
"record[ does not have matching ]";
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(closeBracket-openBracket > 3) {
|
||||||
|
Node node("record");
|
||||||
|
Node optNode = createRequestOptions(
|
||||||
|
request.substr(openBracket+1,closeBracket-openBracket-1));
|
||||||
|
node.nodes.push_back(optNode);
|
||||||
|
top.push_back(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(closeBracket-openBracket > 3) {
|
if(offsetField!=string::npos) {
|
||||||
Node node("record");
|
fullFieldName = "field";
|
||||||
Node optNode = createRequestOptions(
|
Node node("field");
|
||||||
request.substr(openBracket+1,closeBracket-openBracket-1));
|
size_t openParan = request.find('(', offsetField);
|
||||||
node.nodes.push_back(optNode);
|
size_t closeParan = request.find(')', openParan);
|
||||||
|
if(closeParan==string::npos) {
|
||||||
|
message = request.substr(offsetField)
|
||||||
|
+ " field( does not have matching )";
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(closeParan>openParan+1) {
|
||||||
|
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
||||||
|
}
|
||||||
top.push_back(node);
|
top.push_back(node);
|
||||||
}
|
}
|
||||||
|
if(offsetGetField!=string::npos) {
|
||||||
|
fullFieldName = "getField";
|
||||||
|
Node node("getField");
|
||||||
|
size_t openParan = request.find('(', offsetGetField);
|
||||||
|
size_t closeParan = request.find(')', openParan);
|
||||||
|
if(closeParan==string::npos) {
|
||||||
|
message = request.substr(offsetField)
|
||||||
|
+ " getField( does not have matching )";
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(closeParan>openParan+1) {
|
||||||
|
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
||||||
|
}
|
||||||
|
top.push_back(node);
|
||||||
|
}
|
||||||
|
if(offsetPutField!=string::npos) {
|
||||||
|
fullFieldName = "putField";
|
||||||
|
Node node("putField");
|
||||||
|
size_t openParan = request.find('(', offsetPutField);
|
||||||
|
size_t closeParan = request.find(')', openParan);
|
||||||
|
if(closeParan==string::npos) {
|
||||||
|
message = request.substr(offsetField)
|
||||||
|
+ " putField( does not have matching )";
|
||||||
|
return PVStructurePtr();
|
||||||
|
}
|
||||||
|
if(closeParan>openParan+1) {
|
||||||
|
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
||||||
|
}
|
||||||
|
top.push_back(node);
|
||||||
|
}
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
string xxx = e.what();
|
||||||
|
message = "while creating Structure exception " + xxx;
|
||||||
|
return PVStructurePtr();
|
||||||
}
|
}
|
||||||
if(offsetField!=string::npos) {
|
size_t num = top.size();
|
||||||
fullFieldName = "field";
|
StringArray names(num);
|
||||||
Node node("field");
|
FieldConstPtrArray fields(num);
|
||||||
size_t openParan = request.find('(', offsetField);
|
for(size_t i=0; i<num; ++i) {
|
||||||
size_t closeParan = request.find(')', openParan);
|
Node node = top[i];
|
||||||
if(closeParan==string::npos) {
|
names[i] = node.name;
|
||||||
message = request.substr(offsetField)
|
vector<Node> subNode = node.nodes;
|
||||||
+ " field( does not have matching )";
|
if(subNode.empty()) {
|
||||||
return PVStructurePtr();
|
fields[i] = fieldCreate->createStructure();
|
||||||
|
} else {
|
||||||
|
fields[i] = createSubStructure(subNode);
|
||||||
}
|
}
|
||||||
if(closeParan>openParan+1) {
|
|
||||||
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
|
||||||
}
|
|
||||||
top.push_back(node);
|
|
||||||
}
|
}
|
||||||
if(offsetGetField!=string::npos) {
|
StructureConstPtr structure = fieldCreate->createStructure(names, fields);
|
||||||
fullFieldName = "getField";
|
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(structure);
|
||||||
Node node("getField");
|
for(size_t i=0; i<optionList.size(); ++i) {
|
||||||
size_t openParan = request.find('(', offsetGetField);
|
OptionPair pair = optionList[i];
|
||||||
size_t closeParan = request.find(')', openParan);
|
string name = pair.name;
|
||||||
if(closeParan==string::npos) {
|
string value = pair.value;
|
||||||
message = request.substr(offsetField)
|
PVStringPtr pvField = pvStructure->getSubField<PVString>(name);
|
||||||
+ " getField( does not have matching )";
|
pvField->put(value);
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
|
||||||
if(closeParan>openParan+1) {
|
|
||||||
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
|
||||||
}
|
|
||||||
top.push_back(node);
|
|
||||||
}
|
|
||||||
if(offsetPutField!=string::npos) {
|
|
||||||
fullFieldName = "putField";
|
|
||||||
Node node("putField");
|
|
||||||
size_t openParan = request.find('(', offsetPutField);
|
|
||||||
size_t closeParan = request.find(')', openParan);
|
|
||||||
if(closeParan==string::npos) {
|
|
||||||
message = request.substr(offsetField)
|
|
||||||
+ " putField( does not have matching )";
|
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
|
||||||
if(closeParan>openParan+1) {
|
|
||||||
createSubNode(node,request.substr(openParan+1,closeParan-openParan-1));
|
|
||||||
}
|
|
||||||
top.push_back(node);
|
|
||||||
}
|
}
|
||||||
|
optionList.clear();
|
||||||
|
return pvStructure;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
string xxx = e.what();
|
message = e.what();
|
||||||
message = "while creating Structure exception " + xxx;
|
return PVStructurePtr();
|
||||||
return PVStructurePtr();
|
|
||||||
}
|
}
|
||||||
size_t num = top.size();
|
|
||||||
StringArray names(num);
|
|
||||||
FieldConstPtrArray fields(num);
|
|
||||||
for(size_t i=0; i<num; ++i) {
|
|
||||||
Node node = top[i];
|
|
||||||
names[i] = node.name;
|
|
||||||
vector<Node> subNode = node.nodes;
|
|
||||||
if(subNode.empty()) {
|
|
||||||
fields[i] = fieldCreate->createStructure();
|
|
||||||
} else {
|
|
||||||
fields[i] = createSubStructure(subNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StructureConstPtr structure = fieldCreate->createStructure(names, fields);
|
|
||||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(structure);
|
|
||||||
for(size_t i=0; i<optionList.size(); ++i) {
|
|
||||||
OptionPair pair = optionList[i];
|
|
||||||
string name = pair.name;
|
|
||||||
string value = pair.value;
|
|
||||||
PVStringPtr pvField = pvStructure->getSubField<PVString>(name);
|
|
||||||
pvField->put(value);
|
|
||||||
}
|
|
||||||
optionList.clear();
|
|
||||||
return pvStructure;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateRequest::shared_pointer CreateRequest::create()
|
CreateRequest::shared_pointer CreateRequest::create()
|
||||||
|
|||||||
@@ -251,7 +251,13 @@ bool compareField(const PVStructureArray* left, const PVStructureArray* right)
|
|||||||
lit!=lend;
|
lit!=lend;
|
||||||
++lit, ++rit)
|
++lit, ++rit)
|
||||||
{
|
{
|
||||||
if(**lit != **rit)
|
// element can be null
|
||||||
|
if (!(*lit) || !(*rit))
|
||||||
|
{
|
||||||
|
if (*lit || *rit)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (**lit != **rit)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -304,7 +310,13 @@ bool compareField(const PVUnionArray* left, const PVUnionArray* right)
|
|||||||
lit!=lend;
|
lit!=lend;
|
||||||
++lit, ++rit)
|
++lit, ++rit)
|
||||||
{
|
{
|
||||||
if(**lit != **rit)
|
// element can be null
|
||||||
|
if (!(*lit) || !(*rit))
|
||||||
|
{
|
||||||
|
if (*lit || *rit)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (**lit != **rit)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -462,17 +462,14 @@ void Convert::copyUnion(PVUnionPtr const & from, PVUnionPtr const & to)
|
|||||||
PVFieldPtr fromValue = from->get();
|
PVFieldPtr fromValue = from->get();
|
||||||
if (from->getUnion()->isVariant())
|
if (from->getUnion()->isVariant())
|
||||||
{
|
{
|
||||||
if (fromValue.get() == 0)
|
to->set(from->get());
|
||||||
to->set(PVFieldPtr());
|
|
||||||
else
|
|
||||||
to->set(getPVDataCreate()->createPVField(fromValue)); // clone value // TODO cache getPVDataCreate()
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fromValue.get() == 0)
|
if (fromValue.get() == 0)
|
||||||
to->select(PVUnion::UNDEFINED_INDEX);
|
to->select(PVUnion::UNDEFINED_INDEX);
|
||||||
else
|
else
|
||||||
to->set(from->getSelectedFieldName(),from->get());
|
to->set(from->getSelectedIndex(),from->get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -232,8 +232,13 @@ std::ostream& PVStructureArray::dumpValue(std::ostream& o) const
|
|||||||
std::ostream& PVStructureArray::dumpValue(std::ostream& o, std::size_t index) const
|
std::ostream& PVStructureArray::dumpValue(std::ostream& o, std::size_t index) const
|
||||||
{
|
{
|
||||||
const_svector temp(view());
|
const_svector temp(view());
|
||||||
if(index<temp.size())
|
if (index<temp.size())
|
||||||
o << *temp[index];
|
{
|
||||||
|
if (temp[index])
|
||||||
|
o << *temp[index];
|
||||||
|
else
|
||||||
|
o << format::indent() << "(none)" << std::endl;
|
||||||
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,8 +231,13 @@ std::ostream& PVUnionArray::dumpValue(std::ostream& o) const
|
|||||||
std::ostream& PVUnionArray::dumpValue(std::ostream& o, std::size_t index) const
|
std::ostream& PVUnionArray::dumpValue(std::ostream& o, std::size_t index) const
|
||||||
{
|
{
|
||||||
const_svector temp(view());
|
const_svector temp(view());
|
||||||
if(index<temp.size())
|
if (index<temp.size())
|
||||||
o << *temp[index];
|
{
|
||||||
|
if (temp[index])
|
||||||
|
o << *temp[index];
|
||||||
|
else
|
||||||
|
o << format::indent() << "(none)" << std::endl;
|
||||||
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,14 @@ namespace epics { namespace pvData {
|
|||||||
|
|
||||||
namespace format
|
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;
|
indent_value(os) = indent.level;
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@@ -308,6 +308,71 @@ noconvert:
|
|||||||
return 0;
|
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
|
static
|
||||||
unsigned long long strtoull(const char *ptr, char ** endp, int base)
|
unsigned long long strtoull(const char *ptr, char ** endp, int base)
|
||||||
{
|
{
|
||||||
@@ -350,7 +415,7 @@ noconvert:
|
|||||||
*endp = (char*)ptr;
|
*endp = (char*)ptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* do we need long long? */
|
/* do we need long long? */
|
||||||
@@ -486,6 +551,26 @@ void parseToPOD(const string& in, float *out) {
|
|||||||
void parseToPOD(const string& in, double *out) {
|
void parseToPOD(const string& in, double *out) {
|
||||||
int err = epicsParseDouble(in.c_str(), out, NULL);
|
int err = epicsParseDouble(in.c_str(), out, NULL);
|
||||||
if(err) handleParseError(err);
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
|||||||
@@ -32,11 +32,7 @@ struct indent_level
|
|||||||
indent_level(long l) : level(l) {}
|
indent_level(long l) : level(l) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline long& indent_value(std::ios_base& ios)
|
epicsShareExtern long& indent_value(std::ios_base& ios);
|
||||||
{
|
|
||||||
static int indent_index = std::ios_base::xalloc();
|
|
||||||
return ios.iword(indent_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
epicsShareExtern std::ostream& operator<<(std::ostream& os, indent_level const& indent);
|
epicsShareExtern std::ostream& operator<<(std::ostream& os, indent_level const& indent);
|
||||||
|
|
||||||
@@ -1153,7 +1149,7 @@ epicsShareExtern FieldCreatePtr getFieldCreate();
|
|||||||
* value (eg -1).
|
* value (eg -1).
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ScalarTypeID { enum {value=-1}; };
|
struct ScalarTypeID {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static mapping from ScalarType enum to value type.
|
* Static mapping from ScalarType enum to value type.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ typedef int intptr_t;
|
|||||||
typedef unsigned int uintptr_t;
|
typedef unsigned int uintptr_t;
|
||||||
#ifndef INT64_MAX
|
#ifndef INT64_MAX
|
||||||
#define INT64_MAX (0x7fffffffffffffffLL)
|
#define INT64_MAX (0x7fffffffffffffffLL)
|
||||||
#define UINT64_MAX (0xffffffffffffffffLL)
|
#define UINT64_MAX (0xffffffffffffffffULL)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
@@ -1,8 +1,31 @@
|
|||||||
|
# Makefile for the pvData tests
|
||||||
|
|
||||||
TOP = ..
|
TOP = ..
|
||||||
include $(TOP)/configure/CONFIG
|
include $(TOP)/configure/CONFIG
|
||||||
DIRS += misc
|
|
||||||
DIRS += pv
|
PVDATA_TEST = $(TOP)/testApp
|
||||||
DIRS += property
|
|
||||||
DIRS += copy
|
PROD_LIBS += pvData Com
|
||||||
include $(TOP)/configure/RULES_DIRS
|
|
||||||
|
include $(PVDATA_TEST)/misc/Makefile
|
||||||
|
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 += $(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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,13 @@
|
|||||||
TOP=../..
|
# This is a Makefile fragment, see ../Makefile
|
||||||
|
|
||||||
include $(TOP)/configure/CONFIG
|
SRC_DIRS += $(PVDATA_TEST)/copy
|
||||||
|
|
||||||
PROD_HOST += testCreateRequest
|
TESTPROD_HOST += testCreateRequest
|
||||||
testCreateRequest_SRCS = testCreateRequest.cpp
|
testCreateRequest_SRCS = testCreateRequest.cpp
|
||||||
testCreateRequest_LIBS = pvData Com
|
testHarness_SRCS += testCreateRequest.cpp
|
||||||
TESTS += testCreateRequest
|
TESTS += testCreateRequest
|
||||||
|
|
||||||
PROD_HOST += testPVCopy
|
TESTPROD_HOST += testPVCopy
|
||||||
testPVCopy_SRCS += testPVCopy.cpp
|
testPVCopy_SRCS += testPVCopy.cpp
|
||||||
testPVCopy_LIBS += pvData Com
|
testHarness_SRCS += testPVCopy.cpp
|
||||||
TESTS += testPVCopy
|
TESTS += testPVCopy
|
||||||
|
|
||||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include $(TOP)/configure/RULES
|
|
||||||
#----------------------------------------
|
|
||||||
# ADD RULES AFTER THIS LINE
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using std::endl;
|
|||||||
|
|
||||||
static bool debug = false;
|
static bool debug = false;
|
||||||
|
|
||||||
static void testCreateRequest() {
|
static void testCreateRequestInternal() {
|
||||||
printf("testCreateRequest... \n");
|
printf("testCreateRequest... \n");
|
||||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||||
PVStringPtr pvString;
|
PVStringPtr pvString;
|
||||||
@@ -30,7 +30,7 @@ static void testCreateRequest() {
|
|||||||
string request = "";
|
string request = "";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getStructure()->getNumberFields()==0);
|
testOk1(pvRequest->getStructure()->getNumberFields()==0);
|
||||||
@@ -39,7 +39,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[]field()getField()putField()";
|
request = "record[]field()getField()putField()";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("field").get()!=NULL);
|
testOk1(pvRequest->getSubField("field").get()!=NULL);
|
||||||
@@ -50,7 +50,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[a=b,x=y]field(a) putField(a),getField(a)";
|
request = "record[a=b,x=y]field(a) putField(a),getField(a)";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("record._options.a");
|
pvString = pvRequest->getSubField<PVString>("record._options.a");
|
||||||
@@ -67,7 +67,7 @@ static void testCreateRequest() {
|
|||||||
request = "field(a.b[x=y])";
|
request = "field(a.b[x=y])";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
||||||
@@ -78,7 +78,7 @@ static void testCreateRequest() {
|
|||||||
request = "field(a.b{c.d})";
|
request = "field(a.b{c.d})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("field.a.b.c.d").get()!=NULL);
|
testOk1(pvRequest->getSubField("field.a.b.c.d").get()!=NULL);
|
||||||
@@ -87,7 +87,7 @@ static void testCreateRequest() {
|
|||||||
request = "field(a.b[x=y]{c.d})";
|
request = "field(a.b[x=y]{c.d})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
||||||
@@ -99,7 +99,7 @@ static void testCreateRequest() {
|
|||||||
request = "field(a.b[x=y]{c.d[x=y]})";
|
request = "field(a.b[x=y]{c.d[x=y]})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
pvString = pvRequest->getSubField<PVString>("field.a.b._options.x");
|
||||||
@@ -113,7 +113,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[a=b,c=d] field(a.a[a=b]{a.a[a=b]},b.a[a=b]{a,b})";
|
request = "record[a=b,c=d] field(a.a[a=b]{a.a[a=b]},b.a[a=b]{a,b})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("field.a.a._options.a");
|
pvString = pvRequest->getSubField<PVString>("field.a.a._options.a");
|
||||||
@@ -133,7 +133,7 @@ static void testCreateRequest() {
|
|||||||
request = "alarm,timeStamp,power.value";
|
request = "alarm,timeStamp,power.value";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("field.alarm").get()!=NULL);
|
testOk1(pvRequest->getSubField("field.alarm").get()!=NULL);
|
||||||
@@ -144,7 +144,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[process=true]field(alarm,timeStamp,power.value)";
|
request = "record[process=true]field(alarm,timeStamp,power.value)";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("record._options.process");
|
pvString = pvRequest->getSubField<PVString>("record._options.process");
|
||||||
@@ -158,7 +158,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[process=true]field(alarm,timeStamp[algorithm=onChange,causeMonitor=false],power{value,alarm})";
|
request = "record[process=true]field(alarm,timeStamp[algorithm=onChange,causeMonitor=false],power{value,alarm})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("record._options.process");
|
pvString = pvRequest->getSubField<PVString>("record._options.process");
|
||||||
@@ -179,7 +179,7 @@ static void testCreateRequest() {
|
|||||||
request = "record[int=2,float=3.14159]field(alarm,timeStamp[shareData=true],power.value)";
|
request = "record[int=2,float=3.14159]field(alarm,timeStamp[shareData=true],power.value)";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
pvString = pvRequest->getSubField<PVString>("record._options.int");
|
pvString = pvRequest->getSubField<PVString>("record._options.int");
|
||||||
@@ -201,7 +201,7 @@ static void testCreateRequest() {
|
|||||||
+ "current{value,alarm},voltage{value,alarm})";
|
+ "current{value,alarm},voltage{value,alarm})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("putField.power.value").get()!=NULL);
|
testOk1(pvRequest->getSubField("putField.power.value").get()!=NULL);
|
||||||
@@ -221,7 +221,7 @@ static void testCreateRequest() {
|
|||||||
+ "})";
|
+ "})";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("field.alarm").get()!=NULL);
|
testOk1(pvRequest->getSubField("field.alarm").get()!=NULL);
|
||||||
@@ -243,7 +243,7 @@ static void testCreateRequest() {
|
|||||||
+ ")";
|
+ ")";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("putField.power.value").get()!=NULL);
|
testOk1(pvRequest->getSubField("putField.power.value").get()!=NULL);
|
||||||
@@ -276,7 +276,7 @@ static void testCreateRequest() {
|
|||||||
request = "a{b{c{d}}}";
|
request = "a{b{c{d}}}";
|
||||||
if(debug) { cout << "request " << request <<endl;}
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
pvRequest = createRequest->createRequest(request);
|
pvRequest = createRequest->createRequest(request);
|
||||||
if(pvRequest.get()==NULL) { cout<< createRequest->getMessage() << endl;}
|
if(!pvRequest) { cout<< createRequest->getMessage() << endl;}
|
||||||
if(debug) { cout << *pvRequest << endl;}
|
if(debug) { cout << *pvRequest << endl;}
|
||||||
testOk1(pvRequest.get()!=NULL);
|
testOk1(pvRequest.get()!=NULL);
|
||||||
testOk1(pvRequest->getSubField("field.a.b.c.d").get()!=NULL);
|
testOk1(pvRequest->getSubField("field.a.b.c.d").get()!=NULL);
|
||||||
@@ -302,12 +302,20 @@ static void testCreateRequest() {
|
|||||||
cout << "reason " << createRequest->getMessage() << endl;
|
cout << "reason " << createRequest->getMessage() << endl;
|
||||||
testOk1(pvRequest.get()==NULL);
|
testOk1(pvRequest.get()==NULL);
|
||||||
testPass("request %s",request.c_str());
|
testPass("request %s",request.c_str());
|
||||||
|
|
||||||
|
request = "field(alarm.status,alarm.severity)";
|
||||||
|
if(debug) { cout << "request " << request <<endl;}
|
||||||
|
cout << endl << "Error Expected for next call!!" << endl;
|
||||||
|
pvRequest = createRequest->createRequest(request);
|
||||||
|
cout << "reason " << createRequest->getMessage() << endl;
|
||||||
|
testOk1(pvRequest.get()==NULL);
|
||||||
|
testPass("request %s",request.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
MAIN(testCreateRequest)
|
MAIN(testCreateRequest)
|
||||||
{
|
{
|
||||||
testPlan(117);
|
testPlan(119);
|
||||||
testCreateRequest();
|
testCreateRequestInternal();
|
||||||
return testDone();
|
return testDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +1,66 @@
|
|||||||
TOP=../..
|
# This is a Makefile fragment, see ../Makefile
|
||||||
|
|
||||||
include $(TOP)/configure/CONFIG
|
SRC_DIRS += $(PVDATA_TEST)/misc
|
||||||
|
|
||||||
PROD_LIBS += pvData Com
|
TESTPROD_HOST += testThread
|
||||||
|
|
||||||
PROD_HOST += testThread
|
|
||||||
testThread_SRCS += testThread.cpp
|
testThread_SRCS += testThread.cpp
|
||||||
|
testHarness_SRCS += testThread.cpp
|
||||||
TESTS += testThread
|
TESTS += testThread
|
||||||
|
|
||||||
PROD_HOST += testTimer
|
TESTPROD_HOST += testTimer
|
||||||
testTimer_SRCS += testTimer.cpp
|
testTimer_SRCS += testTimer.cpp
|
||||||
|
testHarness_SRCS += testTimer.cpp
|
||||||
TESTS += testTimer
|
TESTS += testTimer
|
||||||
|
|
||||||
PROD_HOST += testBitSet
|
TESTPROD_HOST += testBitSet
|
||||||
testBitSet_SRCS += testBitSet.cpp
|
testBitSet_SRCS += testBitSet.cpp
|
||||||
|
testHarness_SRCS += testBitSet.cpp
|
||||||
TESTS += testBitSet
|
TESTS += testBitSet
|
||||||
|
|
||||||
PROD_HOST += testOverrunBitSet
|
TESTPROD_HOST += testOverrunBitSet
|
||||||
testOverrunBitSet_SRCS += testOverrunBitSet.cpp
|
testOverrunBitSet_SRCS += testOverrunBitSet.cpp
|
||||||
|
testHarness_SRCS += testOverrunBitSet.cpp
|
||||||
TESTS += testOverrunBitSet
|
TESTS += testOverrunBitSet
|
||||||
|
|
||||||
PROD_HOST += testByteOrder
|
TESTPROD_HOST += testByteOrder
|
||||||
testByteOrder_SRCS += testByteOrder.cpp
|
testByteOrder_SRCS += testByteOrder.cpp
|
||||||
|
|
||||||
PROD_HOST += testByteBuffer
|
TESTPROD_HOST += testByteBuffer
|
||||||
testByteBuffer_SRCS += testByteBuffer.cpp
|
testByteBuffer_SRCS += testByteBuffer.cpp
|
||||||
|
testHarness_SRCS += testByteBuffer.cpp
|
||||||
TESTS += testByteBuffer
|
TESTS += testByteBuffer
|
||||||
|
|
||||||
PROD_HOST += testBaseException
|
TESTPROD_HOST += testBaseException
|
||||||
testBaseException_SRCS += testBaseException.cpp
|
testBaseException_SRCS += testBaseException.cpp
|
||||||
|
testHarness_SRCS += testBaseException.cpp
|
||||||
TESTS += testBaseException
|
TESTS += testBaseException
|
||||||
|
|
||||||
PROD_HOST += testSharedVector
|
TESTPROD_HOST += testSharedVector
|
||||||
testSharedVector_SRCS += testSharedVector.cpp
|
testSharedVector_SRCS += testSharedVector.cpp
|
||||||
|
testHarness_SRCS += testSharedVector.cpp
|
||||||
TESTS += testSharedVector
|
TESTS += testSharedVector
|
||||||
|
|
||||||
PROD_HOST += testSerialization
|
TESTPROD_HOST += testSerialization
|
||||||
testSerialization_SRCS += testSerialization.cpp
|
testSerialization_SRCS += testSerialization.cpp
|
||||||
|
testHarness_SRCS += testSerialization.cpp
|
||||||
TESTS += testSerialization
|
TESTS += testSerialization
|
||||||
|
|
||||||
PROD_HOST += testTimeStamp
|
TESTPROD_HOST += testTimeStamp
|
||||||
testTimeStamp_SRCS += testTimeStamp.cpp
|
testTimeStamp_SRCS += testTimeStamp.cpp
|
||||||
|
testHarness_SRCS += testTimeStamp.cpp
|
||||||
TESTS += testTimeStamp
|
TESTS += testTimeStamp
|
||||||
|
|
||||||
PROD_HOST += testQueue
|
TESTPROD_HOST += testQueue
|
||||||
testQueue_SRCS += testQueue.cpp
|
testQueue_SRCS += testQueue.cpp
|
||||||
|
testHarness_SRCS += testQueue.cpp
|
||||||
TESTS += testQueue
|
TESTS += testQueue
|
||||||
|
|
||||||
PROD_HOST += testMessageQueue
|
TESTPROD_HOST += testMessageQueue
|
||||||
testMessageQueue_SRCS += testMessageQueue.cpp
|
testMessageQueue_SRCS += testMessageQueue.cpp
|
||||||
|
testHarness_SRCS += testMessageQueue.cpp
|
||||||
TESTS += testMessageQueue
|
TESTS += testMessageQueue
|
||||||
|
|
||||||
PROD_HOST += testTypeCast
|
TESTPROD_HOST += testTypeCast
|
||||||
testTypeCast_SRCS += testTypeCast.cpp
|
testTypeCast_SRCS += testTypeCast.cpp
|
||||||
|
testHarness_SRCS += testTypeCast.cpp
|
||||||
TESTS += testTypeCast
|
TESTS += testTypeCast
|
||||||
|
|
||||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
|
||||||
|
|
||||||
include $(TOP)/configure/RULES
|
|
||||||
#----------------------------------------
|
|
||||||
# ADD RULES AFTER THIS LINE
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void internalTestBaseException(int /*unused*/ = 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBaseException() {
|
void testBaseExceptionTest() {
|
||||||
printf("testBaseException... ");
|
printf("testBaseException... ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -86,7 +86,7 @@ MAIN(testBaseException)
|
|||||||
testPlan(2);
|
testPlan(2);
|
||||||
testDiag("Tests base exception");
|
testDiag("Tests base exception");
|
||||||
testLogicException();
|
testLogicException();
|
||||||
testBaseException();
|
testBaseExceptionTest();
|
||||||
return testDone();
|
return testDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
#include <testMain.h>
|
||||||
#include <epicsEndian.h>
|
#include <epicsEndian.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
MAIN(testByteOrder)
|
||||||
{
|
{
|
||||||
printf("EPICS_BYTE_ORDER: %s\n", (EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE) ? "little" : "big");
|
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");
|
printf("EPICS_FLOAT_WORD_ORDER: %s\n", (EPICS_FLOAT_WORD_ORDER == EPICS_ENDIAN_LITTLE) ? "little" : "big");
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ void test()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MAIN(testOverrunBitSet`)
|
MAIN(testOverrunBitSet)
|
||||||
{
|
{
|
||||||
testPlan(41);
|
testPlan(41);
|
||||||
testDiag("Tests for changeBitSet and overrunBitSet");
|
testDiag("Tests for changeBitSet and overrunBitSet");
|
||||||
|
|||||||
@@ -716,7 +716,9 @@ void testArraySizeType() {
|
|||||||
serializationFieldTest(s);
|
serializationFieldTest(s);
|
||||||
|
|
||||||
PVStructurePtr pvs = getPVDataCreate()->createPVStructure(s);
|
PVStructurePtr pvs = getPVDataCreate()->createPVStructure(s);
|
||||||
pvs->getSubField<PVArray>("fixedArray")->setLength(10);
|
PVDoubleArray::shared_pointer pvDA = pvs->getSubField<PVDoubleArray>("fixedArray");
|
||||||
|
PVDoubleArray::svector vec(10, 42);
|
||||||
|
pvDA->replace(freeze(vec));
|
||||||
serializationTest(pvs);
|
serializationTest(pvs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,7 +792,6 @@ MAIN(testSerialization) {
|
|||||||
delete control;
|
delete control;
|
||||||
delete flusher;
|
delete flusher;
|
||||||
|
|
||||||
epicsExitCallAtExits();
|
|
||||||
return testDone();
|
return testDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,12 @@
|
|||||||
#include "pv/sharedVector.h"
|
#include "pv/sharedVector.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
using namespace epics::pvData;
|
||||||
|
|
||||||
static void testEmpty()
|
static void testEmpty()
|
||||||
{
|
{
|
||||||
testDiag("Test empty vector");
|
testDiag("Test empty vector");
|
||||||
epics::pvData::shared_vector<int> empty, empty2;
|
epics::pvData::shared_vector<int32> empty, empty2;
|
||||||
|
|
||||||
testOk1(empty.size()==0);
|
testOk1(empty.size()==0);
|
||||||
testOk1(empty.empty());
|
testOk1(empty.empty());
|
||||||
@@ -42,7 +43,7 @@ static void testInternalAlloc()
|
|||||||
{
|
{
|
||||||
testDiag("Test vector alloc w/ new[]");
|
testDiag("Test vector alloc w/ new[]");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> internal(5);
|
epics::pvData::shared_vector<int32> internal(5);
|
||||||
|
|
||||||
testOk1(internal.size()==5);
|
testOk1(internal.size()==5);
|
||||||
testOk1(!internal.empty());
|
testOk1(!internal.empty());
|
||||||
@@ -57,7 +58,7 @@ static void testInternalAlloc()
|
|||||||
internal[2] = 42;
|
internal[2] = 42;
|
||||||
testOk1(internal[2]==42);
|
testOk1(internal[2]==42);
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> internal2(15, 500);
|
epics::pvData::shared_vector<int32> internal2(15, 500);
|
||||||
|
|
||||||
testOk1(internal2.size()==15);
|
testOk1(internal2.size()==15);
|
||||||
testOk1(internal2[1]==500);
|
testOk1(internal2[1]==500);
|
||||||
@@ -79,8 +80,8 @@ namespace {
|
|||||||
//Note: STL shared_ptr requires that deletors be copy constructable
|
//Note: STL shared_ptr requires that deletors be copy constructable
|
||||||
template<typename E>
|
template<typename E>
|
||||||
struct callCounter {
|
struct callCounter {
|
||||||
std::tr1::shared_ptr<int> count;
|
std::tr1::shared_ptr<int32> count;
|
||||||
callCounter():count(new int){*count=0;}
|
callCounter():count(new int32){*count=0;}
|
||||||
callCounter(const callCounter& o):count(o.count) {};
|
callCounter(const callCounter& o):count(o.count) {};
|
||||||
callCounter& operator=(const callCounter& o){count=o.count;}
|
callCounter& operator=(const callCounter& o){count=o.count;}
|
||||||
void operator()(E){*count=1;}
|
void operator()(E){*count=1;}
|
||||||
@@ -92,8 +93,8 @@ static void testExternalAlloc()
|
|||||||
testDiag("Test vector external alloc");
|
testDiag("Test vector external alloc");
|
||||||
|
|
||||||
// Simulate a failed malloc() or similar
|
// Simulate a failed malloc() or similar
|
||||||
int *oops=0;
|
int32 *oops=0;
|
||||||
epics::pvData::shared_vector<int> nullPtr(oops, 42, 100);
|
epics::pvData::shared_vector<int32> nullPtr(oops, 42, 100);
|
||||||
|
|
||||||
testOk1(nullPtr.size()==0);
|
testOk1(nullPtr.size()==0);
|
||||||
testOk1(nullPtr.empty());
|
testOk1(nullPtr.empty());
|
||||||
@@ -102,8 +103,8 @@ static void testExternalAlloc()
|
|||||||
|
|
||||||
testOk1(nullPtr.data()==NULL);
|
testOk1(nullPtr.data()==NULL);
|
||||||
|
|
||||||
int *raw=new int[5];
|
int32 *raw=new int32[5];
|
||||||
epics::pvData::shared_vector<int> newData(raw, 1, 4);
|
epics::pvData::shared_vector<int32> newData(raw, 1, 4);
|
||||||
|
|
||||||
testOk1(newData.size()==4);
|
testOk1(newData.size()==4);
|
||||||
testOk1(!newData.empty());
|
testOk1(!newData.empty());
|
||||||
@@ -113,11 +114,11 @@ static void testExternalAlloc()
|
|||||||
testOk1(newData[0]==14);
|
testOk1(newData[0]==14);
|
||||||
|
|
||||||
// Check use of custom deleter
|
// Check use of custom deleter
|
||||||
int localVar[4] = {1,2,3,4};
|
int32 localVar[4] = {1,2,3,4};
|
||||||
callCounter<int*> tracker;
|
callCounter<int32*> tracker;
|
||||||
testOk1(*tracker.count==0);
|
testOk1(*tracker.count==0);
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> locvar(localVar,
|
epics::pvData::shared_vector<int32> locvar(localVar,
|
||||||
tracker,
|
tracker,
|
||||||
0, 4);
|
0, 4);
|
||||||
|
|
||||||
@@ -137,8 +138,8 @@ static void testShare()
|
|||||||
{
|
{
|
||||||
testDiag("Test vector Sharing");
|
testDiag("Test vector Sharing");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> one, two(15);
|
epics::pvData::shared_vector<int32> one, two(15);
|
||||||
epics::pvData::shared_vector<int> three(two);
|
epics::pvData::shared_vector<int32> three(two);
|
||||||
|
|
||||||
testOk1(one.unique());
|
testOk1(one.unique());
|
||||||
testOk1(!two.unique());
|
testOk1(!two.unique());
|
||||||
@@ -199,22 +200,22 @@ static void testConst()
|
|||||||
{
|
{
|
||||||
testDiag("Test constant vector");
|
testDiag("Test constant vector");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> writable(15, 100);
|
epics::pvData::shared_vector<int32> writable(15, 100);
|
||||||
|
|
||||||
epics::pvData::shared_vector<int>::reference wr = writable[0];
|
epics::pvData::shared_vector<int32>::reference wr = writable[0];
|
||||||
epics::pvData::shared_vector<int>::const_reference ror = writable[0];
|
epics::pvData::shared_vector<int32>::const_reference ror = writable[0];
|
||||||
|
|
||||||
testOk1(wr==ror);
|
testOk1(wr==ror);
|
||||||
|
|
||||||
int *compare = writable.data();
|
int32 *compare = writable.data();
|
||||||
|
|
||||||
testOk1(writable.unique());
|
testOk1(writable.unique());
|
||||||
|
|
||||||
// can re-target container, but data is R/O
|
// can re-target container, but data is R/O
|
||||||
epics::pvData::shared_vector<const int> rodata(freeze(writable));
|
epics::pvData::shared_vector<const int32> rodata(freeze(writable));
|
||||||
|
|
||||||
epics::pvData::shared_vector<const int>::reference wcr = rodata[0];
|
epics::pvData::shared_vector<const int32>::reference wcr = rodata[0];
|
||||||
epics::pvData::shared_vector<const int>::const_reference rocr = rodata[0];
|
epics::pvData::shared_vector<const int32>::const_reference rocr = rodata[0];
|
||||||
|
|
||||||
testOk1(wcr==rocr);
|
testOk1(wcr==rocr);
|
||||||
|
|
||||||
@@ -227,7 +228,7 @@ static void testConst()
|
|||||||
|
|
||||||
testOk1(rodata.data()==compare);
|
testOk1(rodata.data()==compare);
|
||||||
|
|
||||||
epics::pvData::shared_vector<const int> rodata2(rodata);
|
epics::pvData::shared_vector<const int32> rodata2(rodata);
|
||||||
|
|
||||||
testOk1(rodata.data()==rodata2.data());
|
testOk1(rodata.data()==rodata2.data());
|
||||||
|
|
||||||
@@ -240,9 +241,9 @@ static void testSlice()
|
|||||||
{
|
{
|
||||||
testDiag("Test vector slicing");
|
testDiag("Test vector slicing");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> original(10, 100);
|
epics::pvData::shared_vector<int32> original(10, 100);
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> half1(original), half2(original), half2a(original);
|
epics::pvData::shared_vector<int32> half1(original), half2(original), half2a(original);
|
||||||
|
|
||||||
half1.slice(0, 5);
|
half1.slice(0, 5);
|
||||||
half2.slice(5, 5);
|
half2.slice(5, 5);
|
||||||
@@ -290,9 +291,9 @@ static void testCapacity()
|
|||||||
{
|
{
|
||||||
testDiag("Test vector capacity");
|
testDiag("Test vector capacity");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> vect(10, 100);
|
epics::pvData::shared_vector<int32> vect(10, 100);
|
||||||
|
|
||||||
int *peek = vect.dataPtr().get();
|
int32 *peek = vect.dataPtr().get();
|
||||||
|
|
||||||
vect.slice(0, 5);
|
vect.slice(0, 5);
|
||||||
|
|
||||||
@@ -330,7 +331,7 @@ static void testCapacity()
|
|||||||
|
|
||||||
static void testPush()
|
static void testPush()
|
||||||
{
|
{
|
||||||
epics::pvData::shared_vector<int> vect;
|
epics::pvData::shared_vector<int32> vect;
|
||||||
|
|
||||||
testDiag("Test push_back optimizations");
|
testDiag("Test push_back optimizations");
|
||||||
|
|
||||||
@@ -357,7 +358,7 @@ static void testVoid()
|
|||||||
{
|
{
|
||||||
testDiag("Test vecter cast to/from void");
|
testDiag("Test vecter cast to/from void");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> typed(4);
|
epics::pvData::shared_vector<int32> typed(4);
|
||||||
|
|
||||||
epics::pvData::shared_vector<void> untyped2(epics::pvData::static_shared_vector_cast<void>(typed));
|
epics::pvData::shared_vector<void> untyped2(epics::pvData::static_shared_vector_cast<void>(typed));
|
||||||
|
|
||||||
@@ -366,7 +367,7 @@ static void testVoid()
|
|||||||
|
|
||||||
untyped2.slice(sizeof(int), 2*sizeof(int));
|
untyped2.slice(sizeof(int), 2*sizeof(int));
|
||||||
|
|
||||||
typed = epics::pvData::static_shared_vector_cast<int>(untyped2);
|
typed = epics::pvData::static_shared_vector_cast<int32>(untyped2);
|
||||||
|
|
||||||
testOk1(typed.dataOffset()==1);
|
testOk1(typed.dataOffset()==1);
|
||||||
testOk1(typed.size()==2);
|
testOk1(typed.size()==2);
|
||||||
@@ -406,7 +407,7 @@ static void testVectorConvert()
|
|||||||
{
|
{
|
||||||
testDiag("Test shared_vector_convert");
|
testDiag("Test shared_vector_convert");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> ints(6, 42), moreints;
|
epics::pvData::shared_vector<int32> ints(6, 42), moreints;
|
||||||
epics::pvData::shared_vector<float> floats;
|
epics::pvData::shared_vector<float> floats;
|
||||||
epics::pvData::shared_vector<string> strings;
|
epics::pvData::shared_vector<string> strings;
|
||||||
epics::pvData::shared_vector<void> voids;
|
epics::pvData::shared_vector<void> voids;
|
||||||
@@ -414,7 +415,7 @@ static void testVectorConvert()
|
|||||||
testOk1(ints.unique());
|
testOk1(ints.unique());
|
||||||
|
|
||||||
// no-op convert. Just returns another reference
|
// no-op convert. Just returns another reference
|
||||||
moreints = epics::pvData::shared_vector_convert<int>(ints);
|
moreints = epics::pvData::shared_vector_convert<int32>(ints);
|
||||||
|
|
||||||
testOk1(!ints.unique());
|
testOk1(!ints.unique());
|
||||||
moreints.clear();
|
moreints.clear();
|
||||||
@@ -432,11 +433,12 @@ static void testVectorConvert()
|
|||||||
voids = epics::pvData::shared_vector_convert<void>(ints);
|
voids = epics::pvData::shared_vector_convert<void>(ints);
|
||||||
|
|
||||||
testOk1(!ints.unique());
|
testOk1(!ints.unique());
|
||||||
testOk1(voids.size()==ints.size()*sizeof(int));
|
testOk1(voids.size()==ints.size()*sizeof(int32));
|
||||||
|
|
||||||
// convert from void uses shared_vector<void>::original_type()
|
// convert from void uses shared_vector<void>::original_type()
|
||||||
// to find that the actual type is 'int'.
|
// to find that the actual type is 'int32'.
|
||||||
// returns a new vector
|
// returns a new vector
|
||||||
|
testOk1(voids.original_type()==epics::pvData::pvInt);
|
||||||
strings = epics::pvData::shared_vector_convert<string>(voids);
|
strings = epics::pvData::shared_vector_convert<string>(voids);
|
||||||
|
|
||||||
voids.clear();
|
voids.clear();
|
||||||
@@ -450,11 +452,11 @@ static void testWeak()
|
|||||||
{
|
{
|
||||||
testDiag("Test weak_ptr counting");
|
testDiag("Test weak_ptr counting");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> data(6);
|
epics::pvData::shared_vector<int32> data(6);
|
||||||
|
|
||||||
testOk1(data.unique());
|
testOk1(data.unique());
|
||||||
|
|
||||||
std::tr1::shared_ptr<int> pdata(data.dataPtr());
|
std::tr1::shared_ptr<int32> pdata(data.dataPtr());
|
||||||
|
|
||||||
testOk1(!data.unique());
|
testOk1(!data.unique());
|
||||||
|
|
||||||
@@ -462,7 +464,7 @@ static void testWeak()
|
|||||||
|
|
||||||
testOk1(data.unique());
|
testOk1(data.unique());
|
||||||
|
|
||||||
std::tr1::weak_ptr<int> wdata(data.dataPtr());
|
std::tr1::weak_ptr<int32> wdata(data.dataPtr());
|
||||||
|
|
||||||
testOk1(data.unique()); // True, but I wish it wasn't!!!
|
testOk1(data.unique()); // True, but I wish it wasn't!!!
|
||||||
|
|
||||||
@@ -475,10 +477,10 @@ static void testICE()
|
|||||||
{
|
{
|
||||||
testDiag("Test freeze and thaw");
|
testDiag("Test freeze and thaw");
|
||||||
|
|
||||||
epics::pvData::shared_vector<int> A(6, 42), C;
|
epics::pvData::shared_vector<int32> A(6, 42), C;
|
||||||
epics::pvData::shared_vector<const int> B, D;
|
epics::pvData::shared_vector<const int32> B, D;
|
||||||
|
|
||||||
int *check = A.data();
|
int32 *check = A.data();
|
||||||
|
|
||||||
// check freeze w/ unique reference
|
// check freeze w/ unique reference
|
||||||
|
|
||||||
@@ -537,11 +539,11 @@ static void testICE()
|
|||||||
|
|
||||||
MAIN(testSharedVector)
|
MAIN(testSharedVector)
|
||||||
{
|
{
|
||||||
testPlan(162);
|
testPlan(163);
|
||||||
testDiag("Tests for shared_vector");
|
testDiag("Tests for shared_vector");
|
||||||
|
|
||||||
testDiag("sizeof(shared_vector<int>)=%lu",
|
testDiag("sizeof(shared_vector<int32>)=%lu",
|
||||||
(unsigned long)sizeof(epics::pvData::shared_vector<int>));
|
(unsigned long)sizeof(epics::pvData::shared_vector<int32>));
|
||||||
|
|
||||||
testEmpty();
|
testEmpty();
|
||||||
testInternalAlloc();
|
testInternalAlloc();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using namespace epics::pvData;
|
|||||||
|
|
||||||
static bool debug = false;
|
static bool debug = false;
|
||||||
|
|
||||||
void testTimeStamp()
|
void testTimeStampInternal()
|
||||||
{
|
{
|
||||||
testOk1(nanoSecPerSec==1000000000);
|
testOk1(nanoSecPerSec==1000000000);
|
||||||
TimeStamp current;
|
TimeStamp current;
|
||||||
@@ -131,6 +131,6 @@ MAIN(testTimeStamp)
|
|||||||
{
|
{
|
||||||
testPlan(37);
|
testPlan(37);
|
||||||
testDiag("Tests timeStamp");
|
testDiag("Tests timeStamp");
|
||||||
testTimeStamp();
|
testTimeStampInternal();
|
||||||
return testDone();
|
return testDone();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ namespace {
|
|||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct testequal<double> {
|
struct testequal<double> {
|
||||||
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<>
|
template<>
|
||||||
struct testequal<float> {
|
struct testequal<float> {
|
||||||
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<typename TO, typename FROM>
|
template<typename TO, typename FROM>
|
||||||
@@ -117,7 +117,7 @@ namespace {
|
|||||||
|
|
||||||
MAIN(testTypeCast)
|
MAIN(testTypeCast)
|
||||||
{
|
{
|
||||||
testPlan(122);
|
testPlan(123);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -387,7 +387,8 @@ try {
|
|||||||
FAIL(int8_t, string, "1000");
|
FAIL(int8_t, string, "1000");
|
||||||
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, "hello");
|
||||||
FAIL(epics::pvData::boolean, string, "1");
|
FAIL(epics::pvData::boolean, string, "1");
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
TOP=../..
|
# This is a Makefile fragment, see ../Makefile
|
||||||
|
|
||||||
include $(TOP)/configure/CONFIG
|
SRC_DIRS += $(PVDATA_TEST)/property
|
||||||
|
|
||||||
TESTPROD_HOST += testProperty
|
TESTPROD_HOST += testProperty
|
||||||
testProperty_SRCS += testProperty.cpp
|
testProperty_SRCS += testProperty.cpp
|
||||||
|
testHarness_SRCS += testProperty.cpp
|
||||||
TESTS += testProperty
|
TESTS += testProperty
|
||||||
|
|
||||||
testProperty_LIBS += pvData Com
|
|
||||||
|
|
||||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
|
||||||
|
|
||||||
include $(TOP)/configure/RULES
|
|
||||||
#----------------------------------------
|
|
||||||
# ADD RULES AFTER THIS LINE
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,70 +1,63 @@
|
|||||||
TOP=../..
|
# This is a Makefile fragment, see ../Makefile
|
||||||
|
|
||||||
include $(TOP)/configure/CONFIG
|
SRC_DIRS += $(PVDATA_TEST)/pv
|
||||||
|
|
||||||
PROD_HOST += testBitSetUtil
|
TESTPROD_HOST += testBitSetUtil
|
||||||
testBitSetUtil_SRCS += testBitSetUtil.cpp
|
testBitSetUtil_SRCS += testBitSetUtil.cpp
|
||||||
testBitSetUtil_LIBS += pvData Com
|
testHarness_SRCS += testBitSetUtil.cpp
|
||||||
TESTS += testBitSetUtil
|
TESTS += testBitSetUtil
|
||||||
|
|
||||||
PROD_HOST += testIntrospect
|
TESTPROD_HOST += testIntrospect
|
||||||
testIntrospect_SRCS += testIntrospect.cpp
|
testIntrospect_SRCS += testIntrospect.cpp
|
||||||
testIntrospect_LIBS += pvData Com
|
testHarness_SRCS += testIntrospect.cpp
|
||||||
TESTS += testIntrospect
|
TESTS += testIntrospect
|
||||||
|
|
||||||
PROD_HOST += testPVType
|
TESTPROD_HOST += testPVType
|
||||||
testPVType_SRCS += testPVType.cpp
|
testPVType_SRCS += testPVType.cpp
|
||||||
testPVType_LIBS += pvData Com
|
testHarness_SRCS += testPVType.cpp
|
||||||
TESTS += testPVType
|
TESTS += testPVType
|
||||||
|
|
||||||
PROD_HOST += testStandardField
|
TESTPROD_HOST += testStandardField
|
||||||
testStandardField_SRCS += testStandardField.cpp
|
testStandardField_SRCS += testStandardField.cpp
|
||||||
testStandardField_LIBS += pvData Com
|
testHarness_SRCS += testStandardField.cpp
|
||||||
TESTS += testStandardField
|
TESTS += testStandardField
|
||||||
|
|
||||||
PROD_HOST += testStandardPVField
|
TESTPROD_HOST += testStandardPVField
|
||||||
testStandardPVField_SRCS += testStandardPVField.cpp
|
testStandardPVField_SRCS += testStandardPVField.cpp
|
||||||
testStandardPVField_LIBS += pvData Com
|
testHarness_SRCS += testStandardPVField.cpp
|
||||||
TESTS += testStandardPVField
|
TESTS += testStandardPVField
|
||||||
|
|
||||||
PROD_HOST += testPVData
|
TESTPROD_HOST += testPVData
|
||||||
testPVData_SRCS += testPVData.cpp
|
testPVData_SRCS += testPVData.cpp
|
||||||
testPVData_LIBS += pvData Com
|
testHarness_SRCS += testPVData.cpp
|
||||||
TESTS += testPVData
|
TESTS += testPVData
|
||||||
|
|
||||||
PROD_HOST += testPVUnion
|
TESTPROD_HOST += testPVUnion
|
||||||
testPVUnion_SRCS += testPVUnion.cpp
|
testPVUnion_SRCS += testPVUnion.cpp
|
||||||
testPVUnion_LIBS += pvData Com
|
testHarness_SRCS += testPVUnion.cpp
|
||||||
TESTS += testPVUnion
|
TESTS += testPVUnion
|
||||||
|
|
||||||
PROD_HOST += testConvert
|
TESTPROD_HOST += testConvert
|
||||||
testConvert_SRCS += testConvert.cpp
|
testConvert_SRCS += testConvert.cpp
|
||||||
testConvert_LIBS += pvData Com
|
testHarness_SRCS += testConvert.cpp
|
||||||
TESTS += testConvert
|
TESTS += testConvert
|
||||||
|
|
||||||
PROD_HOST += testPVScalarArray
|
TESTPROD_HOST += testPVScalarArray
|
||||||
testPVScalarArray_SRCS += testPVScalarArray.cpp
|
testPVScalarArray_SRCS += testPVScalarArray.cpp
|
||||||
testPVScalarArray_LIBS += pvData Com
|
testHarness_SRCS += testPVScalarArray.cpp
|
||||||
TESTS += testPVScalarArray
|
TESTS += testPVScalarArray
|
||||||
|
|
||||||
PROD_HOST += testPVStructureArray
|
TESTPROD_HOST += testPVStructureArray
|
||||||
testPVStructureArray_SRCS += testPVStructureArray.cpp
|
testPVStructureArray_SRCS += testPVStructureArray.cpp
|
||||||
testPVStructureArray_LIBS += pvData Com
|
testHarness_SRCS += testPVStructureArray.cpp
|
||||||
TESTS += testPVStructureArray
|
TESTS += testPVStructureArray
|
||||||
|
|
||||||
PROD_HOST += testOperators
|
TESTPROD_HOST += testOperators
|
||||||
testOperators_SRCS += testOperators.cpp
|
testOperators_SRCS += testOperators.cpp
|
||||||
testOperators_LIBS += pvData Com
|
testHarness_SRCS += testOperators.cpp
|
||||||
TESTS += testOperators
|
TESTS += testOperators
|
||||||
|
|
||||||
PROD_HOST += testFieldBuilder
|
TESTPROD_HOST += testFieldBuilder
|
||||||
testFieldBuilder_SRCS += testFieldBuilder.cpp
|
testFieldBuilder_SRCS += testFieldBuilder.cpp
|
||||||
testFieldBuilder_LIBS += pvData Com
|
testHarness_SRCS += testFieldBuilder.cpp
|
||||||
TESTS += testFieldBuilder
|
TESTS += testFieldBuilder
|
||||||
|
|
||||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
|
||||||
|
|
||||||
include $(TOP)/configure/RULES
|
|
||||||
#----------------------------------------
|
|
||||||
# ADD RULES AFTER THIS LINE
|
|
||||||
|
|
||||||
|
|||||||
@@ -289,6 +289,9 @@ static void testError()
|
|||||||
static void testMapping()
|
static void testMapping()
|
||||||
{
|
{
|
||||||
#define OP(TYPE, ENUM) \
|
#define OP(TYPE, ENUM) \
|
||||||
|
printf(#TYPE ": sizeof %u typeid '%s' ScalarTypeID %d\n",\
|
||||||
|
(unsigned)sizeof(TYPE), typeid(TYPE).name(),\
|
||||||
|
epics::pvData::ScalarTypeID<TYPE>::value);\
|
||||||
testOk1(typeid(ScalarTypeTraits<ENUM>::type)==typeid(TYPE)); \
|
testOk1(typeid(ScalarTypeTraits<ENUM>::type)==typeid(TYPE)); \
|
||||||
testOk1(ENUM==(ScalarType)ScalarTypeID<TYPE>::value); \
|
testOk1(ENUM==(ScalarType)ScalarTypeID<TYPE>::value); \
|
||||||
testOk1(ENUM==(ScalarType)ScalarTypeID<const TYPE>::value);
|
testOk1(ENUM==(ScalarType)ScalarTypeID<const TYPE>::value);
|
||||||
@@ -306,12 +309,11 @@ static void testMapping()
|
|||||||
OP(string, pvString)
|
OP(string, pvString)
|
||||||
#undef OP
|
#undef OP
|
||||||
|
|
||||||
testOk1((ScalarType)ScalarTypeID<PVField>::value==(ScalarType)-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MAIN(testIntrospect)
|
MAIN(testIntrospect)
|
||||||
{
|
{
|
||||||
testPlan(327);
|
testPlan(326);
|
||||||
fieldCreate = getFieldCreate();
|
fieldCreate = getFieldCreate();
|
||||||
pvDataCreate = getPVDataCreate();
|
pvDataCreate = getPVDataCreate();
|
||||||
standardField = getStandardField();
|
standardField = getStandardField();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static StandardFieldPtr standardField = getStandardField();
|
|||||||
static StandardPVFieldPtr standardPVField = getStandardPVField();
|
static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||||
static ConvertPtr convert = getConvert();
|
static ConvertPtr convert = getConvert();
|
||||||
|
|
||||||
static void testPVUnion()
|
static void testPVUnionType()
|
||||||
{
|
{
|
||||||
if(debug)
|
if(debug)
|
||||||
std::cout << std::endl << "testPVUnion" << std::endl;
|
std::cout << std::endl << "testPVUnion" << std::endl;
|
||||||
@@ -115,10 +115,10 @@ static void testPVUnionArray()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MAIN(testPVData)
|
MAIN(testPVUnion)
|
||||||
{
|
{
|
||||||
testPlan(6);
|
testPlan(6);
|
||||||
testPVUnion();
|
testPVUnionType();
|
||||||
testPVUnionArray();
|
testPVUnionArray();
|
||||||
return testDone();
|
return testDone();
|
||||||
}
|
}
|
||||||
|
|||||||
86
testApp/pvDataAllTests.c
Normal file
86
testApp/pvDataAllTests.c
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* 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 <stdio.h>
|
||||||
|
#include <epicsThread.h>
|
||||||
|
#include <epicsUnitTest.h>
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
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 pvDataAllTests(void)
|
||||||
|
{
|
||||||
|
testHarness();
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
runTest(testBitSet);
|
||||||
|
runTest(testByteBuffer);
|
||||||
|
runTest(testMessageQueue);
|
||||||
|
runTest(testOverrunBitSet);
|
||||||
|
runTest(testQueue);
|
||||||
|
runTest(testSerialization);
|
||||||
|
runTest(testSharedVector);
|
||||||
|
runTest(testThread);
|
||||||
|
runTest(testTimeStamp);
|
||||||
|
runTest(testTimer);
|
||||||
|
runTest(testTypeCast);
|
||||||
|
|
||||||
|
/* copy */
|
||||||
|
runTest(testCreateRequest);
|
||||||
|
runTest(testPVCopy);
|
||||||
|
|
||||||
|
/* property */
|
||||||
|
runTest(testCreateRequest);
|
||||||
|
}
|
||||||
|
|
||||||
1
testApp/qemuRunTest.sh
Executable file
1
testApp/qemuRunTest.sh
Executable file
@@ -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
|
||||||
72
testApp/rtemsConfig.c
Normal file
72
testApp/rtemsConfig.c
Normal file
@@ -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.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
***********************************************************************
|
||||||
|
* 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 <bsp.h>
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
294
testApp/rtemsNetworking.h
Normal file
294
testApp/rtemsNetworking.h
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
/*
|
||||||
|
* 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 <bsp/libbsdport_api.h>
|
||||||
|
#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 <undefined> hardcoded IP address (e.g.,
|
||||||
|
* "192.168.0.10"); disables BOOTP;
|
||||||
|
* must also define FIXED_NETMASK
|
||||||
|
* FIXED_NETMASK <undefined> IP netmask string
|
||||||
|
* (e.g. "255.255.255.0")
|
||||||
|
* MULTI_NETDRIVER <undefined> ugly hack; if defined try to probe
|
||||||
|
* a variety of PCI and ISA drivers
|
||||||
|
* (i386 ONLY) use is discouraged!
|
||||||
|
* NIC_NAME <undefined> Ethernet driver name (e.g. "pcn1");
|
||||||
|
* must also define NIC_ATTACH
|
||||||
|
* NIC_ATTACH <undefined> 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 <undefined> 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 <undefined> Allocate few memory for mbufs
|
||||||
|
* (hint for how much memory the
|
||||||
|
* board has)
|
||||||
|
* MEMORY_HUGE <undefined> 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 <rtems/bspIo.h>
|
||||||
|
#include <bsp.h>
|
||||||
|
#include <rtems/rtems_bsdnet.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NIC_NAME
|
||||||
|
|
||||||
|
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
|
||||||
|
#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"
|
||||||
|
#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_ */
|
||||||
37
testApp/rtemsTestHarness.c
Normal file
37
testApp/rtemsTestHarness.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <rtems/rtems_bsdnet.h>
|
||||||
|
#include <rtems/error.h>
|
||||||
|
|
||||||
|
#include "rtemsNetworking.h"
|
||||||
|
|
||||||
|
#include <epicsExit.h>
|
||||||
|
#include <osdTime.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user