Commit graph

13 commits

Author SHA1 Message Date
Keith Packard 08d4dc90a1 tests/heap_listener: Store 'malloc' value in global to avoid optimizer
When the compiler is allowed to know the semantics of malloc and free,
this test needs to be careful to not have both calls elided by not using
the result at all. Simply storing the malloc pointer in a global
variable is sufficient here.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Stephanos Ioannidis 735ddeb4a8 tests: newlib: thread_safety: Add min. RAM constraint for stress tests
This commit adds a separate minimum RAM constraint for the thread-
safety stress tests because they have a significantly higher RAM
usage compared to the basic functional tests.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-26 15:11:43 -07:00
Anas Nashif 8235ce6931 tests: newlib: define testcases in yaml
Define all testcases in the yaml for consistency and issue parsing
them during setup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-13 12:16:57 -04:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Carles Cufi e83a13aabf kconfig: Rename the TEST_EXTRA stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Daniel Leung ae415272c1 sys: heap_listener: extend to cover more events
This extends the heap_listener to cover more events,
specifically, allocation, free and realloc.

Note that typedef are used so the callback can be
documented.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-10 10:28:04 -05:00
Daniel Leung 39d17a180a sys: heap_listener: resize_cb to also take heap ID
Add a parameter to the resize callback to also take the heap ID.
This allows a single callback to be used for multiple heaps if
so desired.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-10 10:28:04 -05:00
Damian Krolik 3aedda9852 lib: os: add heap event listener
* add generic heap event listener module that can be used
  for notifying an application of heap-related events
* use the listener module in newlib libc hooks
* add a unit test

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-12-18 07:49:15 -05:00
Stephanos Ioannidis fa7959c197 tests: newlib: thread_safety: Disable minimum newlib heap size check
This commit disables the "minimum required newlib heap size" check for
the newlib thread safety tests since they do not make use of any newlib
functions that require large heap.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-09-08 10:32:45 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Stephanos Ioannidis fb4325ea32 tests: newlib: thread_safety: Add internal lock and userspace tests
This commit adds the tests for the newlib retargetable locking
interface, as well as the tests for the internal lock functions that
are supposed to internally invoke the retargetable locking interface.

All of these tests must pass when the toolchain newlib is compiled with
the `retargetable-locking` and `multithread` options, which are
required to ensure that the newlib is thread-safe, enabled. If the
toolchain newlib is compiled with either of these options disabled,
this test will fail.

This commit also adds the userspace testcases to ensure that the newlib
is thread-safe in the user mode.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-09 08:51:24 -05:00
Stephanos Ioannidis b37ee6998d tests: newlib: thread_safety: Fix test function scope
This commit adds the `static` keyword to the test functions that are
not intended to be globally available.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-09 08:51:24 -05:00
Stephanos Ioannidis 6bc42ae309 tests: lib: Add newlib thread safety test
This commit adds a new test to verify the thread safety of the C
standard functions provided by newlib.

Only the memory management functions (malloc and free) are tested at
this time; this test will be further extended in the future, to verify
the thread safety and re-entrancy of all supported newlib functions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-05-13 07:30:43 -05:00