[PATCH] cpukit/include/dev/can: Disabled debug prints in CAN Framework

Prashanth S fishesprashanth at gmail.com
Tue Nov 29 13:58:23 UTC 2022


> On 29/11/2022 05:57, Gedare Bloom wrote:

> >> @@ -111,18 +113,18 @@ static void test_task(rtems_task_argument data)

> >>

> >>       msg_size = ((char *)&msg.data[msg.len] - (char *)&msg);

> >>

> >> -    printf("calling write task = %u\n", task_num);

> >> +    CAN_DEBUG("calling write task = %u\n", task_num);

> > The general philosophy in our test suite is to only print something if

> > there's a failure. So just remove these debug statements that are

> > leftover from your development approach.

>

> Another approach could be to use the RTEMS Test Framework in which the

> test verbosity is controlled by a configuration option.


I will look into the RTEMS Test Framework.

>

> >

> >>       count = write(fd, &msg, sizeof(msg));

> >>       rtems_test_assert(count == msg_size);

> >> -    printf("task = %u write count = %u\n", task_num, count);

> >> +    CAN_DEBUG("task = %u write count = %u\n", task_num, count);

> >>

> >> -    printf("calling read task = %u\n", task_num);

> >> +    CAN_DEBUG("calling read task = %u\n", task_num);

> >>       count = read(fd, &msg, sizeof(msg));

> >>       rtems_test_assert(count > 0);

> > Since you send the messages, you know their sizes. You should be able

> > to assert the exact amount received?

> >

>

> Yes, and you probably know also the expected content of the message.

> This should be also checked. If there are ordering guarantees, then each

> message should have a unique content and the ordering should be checked

> as well.

The CAN framework has only minimal Rx support (CAN Framework sends the
latest received CAN message).
So only the read success is checked.


Regards
Prashanth S

On Tue, 29 Nov 2022 at 12:24, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

>
>
> On 29/11/2022 05:57, Gedare Bloom wrote:
> >> @@ -111,18 +113,18 @@ static void test_task(rtems_task_argument data)
> >>
> >>       msg_size = ((char *)&msg.data[msg.len] - (char *)&msg);
> >>
> >> -    printf("calling write task = %u\n", task_num);
> >> +    CAN_DEBUG("calling write task = %u\n", task_num);
> > The general philosophy in our test suite is to only print something if
> > there's a failure. So just remove these debug statements that are
> > leftover from your development approach.
>
> Another approach could be to use the RTEMS Test Framework in which the
> test verbosity is controlled by a configuration option.
>
> >
> >>       count = write(fd, &msg, sizeof(msg));
> >>       rtems_test_assert(count == msg_size);
> >> -    printf("task = %u write count = %u\n", task_num, count);
> >> +    CAN_DEBUG("task = %u write count = %u\n", task_num, count);
> >>
> >> -    printf("calling read task = %u\n", task_num);
> >> +    CAN_DEBUG("calling read task = %u\n", task_num);
> >>       count = read(fd, &msg, sizeof(msg));
> >>       rtems_test_assert(count > 0);
> > Since you send the messages, you know their sizes. You should be able
> > to assert the exact amount received?
> >
>
> Yes, and you probably know also the expected content of the message.
> This should be also checked. If there are ordering guarantees, then each
> message should have a unique content and the ordering should be checked
> as well.
>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber at embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20221129/6b2dba10/attachment-0001.htm>


More information about the devel mailing list