Re: [Discuss OpenCPI] ocpigen - tests.cxx - assert(attrs)

From: Dominic Walters <waltersdom_at_googlemail.com>
Date: Wed, 10 Feb 21 18:49:13 +0000

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_at_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.
> >


Received on Wed Feb 10 2021 - 18:49:13 CST

This archive was generated by hypermail 2.3.0 : Fri Jun 05 2026 - 08:45:25 CDT