Hello,
I am trying to write a unit test for a component that has a property called frequencies
that is a sequence of integers.
I want to test it with a number of different sequences. What is the syntax in the unit test xml to do this? I have tried a few things such as:
<Property name='frequencies' values='{1}, {1, 2, 3}, {10, 10, 10, 10}'/>
But had no luck.
Many thanks,
Dan
Can you post the XML that describes the "frequencies" property of the
component?
What/how did things fail with "no luck"?
On 5/31/23 9:47 AM, dwp@md1tech.co.uk wrote:
Hello,
I am trying to write a unit test for a component that has a property
called |frequencies| that is a sequence of integers.
I want to test it with a number of different sequences. What is the
syntax in the unit test xml to do this? I have tried a few things such as:
|<Property name='frequencies' values='{1}, {1, 2, 3}, {10, 10, 10, 10}'/>|
But had no luck.
Many thanks,
Dan
discuss mailing list --discuss@lists.opencpi.org
To unsubscribe send an email todiscuss-leave@lists.opencpi.org
Within the component spec I have:
<Property name='frequencies' type='long' writable='true' sequenceLength='50'/>
When I run ocpidev build
from within the .test folder I get the following (I have replaced the name of the component with <component_name>
):
Spec is "local.uhd.uhd.<component_name>" in file "../lib/<component_name>-comp.xml"
Looking for workers with the same spec: "local.uhd.uhd.<component_name>"
Found worker for this spec: <component_name>.rcc
Writing cases/subcases report in "gen/cases.txt"
ocpigen: ../gen/runtime/base/src/BaseValue.cc:153: OCPI::Base::Value& OCPI::Base::Value::operator=(const OCPI::Base::Value&): Assertion `!v.m_parent' failed.
make: *** [/home/dwp/git/opencpi/cdk/include/test.mk:94: gen/cases.xml] Aborted (core dumped)
For comparison, I have another component that I have a working unit test for that does not include any sequence properties, the test XML looks like this:
<Tests UseHDLFileIo='true'>
<Output port='out' script='verify.py'/>
<Property name='sampleRate' values='10, 20'></Property>
<Property name='duration' values='0.25, 1.0'></Property>
<Property name='frequency' values='1, 2'></Property>
<Property name='amplitude' values='100, 1000'></Property>
</Tests>
When I run ocpidev build
from within that component’s .test folder I get this output:
Spec is "local.uhd.uhd.<component_name>" in file "../lib/<component_name>-comp.xml"
Looking for workers with the same spec: "local.uhd.uhd.<component_name>"
Found worker for this spec: <component_name>.rcc
Writing cases/subcases report in "gen/cases.txt"
Generating required HDL assemblies in gen/assemblies
Generating required input and property value files in gen/inputs/ and gen/properties/
Generating required application xml files in gen/applications/
Generating summary gen/cases.xml file
I have reproduced this error am looking into it.
On 5/31/23 11:44 AM, dwp@md1tech.co.uk wrote:
Within the component spec I have:
|<Property name='frequencies' type='long' writable='true' sequenceLength='50'/>|
When I run |ocpidev build| from within the .test folder I get the
following (I have replaced the name of the component with
|<component_name>|):
|Spec is "local.uhd.uhd.<component_name>" in file
"../lib/<component_name>-comp.xml"
Looking for workers with the same spec: "local.uhd.uhd.<component_name>"
Found worker for this spec: <component_name>.rcc
Writing cases/subcases report in "gen/cases.txt"
ocpigen: ../gen/runtime/base/src/BaseValue.cc:153: OCPI::Base::Value&
OCPI::Base::Value::operator=(const OCPI::Base::Value&): Assertion
`!v.m_parent' failed.
make: *** [/home/dwp/git/opencpi/cdk/include/test.mk:94:
gen/cases.xml] Aborted (core dumped)|
For comparison, I have another component that I have a working unit
test for that does not include any sequence properties, the test XML
looks like this:
|<Tests UseHDLFileIo='true'>
<Output port='out' script='verify.py'/>
<Property name='sampleRate' values='10, 20'></Property>
<Property name='duration' values='0.25, 1.0'></Property>
<Property name='frequency' values='1, 2'></Property>
<Property name='amplitude' values='100, 1000'></Property>
</Tests>|
When I run |ocpidev build| from within that component’s .test folder I
get this output:
|Spec is "local.uhd.uhd.<component_name>" in file
"../lib/<component_name>-comp.xml"
Looking for workers with the same spec: "local.uhd.uhd.<component_name>"
Found worker for this spec: <component_name>.rcc
Writing cases/subcases report in "gen/cases.txt"
Generating required HDL assemblies in gen/assemblies
Generating required input and property value files in gen/inputs/ and
gen/properties/
Generating required application xml files in gen/applications/
Generating summary gen/cases.xml file|
discuss mailing list --discuss@lists.opencpi.org
To unsubscribe send an email todiscuss-leave@lists.opencpi.org
Thanks!
I feel like there way be a way to do this using <case> elements. I will do some experimentation and let you know if I have any success
I tried setting the different values of frequencies
the test XML like this:
<Case>
<Property name='frequencies' values='{1}'/>
</Case>
<Case>
<Property name='frequencies' values='{1, 2, 3}'/>
</Case>
<Case>
<Property name='frequencies' values='{10, 10, 10, 10}'/>
</Case>
But still got the same error:
ocpigen: ../gen/runtime/base/src/BaseValue.cc:153: OCPI::Base::Value& OCPI::Base::Value::operator=(const OCPI::Base::Value&): Assertion `!v.m_parent' failed.
I also tried without the curly braces but got a different error:
in value "1" (length of prop value is 1 chars): recursize type needs to be enclosed in {}
Thanks for reporting this. It is a bug for supplying multiple test
values this way when the underlying property is a sequence type.
I will generate an issue and post the patch.
Cheers,
Jim
On 6/1/23 5:28 AM, dwp@md1tech.co.uk wrote:
I tried setting the different values of |frequencies| the test XML
like this:
|<Case>
<Property name='frequencies' values='{1}'/>
</Case>
<Case>
<Property name='frequencies' values='{1, 2, 3}'/>
</Case>
<Case>
<Property name='frequencies' values='{10, 10, 10, 10}'/>
</Case>|
But still got the same error:
|ocpigen: ../gen/runtime/base/src/BaseValue.cc:153: OCPI::Base::Value&
OCPI::Base::Value::operator=(const OCPI::Base::Value&): Assertion
`!v.m_parent' failed.|
I also tried without the curly braces but got a different error:
|in value "1" (length of prop value is 1 chars): recursize type needs
to be enclosed in {}|
discuss mailing list --discuss@lists.opencpi.org
To unsubscribe send an email todiscuss-leave@lists.opencpi.org