#2288 assigned defect

Use of assert()

Reported by: Joel Sherrill Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: unspecified Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

While reviewing test results, I noticed a few uses of regular assert().

There are 92 in cpukit/.
There are 70 in testsuites/
There are 371 in c/

Should at least the ones in cpukit/ be changed to RTEMS asserts before we branch?

Attachments (1)

SQUASHED-Fix-Use-of-assert-ticket-2288.patch (169.9 KB) - added by jfjhh on 12/25/15 at 22:01:52.
Fixes usage of assert(). Adds a new bsp_error_code block.

Download all attachments as: .zip

Change History (4)

comment:1 Changed on 03/09/15 at 18:32:13 by Joel Sherrill

FWIW this looks like the set of tests using assert().

./fstests/fstime/test.c
./libtests/block09/init.c
./libtests/block10/init.c
./libtests/capture01/init.c
./libtests/exit01/init.c
./libtests/exit02/init.c
./libtests/flashdisk01/test-file-system.c
./smptests/smpfatal01/init.c
./smptests/smpfatal02/init.c
./smptests/smpfatal03/init.c
./smptests/smpfatal04/init.c
./smptests/smpfatal05/init.c
./smptests/smpfatal08/init.c
./sptests/spheapprot/init.c

So that shouldn't be too bad to correct if all can be safely changed to rtems_test_assert().

I am also not sure what rb_heap_assert() maps down to.

Version 0, edited on 03/09/15 at 18:32:13 by Joel Sherrill (next)

comment:2 Changed on 05/16/15 at 09:42:56 by Sebastian Huber

The problem with rtems_test_assert() is that it ends up in exit() which is not a good idea in certain tests.

The assert() in c/ should get converted to bsp_fatal(). In cpukit to _Assert() or a fatal error with a unique (source, code). Maybe we should add a rtems_assert() (like assert() but controlled via RTEMS_DEBUG).

Changed on 12/25/15 at 22:01:52 by jfjhh

Fixes usage of assert(). Adds a new bsp_error_code block.

comment:3 Changed on 01/25/17 at 13:05:19 by Sebastian Huber

Milestone: 4.11Indefinite
Owner: set to Needs Funding
Status: newassigned
Note: See TracTickets for help on using tickets.