Changeset cd792a86 in rtems


Ignore:
Timestamp:
Feb 3, 1999, 10:12:28 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
7c7fd4d
Parents:
0747e2d
Message:

Patch from John S Gwynne <jsg@…> 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.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/libtests/malloctest/system.h

    r0747e2d rcd792a86  
    4040#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
    4141
    42 #define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
     42#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    4343
    4444#include <confdefs.h>
     
    4646/* global variables */
    4747
    48 TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
    49 TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
     48TEST_EXTERN rtems_id   Task_id[ 6 ];         /* array of task ids */
     49TEST_EXTERN rtems_name Task_name[ 6 ];       /* array of task names */
    5050
    5151/* end of include file */
  • c/src/tests/libtests/malloctest/task1.c

    r0747e2d rcd792a86  
    1818#include <libcsupport.h>    /* for malloc_dump, malloc_walk */
    1919#include <string.h>         /* for memset */
     20#include <stdlib.h>
    2021
    2122#define NUM_PASSES 100
     
    3839  while (TRUE)
    3940  {
    40     if ( passes++ > NUM_PASSES )
     41    if ( passes++ > NUM_PASSES ) {
     42        puts("*** END OF MALLOC TEST ***");
    4143        exit(0);
     44    }
    4245
    4346    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
     
    4750    print_time( " - rtems_clock_get - ", &time, "\n" );
    4851
    49     mem_amt = rand() * task_number( tid );
     52    mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
     53    while (!(mem_ptr = malloc ( mem_amt))) {
     54        printf("out of memory... trying again.\n");
     55        mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
     56    }
    5057    printf("mallocing %d bytes\n",mem_amt);
    51     mem_ptr = malloc ( mem_amt);
    5258    memset( mem_ptr, mem_amt, mem_amt );
    5359    malloc_dump();
  • testsuites/libtests/malloctest/system.h

    r0747e2d rcd792a86  
    4040#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
    4141
    42 #define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
     42#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    4343
    4444#include <confdefs.h>
     
    4646/* global variables */
    4747
    48 TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
    49 TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
     48TEST_EXTERN rtems_id   Task_id[ 6 ];         /* array of task ids */
     49TEST_EXTERN rtems_name Task_name[ 6 ];       /* array of task names */
    5050
    5151/* end of include file */
  • testsuites/libtests/malloctest/task1.c

    r0747e2d rcd792a86  
    1818#include <libcsupport.h>    /* for malloc_dump, malloc_walk */
    1919#include <string.h>         /* for memset */
     20#include <stdlib.h>
    2021
    2122#define NUM_PASSES 100
     
    3839  while (TRUE)
    3940  {
    40     if ( passes++ > NUM_PASSES )
     41    if ( passes++ > NUM_PASSES ) {
     42        puts("*** END OF MALLOC TEST ***");
    4143        exit(0);
     44    }
    4245
    4346    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
     
    4750    print_time( " - rtems_clock_get - ", &time, "\n" );
    4851
    49     mem_amt = rand() * task_number( tid );
     52    mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
     53    while (!(mem_ptr = malloc ( mem_amt))) {
     54        printf("out of memory... trying again.\n");
     55        mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
     56    }
    5057    printf("mallocing %d bytes\n",mem_amt);
    51     mem_ptr = malloc ( mem_amt);
    5258    memset( mem_ptr, mem_amt, mem_amt );
    5359    malloc_dump();
Note: See TracChangeset for help on using the changeset viewer.