Changeset 8ddd92d in rtems for testsuites


Ignore:
Timestamp:
Dec 14, 2017, 5:12:59 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
03e5a780
Parents:
0940648f
git-author:
Sebastian Huber <sebastian.huber@…> (12/14/17 05:12:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/02/18 14:01:23)
Message:

pipe: Use self-contained mutex

Update #2843.

File:
1 edited

Legend:

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

    r0940648f r8ddd92d  
    2727rtems_task Init(rtems_task_argument argument);
    2828void create_all_barriers(void);
    29 void create_all_semaphores(void);
    3029void delete_barrier(void);
    31 void delete_semaphore(void);
    3230void create_fifo(void);
    3331void open_fifo(int expected, int flags);
     
    6765}
    6866
    69 void create_all_semaphores(void)
    70 {
    71   rtems_status_code status;
    72   int               i;
    73 
    74   SemaphoreCount = 0;
    75 
    76   for ( i=0 ; i<MAXIMUM ; i++ ) {
    77     status = rtems_semaphore_create(
    78       rtems_build_name( 'S', 'E', 'M', 0x30+i ),
    79       0,
    80       RTEMS_DEFAULT_ATTRIBUTES,
    81       0,
    82       &Semaphores[i]
    83     );
    84     if ( status == RTEMS_TOO_MANY ) {
    85       printf( "%d Semaphores created\n", SemaphoreCount+1 );
    86       return;
    87     }
    88 
    89     directive_failed( status, "semaphore create" );
    90     SemaphoreCount++;
    91   }
    92 }
    93 
    9467void delete_barrier(void)
    9568{
     
    10174  status = rtems_barrier_delete( Barriers[BarrierCount] );
    10275  directive_failed( status, "barrier delete" );
    103 }
    104 
    105 void delete_semaphore(void)
    106 {
    107   rtems_status_code status;
    108  
    109   SemaphoreCount--;
    110   printf( "Deleting semaphore id=0x%08x\n",
    111     (unsigned int) Semaphores[SemaphoreCount] );
    112   status = rtems_semaphore_delete( Semaphores[SemaphoreCount] );
    113   directive_failed( status, "semaphore delete" );
    11476}
    11577
     
    150112  create_all_barriers();
    151113
    152   puts( "Creating all semaphores" );
    153   create_all_semaphores();
    154 
    155114  puts( "Creating FIFO" );
    156115  create_fifo();
    157 
    158   puts( "Opening FIFO.. expect ENOMEM (semaphore for pipe could not be created)" );
    159   open_fifo(ENOMEM, O_RDWR);
    160 
    161   delete_semaphore();
    162116
    163117  alloc_ptr = malloc( malloc_free_space() - 4 );
     
    174128
    175129  delete_barrier();
    176   puts( "Opening FIFO.. expect ENOMEM (semaphore-1 for pipe could not be created" );
    177   open_fifo(ENOMEM, O_RDWR);
    178 
    179   delete_semaphore();
    180130  puts( "Opening FIFO in RDWR mode. Expect OK" );
    181131  open_fifo(0, O_RDWR);
Note: See TracChangeset for help on using the changeset viewer.