ocpigen - tests.cxx - assert(attrs)

DW
Dominic Walters
Tue, Feb 9, 2021 1:46 PM

Hi,

I'm trying to build a test for a HDL Worker and I keep hitting a failed
assertion check in tools/ocpigen/src/tests.cxx.

The check is done on line 1383 of tools/ocpigen/src/tests.cxx ·
release-2.0.1 · OpenCPI / OpenCPI · GitLab
https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx
.

Any suggestions as to what I'm doing wrong? I can't really tell what
"attrs" is doing in that code.
To my knowledge:

  • I have set every property of the worker (either by using the default of
    a parameter, by defining "value", or by defining "generate"). In cases.txt
    every property has a value or a file it is generated in.
  • I am generating input for every port.
  • The worker is built for my simulation platform.

I have had this check fail in the past, but unfortunately I can't remember
how I fixed/avoided it.

Thanks.

Hi, I'm trying to build a test for a HDL Worker and I keep hitting a failed assertion check in tools/ocpigen/src/tests.cxx. The check is done on line 1383 of tools/ocpigen/src/tests.cxx · release-2.0.1 · OpenCPI / OpenCPI · GitLab <https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx> . Any suggestions as to what I'm doing wrong? I can't really tell what "attrs" is doing in that code. To my knowledge: * I have set every property of the worker (either by using the default of a parameter, by defining "value", or by defining "generate"). In cases.txt every property has a value or a file it is generated in. * I am generating input for every port. * The worker is built for my simulation platform. I have had this check fail in the past, but unfortunately I can't remember how I fixed/avoided it. Thanks.
JK
James Kulp
Tue, Feb 9, 2021 2:00 PM

That assertion is of course intended to catch an internal software
inconsistency and not be a "user error", but it is related to ensuring that
the value of a property being assigned to a subcase is indeed one of the
values defined for the case.
This of course "can't happen", but somehow it has... :-)

If you are generating a value could you try to just insert the actual
value to see if that changes anything?

On 2/9/21 8:46 AM, Dominic Walters via discuss wrote:

Hi,

I'm trying to build a test for a HDL Worker and I keep hitting a failed
assertion check in tools/ocpigen/src/tests.cxx.

The check is done on line 1383 of tools/ocpigen/src/tests.cxx ·
release-2.0.1 · OpenCPI / OpenCPI · GitLab
https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx
.

Any suggestions as to what I'm doing wrong? I can't really tell what
"attrs" is doing in that code.
To my knowledge:

  • I have set every property of the worker (either by using the default of
    a parameter, by defining "value", or by defining "generate"). In cases.txt
    every property has a value or a file it is generated in.
  • I am generating input for every port.
  • The worker is built for my simulation platform.

I have had this check fail in the past, but unfortunately I can't remember
how I fixed/avoided it.

Thanks.

That assertion is of course intended to catch an internal software inconsistency and not be a "user error", but it is related to ensuring that the value of a property being assigned to a subcase is indeed one of the values defined for the case. This of course "can't happen", but somehow it has... :-) If you are generating a value could you try to just insert the actual value to see if that changes anything? On 2/9/21 8:46 AM, Dominic Walters via discuss wrote: > Hi, > > I'm trying to build a test for a HDL Worker and I keep hitting a failed > assertion check in tools/ocpigen/src/tests.cxx. > > The check is done on line 1383 of tools/ocpigen/src/tests.cxx · > release-2.0.1 · OpenCPI / OpenCPI · GitLab > <https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx> > . > > Any suggestions as to what I'm doing wrong? I can't really tell what > "attrs" is doing in that code. > To my knowledge: > * I have set every property of the worker (either by using the default of > a parameter, by defining "value", or by defining "generate"). In cases.txt > every property has a value or a file it is generated in. > * I am generating input for every port. > * The worker is built for my simulation platform. > > I have had this check fail in the past, but unfortunately I can't remember > how I fixed/avoided it. > > Thanks. >
DW
Dominic Walters
Wed, Feb 10, 2021 6:49 PM

Hey,

The root cause of this bug appears to be the use of the "default" keyword
on an OCS property that is then "generate"d in a test.
This combination ALWAYS causes this assertion error; the other settings of
the property don't matter.
Notably this error doesn't occur when using "value", "values", or
"valuefile" with a default specified, although "valuesfile" causes other
issues (see below).

I have observed the assertion fail for the following tags when default is
specified:

  • parameters, initials, and writables.
  • uchar and bool, as well as arrays of both (static and parameterized
    lengths).

As such the bug can be summarised as "all properties that have a 'default'
specified cannot be 'generate'd in a unit test".
I'll submit a bug report when I can.

Bonus bug: valuesfile in a "-test.xml" doesn't work.

