zephyr/tests/lib/mem_alloc
Martin Åberg 80b9080f9d tests/mem_alloc: check that malloc() objects can be accessed
Adds tests checking that we can use memory allocated by malloc(),
calloc() and realloc() to access objects of some common types,
including uint64_t and double.

It works by doing a number of allocations of various sizes and
dereferencing the returned pointer. The purpose is to catch cases where
the application would trap if accessing the allocated memory. (The
test does not check alignment against the ABI or alignof().)

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-24 10:11:11 -05:00
..
src tests/mem_alloc: check that malloc() objects can be accessed 2021-01-24 10:11:11 -05:00
CMakeLists.txt tests: make find_package(Zephyr...) REQUIRED 2020-05-29 10:47:25 +02:00
README.txt tests: lib: mem_alloc: minor typo fixes in README file 2019-11-18 09:38:29 -06:00
prj.conf tests: CONFIG_TEST_USERSPACE now off by default 2019-04-06 14:30:42 -04:00
prj_newlib.conf tests: lib: mem_alloc: Increase malloc heap size for newlib test 2020-02-14 10:52:53 -06:00
prj_newlibnano.conf test: lib: mem_alloc: enable user mode in newlibcnano test 2019-11-18 09:38:29 -06:00
testcase.yaml tests/mem_alloc: improve newlib nano detection 2021-01-15 13:06:33 -05:00

README.txt

Title: Kernel Access to Dynamic Memory Allocation functions provided by
Standard Libraries

Description:

This test verifies kernel access to the dynamic memory allocation functions
provided by standard C libraries supported in Zephyr:
NEWLIB and MINIMAL_LIB.
It is intended to catch issues in which a library is completely absent
or non-functional, and is NOT intended to be a comprehensive test suite
of all functionality provided by the libraries.

--------------------------------------------------------------------------------

Building and Running Project:

This project outputs to the console.  It can be built and executed
on QEMU as follows:

    make run

--------------------------------------------------------------------------------

Troubleshooting:

Problems caused by outdated project information can be addressed by
issuing one of the following commands then rebuilding the project:

    make clean          # discard results of previous builds
                        # but keep existing configuration info
or
    make pristine       # discard results of previous builds
                        # and restore pre-defined configuration info

--------------------------------------------------------------------------------

Sample Output:

***** BOOTING ZEPHYR OS vxxxx - BUILD: xxxx *****
Running test suite test_c_lib_dynamic_memalloc
===================================================================
starting test - test_malloc
PASS - test_malloc
===================================================================
starting test - test_free
PASS - test_free
===================================================================
starting test - test_calloc
PASS - test_calloc
===================================================================
starting test - test_realloc
PASS - test_realloc
===================================================================
starting test - test_reallocarray
PASS - test_reallocarray
===================================================================
starting test - test_memalloc_all
PASS - test_memalloc_all
===================================================================
starting test - test_memalloc_max
PASS - test_memalloc_max
===================================================================
===================================================================
PROJECT EXECUTION SUCCESSFUL