From f4812a03e3fbbc50f9d0cd4556a3a598c75d2a21 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 6 Jun 2009 18:52:54 +0000 Subject: 2009-06-06 Joel Sherrill * heapwalk/init.c: Add more automated corruption capability. --- testsuites/libtests/ChangeLog | 4 +++ testsuites/libtests/heapwalk/init.c | 52 +++++++++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 8 deletions(-) (limited to 'testsuites/libtests') diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index 2720adecf3..64bf46b49c 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,7 @@ +2009-06-06 Joel Sherrill + + * heapwalk/init.c: Add more automated corruption capability. + 2009-06-05 Santosh G Vattam * heapwalk/heapwalk.scn, heapwalk/init.c: Add a test case. diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c index ef7732b905..92b5fe679c 100644 --- a/testsuites/libtests/heapwalk/init.c +++ b/testsuites/libtests/heapwalk/init.c @@ -18,33 +18,69 @@ #include #include #include +#include #include #define TEST_HEAP_SIZE 1024 -uint8_t TestHeapMemory[TEST_HEAP_SIZE]; +uint32_t TestHeapMemory[TEST_HEAP_SIZE]; Heap_Control TestHeap; void test_heap_init(void) { - _Heap_Initialize( &TestHeap, TestHeapMemory, TEST_HEAP_SIZE, 0 ); + memset( TestHeapMemory, '\0', sizeof(TestHeapMemory) ); + _Heap_Initialize( &TestHeap, TestHeapMemory, sizeof(TestHeapMemory), 0 ); +} + +void test_heap_walk( int source, bool do_dump ) +{ + int i, j, original; + + _Heap_Walk( &TestHeap, source, do_dump ); + + /* + * Now corrupt all non-zero values + */ + for (i=0 ; i