13.3.4.5 of the Component Developers Guide states that "valuesfile" is a
valid tag, but it is rejected as an "invalid attribute".
In the list of valid attributes that is printed as a result of this error
message, you can see the tag "valuefiles".
If you try "valuefiles", ocpidev complains saying "exactly one attribute
must be specified between: value, values, valuefile, valuesfile, or
generate".
I think you must have a typo with "valuefiles" in place of "valuesfile"
somewhere.

I'll submit this bug separately.

On Tue, Feb 9, 2021 at 2:01 PM James Kulp jek@parera.com wrote:

That assertion is of course intended to catch an internal software
inconsistency and not be a "user error", but it is related to ensuring that
the value of a property being assigned to a subcase is indeed one of the
values defined for the case.
This of course "can't happen", but somehow it has... :-)

If you are generating a value could you try to just insert the actual
value to see if that changes anything?

On 2/9/21 8:46 AM, Dominic Walters via discuss wrote:

Hi,

I'm trying to build a test for a HDL Worker and I keep hitting a failed
assertion check in tools/ocpigen/src/tests.cxx.

The check is done on line 1383 of tools/ocpigen/src/tests.cxx ·
release-2.0.1 · OpenCPI / OpenCPI · GitLab
<
https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx

.

Any suggestions as to what I'm doing wrong? I can't really tell what
"attrs" is doing in that code.
To my knowledge:

  • I have set every property of the worker (either by using the default
    of
    a parameter, by defining "value", or by defining "generate"). In
    cases.txt
    every property has a value or a file it is generated in.
  • I am generating input for every port.
  • The worker is built for my simulation platform.

I have had this check fail in the past, but unfortunately I can't
remember
how I fixed/avoided it.

Thanks.

Hey, The root cause of this bug appears to be the use of the "default" keyword on an OCS property that is then "generate"d in a test. This combination ALWAYS causes this assertion error; the other settings of the property don't matter. Notably this error doesn't occur when using "value", "values", or "valuefile" with a default specified, although "valuesfile" causes other issues (see below). I have observed the assertion fail for the following tags when default is specified: * parameters, initials, and writables. * uchar and bool, as well as arrays of both (static and parameterized lengths). As such the bug can be summarised as "all properties that have a 'default' specified cannot be 'generate'd in a unit test". I'll submit a bug report when I can. Bonus bug: valuesfile in a "-test.xml" doesn't work. 13.3.4.5 of the Component Developers Guide states that "valuesfile" is a valid tag, but it is rejected as an "invalid attribute". In the list of valid attributes that is printed as a result of this error message, you can see the tag "valuefiles". If you try "valuefiles", ocpidev complains saying "exactly one attribute must be specified between: value, values, valuefile, valuesfile, or generate". I think you must have a typo with "valuefiles" in place of "valuesfile" somewhere. I'll submit this bug separately. On Tue, Feb 9, 2021 at 2:01 PM James Kulp <jek@parera.com> wrote: > That assertion is of course intended to catch an internal software > inconsistency and not be a "user error", but it is related to ensuring that > the value of a property being assigned to a subcase is indeed one of the > values defined for the case. > This of course "can't happen", but somehow it has... :-) > > If you are generating a value could you try to just insert the actual > value to see if that changes anything? > > > > > On 2/9/21 8:46 AM, Dominic Walters via discuss wrote: > > Hi, > > > > I'm trying to build a test for a HDL Worker and I keep hitting a failed > > assertion check in tools/ocpigen/src/tests.cxx. > > > > The check is done on line 1383 of tools/ocpigen/src/tests.cxx · > > release-2.0.1 · OpenCPI / OpenCPI · GitLab > > < > https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx > > > > . > > > > Any suggestions as to what I'm doing wrong? I can't really tell what > > "attrs" is doing in that code. > > To my knowledge: > > * I have set every property of the worker (either by using the default > of > > a parameter, by defining "value", or by defining "generate"). In > cases.txt > > every property has a value or a file it is generated in. > > * I am generating input for every port. > > * The worker is built for my simulation platform. > > > > I have had this check fail in the past, but unfortunately I can't > remember > > how I fixed/avoided it. > > > > Thanks. > >
JK
James Kulp
Thu, Feb 11, 2021 1:36 PM

Thanks for the effort in clarifying the problem here.

On 2/10/21 1:49 PM, Dominic Walters via discuss wrote:

Hey,

The root cause of this bug appears to be the use of the "default" keyword
on an OCS property that is then "generate"d in a test.
This combination ALWAYS causes this assertion error; the other settings of
the property don't matter.
Notably this error doesn't occur when using "value", "values", or
"valuefile" with a default specified, although "valuesfile" causes other
issues (see below).

I have observed the assertion fail for the following tags when default is
specified:

  • parameters, initials, and writables.
  • uchar and bool, as well as arrays of both (static and parameterized
    lengths).

