2008-01-29 Joel Sherrill <joel.sherrill@OARcorp.com>

* malloctest/init.c: Add more tests per suggestions from Sergei
	Organov.
This commit is contained in:
Joel Sherrill
2008-01-29 17:28:49 +00:00
parent e0a66c1574
commit b7bc1d1a62
2 changed files with 46 additions and 9 deletions

View File

@@ -1,3 +1,8 @@
2008-01-29 Joel Sherrill <joel.sherrill@OARcorp.com>
* malloctest/init.c: Add more tests per suggestions from Sergei
Organov.
2008-01-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* malloctest/init.c: Add include to remove warning.

View File

@@ -33,7 +33,7 @@
*/
void test_realloc(void)
{
void *p1, *p2, *p3;
void *p1, *p2, *p3, *p4;
int i;
int sc;
@@ -82,16 +82,48 @@ void test_realloc(void)
free(p1);
/*
* Bad hack to get coverage
* Allocate with default alignment coverage
*/
sc = rtems_memalign( &p4, 0, 8 );
if ( !sc && p4 )
free( p4 );
/*
* Walk the C Program Heap
*/
malloc_walk( 1234, 0 );
/*
* Realloc with a bad pointer to force a point
*/
p4 = realloc( test_realloc, 32 );
/*
* Another odd case. What we are trying to do from Sergei
*
* 32-bit CPU when CPU_ALIGNMENT = 4 (most targets have 8) with the
* code like this:
*/
p1 = malloc(12);
p2 = malloc(32);
p3 = malloc(32);
free(p2);
sc = rtems_memalign(&p2, 8, 28);
free(p1);
free(p2);
free(p3);
/*
* Odd case in resizing a block. Again test case outline per Sergei
*/
p1 = malloc(32);
p2 = malloc(8);
p3 = malloc(32);
free(p2);
p4 = realloc(p1, 42);
free(p3);
free(p4);
{
void *p5;
extern Heap_Control RTEMS_Malloc_Heap;
p5 = _Protected_heap_Allocate_aligned( &RTEMS_Malloc_Heap, 8, 0 );
if ( p5 )
free( p5 );
}
}
/*