Changeset 830c6ee in rtems


Ignore:
Timestamp:
Jul 14, 2010, 11:23:12 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
8911ffd
Parents:
ba959a4b
Message:

2010-07-14 Joel Sherrill <joel.sherrill@…>

PR 1535/tests

  • malloc04/init.c, malloc04/malloc04.scn: Address issues in test. A mix of work by Ralf and Joel.
Location:
testsuites/libtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    rba959a4b r830c6ee  
     12010-07-14      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        PR 1535/tests
     4        * malloc04/init.c, malloc04/malloc04.scn: Address issues in test. A mix
     5        of work by Ralf and Joel.
     6
    172010-07-14      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • testsuites/libtests/malloc04/init.c

    rba959a4b r830c6ee  
    1414#include <rtems/libcsupport.h>
    1515#include <rtems/malloc.h>
     16#include <errno.h>
    1617
    1718char Malloc_Heap[ 128 ] CPU_STRUCTURE_ALIGNMENT;
     
    2627
    2728size_t offset;
     29
    2830void * sbrk(ptrdiff_t incr)
    2931{
     
    3133
    3234  printf( "sbrk(%td)\n", incr );
    33   if ( offset + incr < sizeof(Malloc_Heap) ) {
     35  if ( sbrk_count == -1 ) {
     36    p = (void *) (NULL - 2);
     37  } else if ( offset + incr < sizeof(Malloc_Heap) ) {
    3438     p = &Malloc_Heap[ offset ];
    3539     offset += incr;
     
    6872  p4 = malloc(48);
    6973 
     74  puts( "Initialize heap with some memory - return address out of heap" );
     75  RTEMS_Malloc_Initialize( &Malloc_Heap[1], 64, 64 );
     76  offset     = 64;
     77  sbrk_count = -1;
     78  p1 = malloc( 127 );
     79  rtems_test_assert( p1 == (void *) NULL );
     80  rtems_test_assert( errno == ENOMEM );
     81 
     82
     83  RTEMS_Malloc_Initialize( Malloc_Heap, 64, 64 );
    7084  puts( "Initialize heap with some unaligned memory" );
    7185  offset     = 65;
     
    102116  rtems_malloc_sbrk_helpers = NULL;
    103117
    104 
    105118  puts( "*** END OF TEST MALLOC 04 ***" );
    106119
  • testsuites/libtests/malloc04/malloc04.scn

    rba959a4b r830c6ee  
    44sbrk(128)
    55sbrk(64)
     6Initialize heap with some memory - return address out of heap
     7sbrk(128)
     8sbrk(-128)
    69Initialize heap with some unaligned memory
    710sbrk(128)
Note: See TracChangeset for help on using the changeset viewer.