diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/tests/libtests/malloctest/system.h | 6 | ||||
-rw-r--r-- | c/src/tests/libtests/malloctest/task1.c | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/c/src/tests/libtests/malloctest/system.h b/c/src/tests/libtests/malloctest/system.h index 7c95130900..e640424eed 100644 --- a/c/src/tests/libtests/malloctest/system.h +++ b/c/src/tests/libtests/malloctest/system.h @@ -39,13 +39,13 @@ void blow_stack( void ); #define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) -#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE #include <confdefs.h> /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/libtests/malloctest/task1.c b/c/src/tests/libtests/malloctest/task1.c index aa47bd404b..b535e382ed 100644 --- a/c/src/tests/libtests/malloctest/task1.c +++ b/c/src/tests/libtests/malloctest/task1.c @@ -17,6 +17,7 @@ #include "system.h" #include <libcsupport.h> /* for malloc_dump, malloc_walk */ #include <string.h> /* for memset */ +#include <stdlib.h> #define NUM_PASSES 100 @@ -37,8 +38,10 @@ rtems_task Task_1_through_5( while (TRUE) { - if ( passes++ > NUM_PASSES ) + if ( passes++ > NUM_PASSES ) { + puts("*** END OF MALLOC TEST ***"); exit(0); + } status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); directive_failed( status, "rtems_clock_get" ); @@ -46,9 +49,12 @@ rtems_task Task_1_through_5( put_name( Task_name[ task_number( tid ) ], FALSE ); print_time( " - rtems_clock_get - ", &time, "\n" ); - mem_amt = rand() * task_number( tid ); + mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX)); + while (!(mem_ptr = malloc ( mem_amt))) { + printf("out of memory... trying again.\n"); + mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX)); + } printf("mallocing %d bytes\n",mem_amt); - mem_ptr = malloc ( mem_amt); memset( mem_ptr, mem_amt, mem_amt ); malloc_dump(); malloc_walk(1,FALSE); |