test: Support testing malloc() failures
authorSimon Glass <sjg@chromium.org>
Wed, 7 Sep 2022 02:27:00 +0000 (20:27 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 29 Sep 2022 20:07:58 +0000 (16:07 -0400)
commit62d638386c17d17b929ad10956c7f60825335a4e
tree9f0e6f82f9bdc3fac8a8c64e2850c14002cd6a2a
parent7c14dc7f77705f79ba49e7f0b2879986fea70fea
test: Support testing malloc() failures

It is helpful to test that out-of-memory checks work correctly in code
that calls malloc().

Add a simple way to force failure after a given number of malloc() calls.

Fix a header guard to avoid a build error on sandbox_vpl.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
arch/sandbox/include/asm/malloc.h
common/dlmalloc.c
include/malloc.h
test/test-main.c