As such the bug can be summarised as "all properties that have a 'default'
specified cannot be 'generate'd in a unit test".
I'll submit a bug report when I can.

Bonus bug: valuesfile in a "-test.xml" doesn't work.

13.3.4.5 of the Component Developers Guide states that "valuesfile" is a
valid tag, but it is rejected as an "invalid attribute".
In the list of valid attributes that is printed as a result of this error
message, you can see the tag "valuefiles".
If you try "valuefiles", ocpidev complains saying "exactly one attribute
must be specified between: value, values, valuefile, valuesfile, or
generate".
I think you must have a typo with "valuefiles" in place of "valuesfile"
somewhere.

I'll submit this bug separately.

On Tue, Feb 9, 2021 at 2:01 PM James Kulp jek@parera.com wrote:

That assertion is of course intended to catch an internal software
inconsistency and not be a "user error", but it is related to ensuring that
the value of a property being assigned to a subcase is indeed one of the
values defined for the case.
This of course "can't happen", but somehow it has... :-)

If you are generating a value could you try to just insert the actual
value to see if that changes anything?

On 2/9/21 8:46 AM, Dominic Walters via discuss wrote:

Hi,

I'm trying to build a test for a HDL Worker and I keep hitting a failed
assertion check in tools/ocpigen/src/tests.cxx.

The check is done on line 1383 of tools/ocpigen/src/tests.cxx ·
release-2.0.1 · OpenCPI / OpenCPI · GitLab
<
https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx
.

Any suggestions as to what I'm doing wrong? I can't really tell what
"attrs" is doing in that code.
To my knowledge:

  • I have set every property of the worker (either by using the default
    of
    a parameter, by defining "value", or by defining "generate"). In
    cases.txt
    every property has a value or a file it is generated in.
  • I am generating input for every port.
  • The worker is built for my simulation platform.

I have had this check fail in the past, but unfortunately I can't
remember
how I fixed/avoided it.

Thanks.

Thanks for the effort in clarifying the problem here. On 2/10/21 1:49 PM, Dominic Walters via discuss wrote: > Hey, > > The root cause of this bug appears to be the use of the "default" keyword > on an OCS property that is then "generate"d in a test. > This combination ALWAYS causes this assertion error; the other settings of > the property don't matter. > Notably this error doesn't occur when using "value", "values", or > "valuefile" with a default specified, although "valuesfile" causes other > issues (see below). > > I have observed the assertion fail for the following tags when default is > specified: > * parameters, initials, and writables. > * uchar and bool, as well as arrays of both (static and parameterized > lengths). > > As such the bug can be summarised as "all properties that have a 'default' > specified cannot be 'generate'd in a unit test". > I'll submit a bug report when I can. > > Bonus bug: valuesfile in a "-test.xml" doesn't work. > > 13.3.4.5 of the Component Developers Guide states that "valuesfile" is a > valid tag, but it is rejected as an "invalid attribute". > In the list of valid attributes that is printed as a result of this error > message, you can see the tag "valuefiles". > If you try "valuefiles", ocpidev complains saying "exactly one attribute > must be specified between: value, values, valuefile, valuesfile, or > generate". > I think you must have a typo with "valuefiles" in place of "valuesfile" > somewhere. > > I'll submit this bug separately. > > On Tue, Feb 9, 2021 at 2:01 PM James Kulp <jek@parera.com> wrote: > >> That assertion is of course intended to catch an internal software >> inconsistency and not be a "user error", but it is related to ensuring that >> the value of a property being assigned to a subcase is indeed one of the >> values defined for the case. >> This of course "can't happen", but somehow it has... :-) >> >> If you are generating a value could you try to just insert the actual >> value to see if that changes anything? >> >> >> >> >> On 2/9/21 8:46 AM, Dominic Walters via discuss wrote: >>> Hi, >>> >>> I'm trying to build a test for a HDL Worker and I keep hitting a failed >>> assertion check in tools/ocpigen/src/tests.cxx. >>> >>> The check is done on line 1383 of tools/ocpigen/src/tests.cxx · >>> release-2.0.1 · OpenCPI / OpenCPI · GitLab >>> < >> https://gitlab.com/opencpi/opencpi/-/blob/release-2.0.1/tools/ocpigen/src/tests.cxx >>> . >>> >>> Any suggestions as to what I'm doing wrong? I can't really tell what >>> "attrs" is doing in that code. >>> To my knowledge: >>> * I have set every property of the worker (either by using the default >> of >>> a parameter, by defining "value", or by defining "generate"). In >> cases.txt >>> every property has a value or a file it is generated in. >>> * I am generating input for every port. >>> * The worker is built for my simulation platform. >>> >>> I have had this check fail in the past, but unfortunately I can't >> remember >>> how I fixed/avoided it. >>> >>> Thanks. >>>