aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2014-10-22 17:01:27 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2014-10-22 17:01:27 +1100
commitb0ec172fc1b09f2cf27832b56adb0eb9886c0727 (patch)
treeac0cf16f88cc15bd559c084d40e055d035ffefff /core
parent35651388cba4a5d34e1fcb37c675498ca374dea5 (diff)
downloadskiboot-b0ec172fc1b09f2cf27832b56adb0eb9886c0727.zip
skiboot-b0ec172fc1b09f2cf27832b56adb0eb9886c0727.tar.gz
skiboot-b0ec172fc1b09f2cf27832b56adb0eb9886c0727.tar.bz2
Test zalloc() failure case.
This brings us to near total test coverage of core/malloc.c Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/test/run-malloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/test/run-malloc.c b/core/test/run-malloc.c
index 4fe6be1..345fb21 100644
--- a/core/test/run-malloc.c
+++ b/core/test/run-malloc.c
@@ -132,6 +132,10 @@ int main(void)
assert(!mem_region_lock.lock_val);
assert(heap_empty());
+ /* zalloc failure */
+ p2 = zalloc(TEST_HEAP_SIZE * 2);
+ assert(p2 == NULL);
+
/* Realloc with move. */
p2 = malloc(TEST_HEAP_SIZE - 64 - sizeof(struct alloc_hdr)*2);
memset(p2, 'a', TEST_HEAP_SIZE - 64 - sizeof(struct alloc_hdr)*2);