Changeset 83889708 in rtems


Ignore:
Timestamp:
Jun 25, 2013, 12:32:44 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
b9acb4e
Parents:
7c1fcff3
git-author:
Sebastian Huber <sebastian.huber@…> (06/25/13 12:32:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/25/13 15:05:28)
Message:

sptests/sp62: Rework to avoid heap internals

This avoids problems with debugging enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/sp62/init.c

    r7c1fcff3 r83889708  
    2323volatile bool case_hit;
    2424
    25 #define    FIRST_ALLOC 980
    26 #define    BLOCK_ALLOC 900
    27 #define    RESIZE      16
     25#define    SECOND_ALLOC (sizeof(Region_Memory) / 2)
     26#define    RESIZE 1
    2827
    2928rtems_task Blocker(
     
    3231{
    3332  rtems_status_code  sc;
    34   void              *segment_address_1;
     33  void              *segment_address_2;
    3534
    3635  puts( "Blocker - rtems_region_get_segment - OK");
    3736  sc = rtems_region_get_segment(
    3837    Region,
    39     BLOCK_ALLOC,
     38    SECOND_ALLOC,
    4039    RTEMS_DEFAULT_OPTIONS,
    4140    RTEMS_NO_TIMEOUT,
    42     &segment_address_1
     41    &segment_address_2
    4342  );
    4443  directive_failed( sc, "rtems_region_get_segment" );
     44
     45  sc = rtems_region_return_segment( Region, segment_address_2 );
     46  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    4547
    4648  puts( "Blocker - Got memory after resize" );
     
    5860  void              *segment_address_1;
    5961  uintptr_t          old_size;
    60   size_t             size;
     62  size_t             first_alloc_size;
    6163
    6264  puts( "\n\n*** TEST 62 ***" );
     
    8991
    9092  puts( "Init - rtems_region_get_segment - OK");
    91   sc = rtems_region_get_segment(
    92     Region,
    93     FIRST_ALLOC,
    94     RTEMS_DEFAULT_OPTIONS,
    95     RTEMS_NO_TIMEOUT,
    96     &segment_address_1
    97   );
    98   directive_failed( sc, "rtems_region_get_segment" );
     93  first_alloc_size = sizeof( Region_Memory );
     94  do {
     95    --first_alloc_size;
     96    sc = rtems_region_get_segment(
     97      Region,
     98      first_alloc_size,
     99      RTEMS_NO_WAIT,
     100      RTEMS_NO_TIMEOUT,
     101      &segment_address_1
     102    );
     103  } while ( sc == RTEMS_UNSATISFIED || sc == RTEMS_INVALID_SIZE );
     104  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    99105
    100106  puts( "Init - sleep 1 second for Blocker - OK");
     
    122128   *  process any blocked tasks waiting for memory.
    123129   */
    124 
    125   size = sizeof(Region_Memory);
    126   while (1) {
    127     sc = rtems_region_resize_segment(
    128       Region, segment_address_1, size, &old_size);
    129     if ( sc == RTEMS_UNSATISFIED ) {
    130       size --;
    131       if ( size )
    132         continue;
    133     }
    134     directive_failed( sc, "rtems_region_resize_segment" );
    135     if ( sc == RTEMS_SUCCESSFUL )
    136       break;
    137 
    138   }
    139   if ( sc == RTEMS_SUCCESSFUL && size != 0 )
    140     puts( "Init - resized to all of available memory" );
     130  puts( "Init - resized to all of available memory" );
     131  sc = rtems_region_resize_segment(
     132    Region,
     133    segment_address_1,
     134    first_alloc_size,
     135    &old_size
     136  );
     137  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    141138
    142139  puts( "*** END OF TEST 62 ***" );
Note: See TracChangeset for help on using the changeset viewer.