diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-07 05:27:00 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-29 23:07:58 +0300 |
commit | 62d638386c17d17b929ad10956c7f60825335a4e (patch) | |
tree | 9f0e6f82f9bdc3fac8a8c64e2850c14002cd6a2a /test | |
parent | 7c14dc7f77705f79ba49e7f0b2879986fea70fea (diff) | |
download | u-boot-62d638386c17d17b929ad10956c7f60825335a4e.tar.xz |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/test-main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/test-main.c b/test/test-main.c index 90a324bf70..7a3871624c 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -47,6 +47,7 @@ static int dm_test_pre_run(struct unit_test_state *uts) uts->force_fail_alloc = false; uts->skip_post_probe = false; gd->dm_root = NULL; + malloc_disable_testing(); if (CONFIG_IS_ENABLED(UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA)) memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count)); arch_reset_for_test(); |