summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-02-03 22:12:28 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-02-03 22:12:28 +0000
commitcd792a86cf61a46b83b09f2b2d4ba8acab693017 (patch)
treeeb7b81707b7f5ee11a85c1b020acc631e3966420 /testsuites/libtests
parentPOSIX Timers submitted by Juan Zamorano Flores (diff)
downloadrtems-cd792a86cf61a46b83b09f2b2d4ba8acab693017.tar.bz2
Patch from John S Gwynne <jsg@donet.com> for malloctest. His comments:
I have a few patches for the efi332 bsp. If you let me know when you expect the next snapshot release, I will try to have them to you before then. Also, the malloctest has some problems that I would think would prevent it from running on almost any platform. I have enclose patches below to fix (1) Task_id and Task_name dimensioning, (2) end of test message, (3) the amount of memory malloc'ed, and (4) retry on unsuccessful (out of memory) molloc's.
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/malloctest/system.h6
-rw-r--r--testsuites/libtests/malloctest/task1.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/testsuites/libtests/malloctest/system.h b/testsuites/libtests/malloctest/system.h
index 7c95130900..e640424eed 100644
--- a/testsuites/libtests/malloctest/system.h
+++ b/testsuites/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/testsuites/libtests/malloctest/task1.c b/testsuites/libtests/malloctest/task1.c
index aa47bd404b..b535e382ed 100644
--- a/testsuites/libtests/malloctest/task1.c
+++ b/testsuites/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);