Changeset 74416035 in rtems


Ignore:
Timestamp:
Sep 20, 2011, 1:06:58 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
82525a75
Parents:
40ee2fc0
Message:

2011-09-20 Petr Benes <benesp16@…>

PR 1916/testing

  • spcbssched02/init.c, spcbssched02/spcbssched02.scn, spcbssched02/system.h, spcbssched02/task_periodic.c, spedfsched03/init.c, spedfsched03/system.h, spedfsched03/tasks_aperiodic.c: Improve coverage.
Location:
testsuites/sptests
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/ChangeLog

    r40ee2fc0 r74416035  
     12011-09-20      Petr Benes <benesp16@fel.cvut.cz>
     2
     3        PR 1916/testing
     4        * spcbssched02/init.c, spcbssched02/spcbssched02.scn,
     5        spcbssched02/system.h, spcbssched02/task_periodic.c,
     6        spedfsched03/init.c, spedfsched03/system.h,
     7        spedfsched03/tasks_aperiodic.c: Improve coverage.
     8
    192011-09-15      Joel Sherrill <joel.sherrill@oarcorp.com>
    210
  • testsuites/sptests/spcbssched02/init.c

    r40ee2fc0 r74416035  
    4848
    4949  Task_name = rtems_build_name( 'P', 'T', '1', ' ' );
     50  Task_name2 = rtems_build_name( 'P', 'T', '2', ' ' );
    5051
    5152  status = rtems_task_create(
     
    5960  directive_failed( status, "rtems_task_create loop" );
    6061
     62  status = rtems_task_create(
     63    Task_name2,
     64    Priority,
     65    RTEMS_MINIMUM_STACK_SIZE * 4,
     66    RTEMS_NO_PREEMPT,
     67    RTEMS_DEFAULT_ATTRIBUTES,
     68    &Task_id2
     69  );
     70  directive_failed( status, "rtems_task_create loop" );
     71
    6172  printf( "Init: Initializing the CBS\n" );
    6273  if ( rtems_cbs_initialize() )
     
    8697    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
    8798  if ( rtems_cbs_create_server( &params, NULL, &server_id2 ) )
     99    printf( "ERROR: CREATE SERVER FAILED\n" );
     100  if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
    88101    printf( "ERROR: CREATE SERVER FAILED\n" );
    89102  if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
     
    218231    printf( "ERROR: CBS INITIALIZATION FAILED\n" );
    219232
    220   /* Start periodic task */
     233  /* Start periodic tasks */
    221234  printf( "Init: Starting periodic task\n" );
    222235  status = rtems_task_start( Task_id, Task_Periodic, 1 );
    223236  directive_failed( status, "rtems_task_start periodic" );
    224 
    225   status = rtems_task_delete( RTEMS_SELF );
    226   directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     237  status = rtems_task_start( Task_id2, Task_Periodic, 2 );
     238  directive_failed( status, "rtems_task_start periodic" );
     239
     240  rtems_task_wake_after( 130 );
     241
     242  printf( "Init: Checking server with a deleted task\n" );
     243  if ( rtems_cbs_get_execution_time( 0, &exec_time, &abs_time ) )
     244    printf( "ERROR: GET EXECUTION TIME FAILED\n" );
     245  if ( rtems_cbs_get_remaining_budget( 0, &remaining_budget) )
     246    printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
     247
     248  if ( rtems_cbs_cleanup() )
     249    printf( "ERROR: CBS CLEANUP\n" );
     250
     251  fflush(stdout);
     252  puts( "*** END OF TEST CBS SCHEDULER 2 ***" );
     253  rtems_test_exit( 0 );
    227254}
  • testsuites/sptests/spcbssched02/spcbssched02.scn

    r40ee2fc0 r74416035  
    2828P1-F ticks:101
    2929P1-S ticks:121
     30Periodic task: Deleting self
     31Init: Checking server with a deleted task
    3032*** END OF TEST CBS SCHEDULER 2 ***
  • testsuites/sptests/spcbssched02/system.h

    r40ee2fc0 r74416035  
    3333#define CONFIGURE_MICROSECONDS_PER_TICK 100000
    3434
    35 #define CONFIGURE_MAXIMUM_TASKS               2
     35#define CONFIGURE_MAXIMUM_TASKS               3
    3636#define CONFIGURE_MAXIMUM_PERIODS             10
    3737
     
    5555rtems_id   Task_id;
    5656rtems_name Task_name;
     57rtems_id   Task_id2;
     58rtems_name Task_name2;
    5759rtems_task_priority Priority;
    5860time_t  Period;
  • testsuites/sptests/spcbssched02/task_periodic.c

    r40ee2fc0 r74416035  
    3535  params.budget = Execution+1;
    3636
    37   printf( "Periodic task: Create server and Attach thread\n" );
    38   if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
    39     printf( "ERROR: CREATE SERVER FAILED\n" );
    40   if ( rtems_cbs_attach_thread( server_id, Task_id ) )
    41     printf( "ERROR: ATTACH THREAD FAILED\n" );
     37  /* Taks 1 will be attached to a server, task 2 not. */
     38  if ( argument == 1 ) {
     39    printf( "Periodic task: Create server and Attach thread\n" );
     40    if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
     41      printf( "ERROR: CREATE SERVER FAILED\n" );
     42    if ( rtems_cbs_attach_thread( server_id, Task_id ) )
     43      printf( "ERROR: ATTACH THREAD FAILED\n" );
    4244
    43   printf( "Periodic task: ID and Get parameters\n" );
    44   if ( rtems_cbs_get_server_id( Task_id, &tsid ) )
    45     printf( "ERROR: GET SERVER ID FAILED\n" );
    46   if ( tsid != server_id )
    47     printf( "ERROR: SERVER ID MISMATCH\n" );
    48   if ( rtems_cbs_get_parameters( server_id, &tparams ) )
    49     printf( "ERROR: GET PARAMETERS FAILED\n" );
    50   if ( params.deadline != tparams.deadline ||
    51        params.budget != tparams.budget )
    52     printf( "ERROR: PARAMETERS MISMATCH\n" );
     45    printf( "Periodic task: ID and Get parameters\n" );
     46    if ( rtems_cbs_get_server_id( Task_id, &tsid ) )
     47      printf( "ERROR: GET SERVER ID FAILED\n" );
     48    if ( tsid != server_id )
     49      printf( "ERROR: SERVER ID MISMATCH\n" );
     50    if ( rtems_cbs_get_parameters( server_id, &tparams ) )
     51      printf( "ERROR: GET PARAMETERS FAILED\n" );
     52    if ( params.deadline != tparams.deadline ||
     53         params.budget != tparams.budget )
     54      printf( "ERROR: PARAMETERS MISMATCH\n" );
    5355
    54   printf( "Periodic task: Detach thread and Destroy server\n" );
    55   if ( rtems_cbs_detach_thread( server_id, Task_id ) )
    56     printf( "ERROR: DETACH THREAD FAILED\n" );
    57   if ( rtems_cbs_destroy_server( server_id ) )
    58     printf( "ERROR: DESTROY SERVER FAILED\n" );
    59   if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
    60     printf( "ERROR: CREATE SERVER FAILED\n" );
     56    printf( "Periodic task: Detach thread and Destroy server\n" );
     57    if ( rtems_cbs_detach_thread( server_id, Task_id ) )
     58      printf( "ERROR: DETACH THREAD FAILED\n" );
     59    if ( rtems_cbs_destroy_server( server_id ) )
     60      printf( "ERROR: DESTROY SERVER FAILED\n" );
     61    if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
     62      printf( "ERROR: CREATE SERVER FAILED\n" );
    6163
    62   printf( "Periodic task: Remaining budget and Execution time\n" );
    63   if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) )
    64     printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
    65   if ( remaining_budget != params.budget )
    66     printf( "ERROR: REMAINING BUDGET MISMATCH\n" );
    67   if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
    68     printf( "ERROR: GET EXECUTION TIME FAILED\n" );
     64    printf( "Periodic task: Remaining budget and Execution time\n" );
     65    if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) )
     66      printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
     67    if ( remaining_budget != params.budget )
     68      printf( "ERROR: REMAINING BUDGET MISMATCH\n" );
     69    if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
     70      printf( "ERROR: GET EXECUTION TIME FAILED\n" );
    6971
    70   printf( "Periodic task: Set parameters\n" );
    71   if ( rtems_cbs_attach_thread( server_id, Task_id ) )
    72     printf( "ERROR: ATTACH THREAD FAILED\n" );
    73   params.deadline = Period * 2;
    74   params.budget = Execution * 2 +1;
    75   if ( rtems_cbs_set_parameters( server_id, &params ) )
    76     printf( "ERROR: SET PARAMS FAILED\n" );
    77   if ( rtems_cbs_get_parameters( server_id, &tparams ) )
    78     printf( "ERROR: GET PARAMS FAILED\n" );
    79   if ( params.deadline != tparams.deadline ||
    80        params.budget != tparams.budget )
    81     printf( "ERROR: PARAMS MISMATCH\n" );
    82   params.deadline = Period;
    83   params.budget = Execution+1;
    84   if ( rtems_cbs_set_parameters( server_id, &params ) )
    85     printf( "ERROR: SET PARAMS FAILED\n" );
    86   if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) )
    87     printf( "ERROR: GET APPROVED BUDGET FAILED\n" );
     72    printf( "Periodic task: Set parameters\n" );
     73    if ( rtems_cbs_attach_thread( server_id, Task_id ) )
     74      printf( "ERROR: ATTACH THREAD FAILED\n" );
     75    params.deadline = Period * 2;
     76    params.budget = Execution * 2 +1;
     77    if ( rtems_cbs_set_parameters( server_id, &params ) )
     78      printf( "ERROR: SET PARAMS FAILED\n" );
     79    if ( rtems_cbs_get_parameters( server_id, &tparams ) )
     80      printf( "ERROR: GET PARAMS FAILED\n" );
     81    if ( params.deadline != tparams.deadline ||
     82         params.budget != tparams.budget )
     83      printf( "ERROR: PARAMS MISMATCH\n" );
     84    params.deadline = Period;
     85    params.budget = Execution+1;
     86    if ( rtems_cbs_set_parameters( server_id, &params ) )
     87      printf( "ERROR: SET PARAMS FAILED\n" );
     88    if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) )
     89      printf( "ERROR: GET APPROVED BUDGET FAILED\n" );
    8890
    89   printf( "Periodic task: Approved budget\n" );
    90   if ( approved_budget != params.budget )
    91     printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
     91    printf( "Periodic task: Approved budget\n" );
     92    if ( approved_budget != params.budget )
     93      printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
     94  }
    9295
    9396  status = rtems_rate_monotonic_create( argument, &rmid );
     
    130133    rtems_test_exit( 0 );
    131134  }
    132   if ( rtems_cbs_cleanup() )
    133     printf( "ERROR: CBS CLEANUP\n" );
    134 
    135   fflush(stdout);
    136   puts( "*** END OF TEST CBS SCHEDULER 2 ***" );
    137   rtems_test_exit( 0 );
     135  printf( "Periodic task: Deleting self\n" );
     136  status = rtems_task_delete( RTEMS_SELF );
     137  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
    138138}
  • testsuites/sptests/spedfsched03/init.c

    r40ee2fc0 r74416035  
    5757  }
    5858
     59  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
     60
    5961  status = rtems_task_delete( RTEMS_SELF );
    6062  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
  • testsuites/sptests/spedfsched03/system.h

    r40ee2fc0 r74416035  
    4141
    4242#define CONFIGURE_INIT_TASK_PRIORITY          100
    43 #define CONFIGURE_INIT_TASK_INITIAL_MODES     RTEMS_DEFAULT_MODES
     43#define CONFIGURE_INIT_TASK_INITIAL_MODES     RTEMS_NO_PREEMPT
    4444#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    4545
  • testsuites/sptests/spedfsched03/tasks_aperiodic.c

    r40ee2fc0 r74416035  
    2222)
    2323{
    24   rtems_status_code  status;
    25   int                start;
    26   int                stop;
    27   int                now;
     24  rtems_status_code   status;
     25  int                 start;
     26  int                 stop;
     27  int                 now;
    2828
    2929  put_name( Task_name[ argument ], FALSE );
     
    3131  status = rtems_task_wake_after( 2 + Phases[argument] );
    3232  directive_failed( status, "rtems_task_wake_after" );
     33
     34  if ( argument == 6 ) {
     35    rtems_task_suspend( Task_id[5] );
     36    rtems_task_resume( Task_id[5] );
     37  }
    3338
    3439  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
Note: See TracChangeset for help on using the changeset viewer.