Changeset a27fa6d in rtems


Ignore:
Timestamp:
12/04/06 14:10:48 (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c0547b49
Parents:
a7479f2
Message:

2006-12-04 Joel Sherrill <joel.sherrill@…>

  • sp33/init.c: Improve barrier test to include normal blocking with manual release and unblocking in barrier deletion.
Location:
testsuites/sptests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/ChangeLog

    ra7479f2 ra27fa6d  
     12006-12-04      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * sp33/init.c: Improve barrier test to include normal blocking with
     4        manual release and unblocking in barrier deletion.
     5
    162006-12-02      Ralf Corsépius <ralf.corsepius@rtems.org>
    27
  • testsuites/sptests/sp33/init.c

    ra7479f2 ra27fa6d  
    1818#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
    1919#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    20 #define CONFIGURE_MAXIMUM_TASKS     1
     20#define CONFIGURE_MAXIMUM_TASKS     5
    2121#define CONFIGURE_MAXIMUM_BARRIERS  1
    2222
    2323#define CONFIGURE_INIT
     24
     25rtems_id    Barrier;
     26
     27int SuccessfulCase;
     28int DeletedCase;
     29
     30rtems_task Waiter(
     31  rtems_task_argument number
     32)
     33{
     34  rtems_status_code status;
     35
     36  printf( "Waiter %d waiting on barrier\n", number );
     37  status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT );
     38
     39  printf( "Waiter %d back from barrier\n", number );
     40
     41  if ( SuccessfulCase == TRUE ) {
     42    directive_failed(status, "rtems_barrier_wait");
     43  } else if ( DeletedCase == TRUE ) {
     44    fatal_directive_status(
     45      status,
     46      RTEMS_OBJECT_WAS_DELETED,
     47      "rtems_barrier_wait did not get deleted"
     48    );
     49  }
     50
     51  rtems_task_delete( RTEMS_SELF );
     52}
    2453
    2554#include <rtems/confdefs.h>
     
    3059{
    3160  rtems_status_code status;
    32   rtems_name  name = rtems_build_name('B','A','R','1');
    33   rtems_id    id;
    34   uint32_t    released;
     61  rtems_name        name = rtems_build_name('B','A','R','1');
     62  uint32_t          released;
     63  rtems_id          testId;
     64  rtems_id          Tasks[CONFIGURE_MAXIMUM_TASKS-1];
     65  uint32_t          i;
    3566
    3667  puts("\n\n*** TEST 33 ***");
     
    3869  /* create period */
    3970  puts( "Create Barrier" );
    40   status = rtems_barrier_create( name, RTEMS_DEFAULT_ATTRIBUTES, 0, &id );
     71  status = rtems_barrier_create( name, RTEMS_DEFAULT_ATTRIBUTES, 0, &Barrier );
    4172  directive_failed(status, "rtems_barrier_create");
    4273
    43   puts( "Wait on Barrier w/timeout" );
    44   status = rtems_barrier_wait( id, 10 );
     74  puts( "Check Barrier ident" );
     75  status = rtems_barrier_ident( name, &testId );
     76  directive_failed(status, "rtems_barrier_ident");
     77  if ( testId != Barrier ) {
     78    printf( "ERROR -- rtems_barrier_create -- did not get Id expected\n" );
     79    exit( 0 );
     80  }
     81
     82  puts( "Wait on Barrier w/timeout and TIMEOUT" );
     83  status = rtems_barrier_wait( Barrier, 25 );
    4584  fatal_directive_status(
    4685    status,
     
    4988  );
    5089
    51 #if 0
    52   /* start period with initial value */
    53   status = rtems_barrier_release( id, &released );
     90  /* Release no tasks */
     91  status = rtems_barrier_release( Barrier, &released );
    5492  directive_failed(status, "rtems_barrier_release");
    5593  if ( released != 0 ) {
     
    5795    exit(0);
    5896  }
    59 #endif
     97
     98  /*
     99   *  Create some tasks to wait for the barrier
     100   */
     101  SuccessfulCase = TRUE;
     102  DeletedCase    = FALSE;
     103  puts( "\n*** Testing Regular Release of Barrier ***" );
     104  for (i=0 ; i<(CONFIGURE_MAXIMUM_TASKS-1) ; i++) {
     105    status = rtems_task_create(
     106      rtems_build_name('W','A','I','T'),
     107      1,
     108      RTEMS_MINIMUM_STACK_SIZE,
     109      RTEMS_DEFAULT_MODES,
     110      RTEMS_DEFAULT_ATTRIBUTES,
     111      &Tasks[ i ]
     112    );
     113    directive_failed( status, "rtems_task_create of Waiter" );
     114
     115    status = rtems_task_start( Tasks[ i ], Waiter, i );
     116    directive_failed( status, "rtems_task_start of Waiter" );
     117  }
     118
     119
     120  puts( "Delay to let Waiters block" );
     121  status = rtems_task_wake_after( TICKS_PER_SECOND );
     122  directive_failed(status, "rtems_task_wake_after");
     123
     124  /* Release tasks which were waiting */
     125  puts( "Releasing tasks" );
     126  status = rtems_barrier_release( Barrier, &released );
     127  directive_failed(status, "rtems_barrier_release");
     128  if ( released != (CONFIGURE_MAXIMUM_TASKS-1) ) {
     129    printf( "ERROR -- rtems_barrier_release -- released != %d, = %d",
     130         (CONFIGURE_MAXIMUM_TASKS-1), released);
     131    exit(0);
     132  }
     133
     134  puts( "Delay to let Waiters print a message" );
     135  status = rtems_task_wake_after( TICKS_PER_SECOND );
     136  directive_failed(status, "rtems_task_wake_after");
     137
     138  /*
     139   *  Create some tasks to wait for the barrier
     140   */
     141  SuccessfulCase = FALSE;
     142  DeletedCase    = TRUE;
     143  puts( "\n*** Testing Deletion of Barrier ***" );
     144  for (i=0 ; i<(CONFIGURE_MAXIMUM_TASKS-1) ; i++) {
     145    status = rtems_task_create(
     146      rtems_build_name('W','A','I','T'),
     147      1,
     148      RTEMS_MINIMUM_STACK_SIZE,
     149      RTEMS_DEFAULT_MODES,
     150      RTEMS_DEFAULT_ATTRIBUTES,
     151      &Tasks[ i ]
     152    );
     153    directive_failed( status, "rtems_task_create of Waiter" );
     154
     155    status = rtems_task_start( Tasks[ i ], Waiter, i );
     156    directive_failed( status, "rtems_task_start of Waiter" );
     157  }
     158
     159  puts( "Delay to let Waiters block" );
     160  status = rtems_task_wake_after( TICKS_PER_SECOND );
     161  directive_failed(status, "rtems_task_wake_after");
    60162
    61163  puts( "Delete barrier" );
    62   status = rtems_barrier_delete(id);
     164  status = rtems_barrier_delete( Barrier );
    63165  directive_failed(status, "rtems_barrier_delete");
     166
     167  puts( "Delay to let Waiters print a message" );
     168  status = rtems_task_wake_after( TICKS_PER_SECOND );
     169  directive_failed(status, "rtems_task_wake_after");
    64170
    65171  /* the end */
Note: See TracChangeset for help on using the changeset viewer.