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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>