Ticket #1907: cbs_scheduler_tests2.diff

File cbs_scheduler_tests2.diff, 47.6 KB (added by Petr Benes, on 09/14/11 at 19:41:49)

CBS scheduler tests - version 2

  • testsuites/sptests/Makefile.am

    diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
    index 8fcfd6d..c710576 100644
    a b SUBDIRS = \ 
    3030    spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \
    3131    spintrcritical17 spmkdir spmountmgr01 spheapprot \
    3232    spsimplesched01 spsimplesched02 spsimplesched03 spnsext01 \
    33     spedfsched01 spedfsched02 spedfsched03
     33    spedfsched01 spedfsched02 spedfsched03 \
     34    spcbssched01 spcbssched02 spcbssched03
    3435
    3536include $(top_srcdir)/../automake/subdirs.am
    3637include $(top_srcdir)/../automake/local.am
  • testsuites/sptests/configure.ac

    diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
    index d586362..47df64e 100644
    a b sp74/Makefile 
    103103sp75/Makefile
    104104sp76/Makefile
    105105spassoc01/Makefile
     106spcbssched01/Makefile
     107spcbssched02/Makefile
     108spcbssched03/Makefile
    106109spchain/Makefile
    107110spclockget/Makefile
    108111spcoverage/Makefile
  • new file testsuites/sptests/spcbssched01/Makefile.am

    diff --git a/testsuites/sptests/spcbssched01/Makefile.am b/testsuites/sptests/spcbssched01/Makefile.am
    new file mode 100644
    index 0000000..bc0b3e6
    - +  
     1##
     2## $Id$
     3##
     4
     5MANAGERS = io semaphore clock
     6
     7rtems_tests_PROGRAMS = spcbssched01
     8spcbssched01_SOURCES = init.c task1.c system.h
     9
     10dist_rtems_tests_DATA = spcbssched01.scn
     11dist_rtems_tests_DATA += spcbssched01.doc
     12
     13include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     14include $(top_srcdir)/../automake/compile.am
     15include $(top_srcdir)/../automake/leaf.am
     16
     17spcbssched01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     20
     21LINK_OBJS = $(spcbssched01_OBJECTS) $(spcbssched01_LDADD)
     22LINK_LIBS = $(spcbssched01_LDLIBS)
     23
     24spcbssched01$(EXEEXT): $(spcbssched01_OBJECTS) $(spcbssched01_DEPENDENCIES)
     25        @rm -f spcbssched01$(EXEEXT)
     26        $(make-exe)
     27
     28include $(top_srcdir)/../automake/local.am
  • new file testsuites/sptests/spcbssched01/init.c

    diff --git a/testsuites/sptests/spcbssched01/init.c b/testsuites/sptests/spcbssched01/init.c
    new file mode 100644
    index 0000000..a87e2cf
    - +  
     1/*  Init
     2 *
     3 *  This routine is the initialization task for this test program.
     4 *  It is a user initialization task and has the responsibility for creating
     5 *  and starting the tasks that make up the test.  If the time of day
     6 *  clock is required for the test, it should also be set to a known
     7 *  value by this function.
     8 *
     9 *  Input parameters:
     10 *    argument - task argument
     11 *
     12 *  Output parameters:  NONE
     13 *
     14 *  COPYRIGHT (c) 1989-1999.
     15 *  On-Line Applications Research Corporation (OAR).
     16 *
     17 *  The license and distribution terms for this file may be
     18 *  found in the file LICENSE in this distribution or at
     19 *  http://www.rtems.com/license/LICENSE.
     20 *
     21 *  $Id$
     22 */
     23
     24#define CONFIGURE_INIT
     25#include "system.h"
     26
     27rtems_task Init(
     28  rtems_task_argument argument
     29)
     30{
     31  rtems_time_of_day time;
     32  rtems_status_code status;
     33
     34  puts( "\n\n*** CBS SCHEDULER TEST 1 ***" );
     35
     36  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
     37  status = rtems_clock_set( &time );
     38  directive_failed( status, "rtems_clock_set" );
     39
     40  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
     41  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
     42  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
     43
     44  status = rtems_task_create(
     45     Task_name[ 1 ],
     46     1,
     47     RTEMS_MINIMUM_STACK_SIZE * 2,
     48     RTEMS_INTERRUPT_LEVEL(31),
     49     RTEMS_DEFAULT_ATTRIBUTES,
     50     &Task_id[ 1 ]
     51  );
     52  directive_failed( status, "rtems_task_create of TA1" );
     53
     54  status = rtems_task_create(
     55     Task_name[ 2 ],
     56     1,
     57     RTEMS_MINIMUM_STACK_SIZE * 2,
     58     RTEMS_DEFAULT_MODES,
     59     RTEMS_DEFAULT_ATTRIBUTES,
     60     &Task_id[ 2 ]
     61  );
     62  directive_failed( status, "rtems_task_create of TA2" );
     63
     64  status = rtems_task_create(
     65     Task_name[ 3 ],
     66     1,
     67     RTEMS_MINIMUM_STACK_SIZE * 3,
     68     RTEMS_DEFAULT_MODES,
     69     RTEMS_DEFAULT_ATTRIBUTES,
     70     &Task_id[ 3 ]
     71  );
     72  directive_failed( status, "rtems_task_create of TA3" );
     73
     74  status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
     75  directive_failed( status, "rtems_task_start of TA1" );
     76
     77  status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
     78  directive_failed( status, "rtems_task_start of TA2" );
     79
     80  status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
     81  directive_failed( status, "rtems_task_start of TA3" );
     82
     83  status = rtems_task_delete( RTEMS_SELF );
     84  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     85}
  • new file testsuites/sptests/spcbssched01/spcbssched01.doc

    diff --git a/testsuites/sptests/spcbssched01/spcbssched01.doc b/testsuites/sptests/spcbssched01/spcbssched01.doc
    new file mode 100644
    index 0000000..7c5ab0d
    - +  
     1#
     2#  $Id$
     3#
     4#  COPYRIGHT (c) 1989-1999.
     5#  On-Line Applications Research Corporation (OAR).
     6#
     7#  The license and distribution terms for this file may be
     8#  found in the file LICENSE in this distribution or at
     9#  http://www.rtems.com/license/LICENSE.
     10#
     11
     12This file describes the directives and concepts tested by this test set.
     13
     14test set name:  spcbssched01
     15
     16directives:
     17  ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
     18  tm_set, tm_get, tm_wkafter
     19
     20concepts:
     21
     22This test is identical to sp01 but for CBS-based scheduling:
     23
     24  a.  Verifies system can create and start both the executive's system
     25      initialization and idle task.
     26
     27  b.  Verifies executive can swap between three application tasks at the
     28      same priority and the executive's internal idle task.
     29
     30  c.  Verifies can print strings to the CRT on port 2 of the mvme136 board
     31      using Print and Println in the board support package.
     32
     33  d.  Verifies interrupt handler can handle a task switch from an interrupt
     34      as specified with the i_return directive.
     35
     36  e.  Verifies executive initialization performed correctly.
     37
     38  f.  Verifies the executive trap handler except for the halt function.
     39
     40  g.  Verifies that a task can get the task identification number of itself.
     41
     42  h.  Verifies implementation of SuperCore TOD_MILLISECONDS_TO_TICKS.  Normal
     43      computation in applications is via a macro at the Classic API level.
     44
     45output:
     46 "TA1" is printed once every 5 seconds.  "TA2" is printed once
     47 every 10 seconds.  "TA3" is printed once every 15 seconds.
  • new file testsuites/sptests/spcbssched01/spcbssched01.scn

    diff --git a/testsuites/sptests/spcbssched01/spcbssched01.scn b/testsuites/sptests/spcbssched01/spcbssched01.scn
    new file mode 100644
    index 0000000..f53dbb5
    - +  
     1*** CBS SCHEDULER TEST 1 ***
     2TA1  - rtems_clock_get_tod - 09:00:00   12/31/1988
     3TA2  - rtems_clock_get_tod - 09:00:00   12/31/1988
     4TA3  - rtems_clock_get_tod - 09:00:00   12/31/1988
     5TA1  - rtems_clock_get_tod - 09:00:05   12/31/1988
     6TA1  - rtems_clock_get_tod - 09:00:10   12/31/1988
     7TA2  - rtems_clock_get_tod - 09:00:10   12/31/1988
     8TA1  - rtems_clock_get_tod - 09:00:15   12/31/1988
     9TA3  - rtems_clock_get_tod - 09:00:15   12/31/1988
     10TA1  - rtems_clock_get_tod - 09:00:20   12/31/1988
     11TA2  - rtems_clock_get_tod - 09:00:20   12/31/1988
     12TA1  - rtems_clock_get_tod - 09:00:25   12/31/1988
     13TA1  - rtems_clock_get_tod - 09:00:30   12/31/1988
     14TA3  - rtems_clock_get_tod - 09:00:30   12/31/1988
     15TA2  - rtems_clock_get_tod - 09:00:30   12/31/1988
     16*** END OF CBS SCHEDULER TEST 1 ***
  • new file testsuites/sptests/spcbssched01/system.h

    diff --git a/testsuites/sptests/spcbssched01/system.h b/testsuites/sptests/spcbssched01/system.h
    new file mode 100644
    index 0000000..b42384a
    - +  
     1/*  system.h
     2 *
     3 *  This include file contains information that is included in every
     4 *  function in the test set.
     5 *
     6 *  COPYRIGHT (c) 1989-1999.
     7 *  On-Line Applications Research Corporation (OAR).
     8 *
     9 *  The license and distribution terms for this file may be
     10 *  found in the file LICENSE in this distribution or at
     11 *  http://www.rtems.com/license/LICENSE.
     12 *
     13 *  $Id$
     14 */
     15
     16#include <tmacros.h>
     17
     18/* functions */
     19
     20rtems_task Init(
     21  rtems_task_argument argument
     22);
     23
     24rtems_task Task_1_through_3(
     25  rtems_task_argument argument
     26);
     27
     28/* configuration information */
     29
     30#define CONFIGURE_SCHEDULER_CBS
     31
     32#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     33#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     34
     35#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
     36
     37#define CONFIGURE_EXTRA_TASK_STACKS         (4 * RTEMS_MINIMUM_STACK_SIZE)
     38#define CONFIGURE_MAXIMUM_TASKS             4
     39
     40#include <rtems/confdefs.h>
     41
     42/* global variables */
     43
     44TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
     45TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
     46
     47/* end of include file */
  • new file testsuites/sptests/spcbssched01/task1.c

    diff --git a/testsuites/sptests/spcbssched01/task1.c b/testsuites/sptests/spcbssched01/task1.c
    new file mode 100644
    index 0000000..3d9e1e5
    - +  
     1/*  Task_1_through_3
     2 *
     3 *  This routine serves as a test task.  It verifies the basic task
     4 *  switching capabilities of the executive.
     5 *
     6 *  Input parameters:
     7 *    argument - task argument
     8 *
     9 *  Output parameters:  NONE
     10 *
     11 *  COPYRIGHT (c) 1989-1999.
     12 *  On-Line Applications Research Corporation (OAR).
     13 *
     14 *  The license and distribution terms for this file may be
     15 *  found in the file LICENSE in this distribution or at
     16 *  http://www.rtems.com/license/LICENSE.
     17 *
     18 *  $Id$
     19 */
     20
     21#include "system.h"
     22
     23rtems_task Task_1_through_3(
     24  rtems_task_argument argument
     25)
     26{
     27  rtems_id          tid;
     28  rtems_time_of_day time;
     29  rtems_status_code status;
     30  rtems_interval    ticks;
     31
     32  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
     33  directive_failed( status, "rtems_task_ident" );
     34
     35  /*
     36   * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to
     37   * test C implementation in SuperCore -- not macro version used
     38   * everywhere else.
     39   */
     40  ticks = TOD_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 );
     41
     42  while( FOREVER ) {
     43    status = rtems_clock_get_tod( &time );
     44    directive_failed( status, "rtems_clock_get_tod" );
     45
     46    if ( time.second >= 35 ) {
     47      puts( "*** END OF CBS SCHEDULER TEST 1 ***" );
     48      rtems_test_exit( 0 );
     49    }
     50
     51    put_name( Task_name[ task_number( tid ) ], FALSE );
     52    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
     53
     54    status = rtems_task_wake_after( ticks );
     55    directive_failed( status, "rtems_task_wake_after" );
     56  }
     57}
  • new file testsuites/sptests/spcbssched02/Makefile.am

    diff --git a/testsuites/sptests/spcbssched02/Makefile.am b/testsuites/sptests/spcbssched02/Makefile.am
    new file mode 100644
    index 0000000..664978c
    - +  
     1##
     2## $Id$
     3##
     4
     5MANAGERS = io rate_monotonic semaphore clock
     6
     7rtems_tests_PROGRAMS = spcbssched02
     8spcbssched02_SOURCES = init.c task_periodic.c system.h
     9
     10dist_rtems_tests_DATA = spcbssched02.scn
     11dist_rtems_tests_DATA += spcbssched02.doc
     12
     13include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     14include $(top_srcdir)/../automake/compile.am
     15include $(top_srcdir)/../automake/leaf.am
     16
     17spcbssched02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     20
     21LINK_OBJS = $(spcbssched02_OBJECTS) $(spcbssched02_LDADD)
     22LINK_LIBS = $(spcbssched02_LDLIBS)
     23
     24spcbssched02$(EXEEXT): $(spcbssched02_OBJECTS) $(spcbssched02_DEPENDENCIES)
     25        @rm -f spcbssched02$(EXEEXT)
     26        $(make-exe)
     27
     28include $(top_srcdir)/../automake/local.am
  • new file testsuites/sptests/spcbssched02/init.c

    diff --git a/testsuites/sptests/spcbssched02/init.c b/testsuites/sptests/spcbssched02/init.c
    new file mode 100644
    index 0000000..7cb305c
    - +  
     1/*  Init
     2 *
     3 *  This routine is the initialization task for this test program.
     4 *  It is a user initialization task and has the responsibility for creating
     5 *  and starting the tasks that make up the test.  If the time of day
     6 *  clock is required for the test, it should also be set to a known
     7 *  value by this function.
     8 *
     9 *  Input parameters:
     10 *    argument - task argument
     11 *
     12 *  Output parameters:  NONE
     13 *
     14 *  The license and distribution terms for this file may be
     15 *  found in the file LICENSE in this distribution or at
     16 *  http://www.rtems.com/license/LICENSE.
     17 *
     18 *  $Id$
     19 */
     20
     21#define CONFIGURE_INIT
     22#include "system.h"
     23
     24rtems_task Init(
     25  rtems_task_argument argument
     26)
     27{
     28  rtems_status_code status;
     29  rtems_cbs_server_id server_id, server_id2;
     30  time_t approved_budget, exec_time, abs_time, remaining_budget;
     31  rtems_cbs_parameters params, params1, params2, params3, params4;
     32
     33  Priority = 30;
     34  Period    = 30;
     35  Execution = 10;
     36  Phase = 0;
     37
     38  params.deadline = 1;
     39  params.budget = 1;
     40
     41  params1 = params2 = params3 = params4 = params;
     42  params1.budget = -1;
     43  params2.budget = SCHEDULER_EDF_PRIO_MSB + 1;
     44  params3.deadline = -1;
     45  params4.deadline = SCHEDULER_EDF_PRIO_MSB + 1;
     46
     47  puts( "\n\n*** TEST CBS SCHEDULER 2 ***" );
     48
     49  Task_name = rtems_build_name( 'P', 'T', '1', ' ' );
     50
     51  status = rtems_task_create(
     52    Task_name,
     53    Priority,
     54    RTEMS_MINIMUM_STACK_SIZE * 4,
     55    RTEMS_DEFAULT_MODES,
     56    RTEMS_DEFAULT_ATTRIBUTES,
     57    &Task_id
     58  );
     59  directive_failed( status, "rtems_task_create loop" );
     60
     61  printf( "Init: Initializing the CBS\n" );
     62  if ( rtems_cbs_initialize() )
     63    printf( "ERROR: CBS INITIALIZATION FAILED\n" );
     64
     65  /* Error checks for Create server and Destroy server  */
     66  printf( "Init: Create server and Destroy server\n" );
     67  if ( rtems_cbs_destroy_server( -5 ) !=
     68       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     69    printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" );
     70  if ( rtems_cbs_destroy_server( 5 ) !=
     71       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     72    printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" );
     73  if ( rtems_cbs_destroy_server( 0 ) != SCHEDULER_CBS_ERROR_NOSERVER )
     74    printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" );
     75  if ( rtems_cbs_create_server( &params1, NULL, &server_id ) !=
     76       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     77    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
     78  if ( rtems_cbs_create_server( &params2, NULL, &server_id ) !=
     79       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     80    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
     81  if ( rtems_cbs_create_server( &params3, NULL, &server_id ) !=
     82       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     83    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
     84  if ( rtems_cbs_create_server( &params4, NULL, &server_id ) !=
     85       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     86    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
     87  if ( rtems_cbs_create_server( &params, NULL, &server_id2 ) )
     88    printf( "ERROR: CREATE SERVER FAILED\n" );
     89  if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
     90    printf( "ERROR: CREATE SERVER FAILED\n" );
     91  if ( rtems_cbs_create_server( &params, NULL, &server_id ) !=
     92       SCHEDULER_CBS_ERROR_FULL )
     93    printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
     94
     95  /* Error checks for Attach thread and Detach thread */
     96  printf( "Init: Attach thread\n" );
     97  if ( rtems_cbs_attach_thread( -5, RTEMS_SELF ) !=
     98       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     99    printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" );
     100  if ( rtems_cbs_attach_thread( 5, RTEMS_SELF ) !=
     101       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     102    printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" );
     103  if ( rtems_cbs_attach_thread( server_id, 1234 ) !=
     104       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     105    printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" );
     106  if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) )
     107    printf( "ERROR: ATTACH THREAD FAILED\n" );
     108  if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) !=
     109       SCHEDULER_CBS_ERROR_FULL )
     110    printf( "ERROR: ATTACH THREAD AGAIN PASSED UNEXPECTEDLY\n" );
     111  if ( rtems_cbs_attach_thread( server_id, Task_id ) !=
     112       SCHEDULER_CBS_ERROR_FULL )
     113    printf( "ERROR: ATTACH THREAD TO FULL SERVER PASSED UNEXPECTEDLY \n" );
     114  if ( rtems_cbs_destroy_server( server_id ) )
     115    printf( "ERROR: DESTROY SERVER WITH THREAD ATTACHED FAILED\n" );
     116  if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) !=
     117       SCHEDULER_CBS_ERROR_NOSERVER )
     118    printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" );
     119
     120  printf( "Init: Detach thread\n" );
     121  if ( rtems_cbs_detach_thread( -5, RTEMS_SELF ) !=
     122       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     123    printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" );
     124  if ( rtems_cbs_detach_thread( 5, RTEMS_SELF ) !=
     125       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     126    printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" );
     127  if ( rtems_cbs_detach_thread( server_id2, 1234 ) !=
     128       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     129    printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY \n" );
     130  if ( rtems_cbs_detach_thread( server_id, RTEMS_SELF ) !=
     131       SCHEDULER_CBS_ERROR_NOSERVER )
     132    printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY4\n" );
     133  rtems_cbs_destroy_server( server_id2 );
     134
     135  /* Error checks for Set parameters and Get parameters */
     136  printf( "Init: Set parameters and Get parameters\n" );
     137  if ( rtems_cbs_set_parameters( -5, &params ) !=
     138       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     139    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     140  if ( rtems_cbs_set_parameters( 5, &params ) !=
     141       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     142    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     143  if ( rtems_cbs_set_parameters( server_id, &params ) !=
     144       SCHEDULER_CBS_ERROR_NOSERVER )
     145    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     146
     147  if ( rtems_cbs_get_parameters( -5, &params ) !=
     148       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     149    printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" );
     150  if ( rtems_cbs_get_parameters( 5, &params ) !=
     151       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     152    printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" );
     153  if ( rtems_cbs_get_parameters( server_id, &params ) !=
     154       SCHEDULER_CBS_ERROR_NOSERVER )
     155    printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" );
     156
     157  if ( rtems_cbs_set_parameters( server_id, &params1 ) !=
     158       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     159    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     160  if ( rtems_cbs_set_parameters( server_id, &params2 ) !=
     161       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     162    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     163  if ( rtems_cbs_set_parameters( server_id, &params3 ) !=
     164       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     165    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     166  if ( rtems_cbs_set_parameters( server_id, &params4 ) !=
     167       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     168    printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" );
     169
     170  /* Error checks for Get server id */
     171  printf( "Init: Get server id\n" );
     172  if ( rtems_cbs_get_server_id( RTEMS_SELF, &server_id ) !=
     173       SCHEDULER_CBS_ERROR_NOSERVER )
     174    printf( "ERROR: GET SERVER ID PASSED UNEXPECTEDLY\n" );
     175
     176  /* Error checks for Get approved budget */
     177  printf( "Init: Get approved budget\n" );
     178  if ( rtems_cbs_get_approved_budget( -5, &approved_budget ) !=
     179       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     180    printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" );
     181  if ( rtems_cbs_get_approved_budget( 5, &approved_budget ) !=
     182       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     183    printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" );
     184  if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) !=
     185       SCHEDULER_CBS_ERROR_NOSERVER )
     186    printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" );
     187
     188  /* Error checks for Get remaining budget */
     189  printf( "Init: Get remaining budget\n" );
     190  if ( rtems_cbs_get_remaining_budget( -5, &remaining_budget ) !=
     191       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     192    printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" );
     193  if ( rtems_cbs_get_remaining_budget( 5, &remaining_budget ) !=
     194       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     195    printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" );
     196  if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) !=
     197       SCHEDULER_CBS_ERROR_NOSERVER )
     198    printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" );
     199
     200  /* Error checks for Get execution time */
     201  printf( "Init: Get execution time\n" );
     202  if ( rtems_cbs_get_execution_time( -5, &exec_time, &abs_time ) !=
     203       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     204    printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" );
     205  if ( rtems_cbs_get_execution_time( 5, &exec_time, &abs_time ) !=
     206       SCHEDULER_CBS_ERROR_INVALID_PARAMETER )
     207    printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" );
     208  if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) !=
     209       SCHEDULER_CBS_ERROR_NOSERVER )
     210    printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" );
     211
     212  /* Restart CBS library */
     213  printf( "Init: Cleaning up CBS\n" );
     214  if ( rtems_cbs_cleanup() )
     215    printf( "ERROR: CBS CLEANUP FAILED\n" );
     216  printf( "Init: Initializing the CBS\n" );
     217  if ( rtems_cbs_initialize() )
     218    printf( "ERROR: CBS INITIALIZATION FAILED\n" );
     219
     220  /* Start periodic task */
     221  printf( "Init: Starting periodic task\n" );
     222  status = rtems_task_start( Task_id, Task_Periodic, 1 );
     223  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" );
     227}
  • new file testsuites/sptests/spcbssched02/spcbssched02.doc

    diff --git a/testsuites/sptests/spcbssched02/spcbssched02.doc b/testsuites/sptests/spcbssched02/spcbssched02.doc
    new file mode 100644
    index 0000000..6a2934c
    - +  
     1#
     2#  $Id$
     3#
     4#  COPYRIGHT (c) 1989-1999.
     5#  On-Line Applications Research Corporation (OAR).
     6#
     7#  The license and distribution terms for this file may be
     8#  found in the file LICENSE in this distribution or at
     9#  http://www.rtems.com/license/LICENSE.
     10#
     11
     12
     13This file describes the directives and concepts tested by this test set.
     14
     15test set name:  spcbssched02
     16
     17directives:
     18
     19
     20concepts:
     21
     22  a.  Verifies CBS library functionality.
  • new file testsuites/sptests/spcbssched02/spcbssched02.scn

    diff --git a/testsuites/sptests/spcbssched02/spcbssched02.scn b/testsuites/sptests/spcbssched02/spcbssched02.scn
    new file mode 100644
    index 0000000..0a38bd8
    - +  
     1*** TEST CBS SCHEDULER 2 ***
     2Init: Initializing the CBS
     3Init: Create server and Destroy server
     4Init: Attach thread
     5Init: Detach thread
     6Init: Set parameters and Get parameters
     7Init: Get server id
     8Init: Get approved budget
     9Init: Get remaining budget
     10Init: Get execution time
     11Init: Cleaning up CBS
     12Init: Initializing the CBS
     13Init: Starting periodic task
     14Periodic task: Create server and Attach thread
     15Periodic task: ID and Get parameters
     16Periodic task: Detach thread and Destroy server
     17Periodic task: Remaining budget and Execution time
     18Periodic task: Set parameters
     19Periodic task: Approved budget
     20Periodic task: Starting periodic behavior
     21P1-S ticks:1
     22P1-F ticks:11
     23P1-S ticks:31
     24P1-F ticks:41
     25P1-S ticks:61
     26P1-F ticks:71
     27P1-S ticks:91
     28P1-F ticks:101
     29P1-S ticks:121
     30*** END OF TEST CBS SCHEDULER 2 ***
  • new file testsuites/sptests/spcbssched02/system.h

    diff --git a/testsuites/sptests/spcbssched02/system.h b/testsuites/sptests/spcbssched02/system.h
    new file mode 100644
    index 0000000..0119143
    - +  
     1/*  system.h
     2 *
     3 *  This include file contains information that is included in every
     4 *  function in the test set.
     5 *
     6 *  COPYRIGHT (c) 1989-1999.
     7 *  On-Line Applications Research Corporation (OAR).
     8 *
     9 *  The license and distribution terms for this file may be
     10 *  found in the file LICENSE in this distribution or at
     11 *  http://www.rtems.com/license/LICENSE.
     12 *
     13 *  $Id$
     14 */
     15
     16#include <tmacros.h>
     17
     18/* functions */
     19
     20rtems_task Init(
     21  rtems_task_argument argument
     22);
     23
     24rtems_task Task_Periodic(
     25  rtems_task_argument argument
     26);
     27
     28/* configuration information */
     29
     30#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     31#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     32
     33#define CONFIGURE_MICROSECONDS_PER_TICK 100000
     34
     35#define CONFIGURE_MAXIMUM_TASKS               2
     36#define CONFIGURE_MAXIMUM_PERIODS             10
     37
     38#define CONFIGURE_INIT_TASK_PRIORITY          100
     39#define CONFIGURE_INIT_TASK_INITIAL_MODES     RTEMS_DEFAULT_MODES
     40#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
     41
     42#define CONFIGURE_EXTRA_TASK_STACKS         (6 * 4 * RTEMS_MINIMUM_STACK_SIZE)
     43
     44#define CONFIGURE_SCHEDULER_CBS
     45
     46#include <rtems/confdefs.h>
     47
     48#include <rtems/rtems/clock.h>
     49#include <rtems/score/isr.h>
     50#include <rtems/rtems/intr.h>
     51#include <rtems/cbs.h>
     52
     53/* global variables */
     54
     55rtems_id   Task_id;
     56rtems_name Task_name;
     57rtems_task_priority Priority;
     58time_t  Period;
     59time_t  Execution;
     60time_t  Phase;
     61
     62/* end of include file */
  • new file testsuites/sptests/spcbssched02/task_periodic.c

    diff --git a/testsuites/sptests/spcbssched02/task_periodic.c b/testsuites/sptests/spcbssched02/task_periodic.c
    new file mode 100644
    index 0000000..c59a514
    - +  
     1/*  Tasks_Periodic
     2 *
     3 *  This routine serves as a test task for the CBS scheduler
     4 *  implementation.
     5 *
     6 *  Input parameters:
     7 *    argument - task argument
     8 *
     9 *  Output parameters:  NONE
     10 *
     11 *  The license and distribution terms for this file may be
     12 *  found in the file LICENSE in this distribution or at
     13 *  http://www.rtems.com/license/LICENSE.
     14 *
     15 *  $Id$
     16 */
     17
     18#include "system.h"
     19
     20rtems_task Task_Periodic(
     21  rtems_task_argument argument
     22)
     23{
     24  rtems_id          rmid;
     25  rtems_status_code status;
     26
     27  time_t approved_budget, exec_time, abs_time, remaining_budget;
     28
     29  int start, stop, now;
     30
     31  rtems_cbs_server_id server_id, tsid;
     32  rtems_cbs_parameters params, tparams;
     33
     34  params.deadline = Period;
     35  params.budget = Execution+1;
     36
     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" );
     42
     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" );
     53
     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" );
     61
     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" );
     69
     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" );
     88
     89  printf( "Periodic task: Approved budget\n" );
     90  if ( approved_budget != params.budget )
     91    printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
     92
     93  status = rtems_rate_monotonic_create( argument, &rmid );
     94  directive_failed( status, "rtems_rate_monotonic_create" );
     95
     96  /* Starting periodic behavior of the task */
     97  printf( "Periodic task: Starting periodic behavior\n" );
     98  status = rtems_task_wake_after( 1 + Phase );
     99  directive_failed( status, "rtems_task_wake_after" );
     100
     101  while ( FOREVER ) {
     102    if ( rtems_rate_monotonic_period(rmid, Period) == RTEMS_TIMEOUT )
     103      printf( "P%" PRIdPTR " - Deadline miss\n", argument );
     104
     105    rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start );
     106    printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start );
     107    if ( start > 4*Period+Phase ) break; /* stop */
     108    /* active computing */
     109    while(FOREVER) {
     110      rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
     111      if ( now >= start + Execution ) break;
     112
     113      if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
     114        printf( "ERROR: GET EXECUTION TIME FAILED\n" );
     115      if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget) )
     116        printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
     117      if ( (remaining_budget + exec_time) > (Execution + 1) ) {
     118        printf( "ERROR: REMAINING BUDGET AND EXECUTION TIME MISMATCH\n" );
     119        rtems_test_exit( 0 );
     120      }
     121    }
     122    rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop );
     123    printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop );
     124  }
     125
     126  /* delete period and SELF */
     127  status = rtems_rate_monotonic_delete( rmid );
     128  if ( status != RTEMS_SUCCESSFUL ) {
     129    printf("rtems_rate_monotonic_delete failed with status of %d.\n", status);
     130    rtems_test_exit( 0 );
     131  }
     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 );
     138}
  • new file testsuites/sptests/spcbssched03/Makefile.am

    diff --git a/testsuites/sptests/spcbssched03/Makefile.am b/testsuites/sptests/spcbssched03/Makefile.am
    new file mode 100644
    index 0000000..5b884a2
    - +  
     1##
     2## $Id$
     3##
     4
     5MANAGERS = io rate_monotonic semaphore clock
     6
     7rtems_tests_PROGRAMS = spcbssched03
     8spcbssched03_SOURCES = init.c tasks_periodic.c tasks_aperiodic.c system.h cbsparams.h
     9
     10dist_rtems_tests_DATA = spcbssched03.scn
     11dist_rtems_tests_DATA += spcbssched03.doc
     12
     13include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     14include $(top_srcdir)/../automake/compile.am
     15include $(top_srcdir)/../automake/leaf.am
     16
     17spcbssched03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     20
     21LINK_OBJS = $(spcbssched03_OBJECTS) $(spcbssched03_LDADD)
     22LINK_LIBS = $(spcbssched03_LDLIBS)
     23
     24spcbssched03$(EXEEXT): $(spcbssched03_OBJECTS) $(spcbssched03_DEPENDENCIES)
     25        @rm -f spcbssched03$(EXEEXT)
     26        $(make-exe)
     27
     28include $(top_srcdir)/../automake/local.am
  • new file testsuites/sptests/spcbssched03/cbsparams.h

    diff --git a/testsuites/sptests/spcbssched03/cbsparams.h b/testsuites/sptests/spcbssched03/cbsparams.h
    new file mode 100644
    index 0000000..a77bc93
    - +  
     1/*  cbsparams.h
     2 *
     3 *  This include file contains information that is included in every
     4 *  function in the test set.
     5 *
     6 *  COPYRIGHT (c) 1989-1999.
     7 *  On-Line Applications Research Corporation (OAR).
     8 *
     9 *  The license and distribution terms for this file may be
     10 *  found in the file LICENSE in this distribution or at
     11 *  http://www.rtems.com/license/LICENSE.
     12 *
     13 *  $Id$
     14 */
     15
     16/* This file was generated with the following parameters:
     17-T 30,10,0 -T 40,10,0 -T 50,10,0 -T 70,10,0 -A 1,100,7 -A 100,5,4
     18*/
     19
     20#ifndef __CBSPARAMS_H_
     21#define __CBSPARAMS_H_
     22
     23#include "system.h"
     24
     25rtems_task_priority Priorities[1+NUM_TASKS]= { 0, 30, 40, 50, 70, 254, 254 };
     26
     27uint32_t  Periods[1+NUM_PERIODIC_TASKS]    = { 0, 30, 40, 50, 70 };
     28
     29uint32_t  Execution[1+NUM_TASKS]           = { 0, 10, 10, 10, 10, 100, 5 };
     30
     31uint32_t  Phases[1+NUM_TASKS]              = { 0, 0, 0, 0, 0, 7, 4 };
     32
     33#define build_task_name() do { \
     34Task_name[ 1 ] =  rtems_build_name( 'P', 'T', '1', ' ' );\
     35Task_name[ 2 ] =  rtems_build_name( 'P', 'T', '2', ' ' );\
     36Task_name[ 3 ] =  rtems_build_name( 'P', 'T', '3', ' ' );\
     37Task_name[ 4 ] =  rtems_build_name( 'P', 'T', '4', ' ' );\
     38Task_name[ 5 ] =  rtems_build_name( 'A', 'T', '5', ' ' );\
     39Task_name[ 6 ] =  rtems_build_name( 'A', 'T', '6', ' ' );\
     40} while(0)
     41
     42#endif
  • new file testsuites/sptests/spcbssched03/init.c

    diff --git a/testsuites/sptests/spcbssched03/init.c b/testsuites/sptests/spcbssched03/init.c
    new file mode 100644
    index 0000000..7774794
    - +  
     1/*  Init
     2 *
     3 *  This routine is the initialization task for this test program.
     4 *  It is a user initialization task and has the responsibility for creating
     5 *  and starting the tasks that make up the test.  If the time of day
     6 *  clock is required for the test, it should also be set to a known
     7 *  value by this function.
     8 *
     9 *  Input parameters:
     10 *    argument - task argument
     11 *
     12 *  Output parameters:  NONE
     13 *
     14 *  The license and distribution terms for this file may be
     15 *  found in the file LICENSE in this distribution or at
     16 *  http://www.rtems.com/license/LICENSE.
     17 *
     18 *  $Id$
     19 */
     20
     21#define CONFIGURE_INIT
     22#include "system.h"
     23
     24#include "cbsparams.h"
     25
     26rtems_task Init(
     27  rtems_task_argument argument
     28)
     29{
     30  uint32_t    index;
     31  rtems_status_code status;
     32
     33  puts( "\n\n*** TEST CBS SCHEDULER 3 ***" );
     34
     35  build_task_name();
     36
     37  for ( index = 1 ; index <= NUM_TASKS ; index++ ) {
     38    status = rtems_task_create(
     39      Task_name[ index ],
     40      Priorities[ index ],
     41      RTEMS_MINIMUM_STACK_SIZE * 4,
     42      RTEMS_DEFAULT_MODES,
     43      RTEMS_DEFAULT_ATTRIBUTES,
     44      &Task_id[ index ]
     45    );
     46    directive_failed( status, "rtems_task_create loop" );
     47  }
     48
     49  rtems_cbs_initialize();
     50
     51  for ( index = 1 ; index <= NUM_PERIODIC_TASKS ; index++ ) {
     52    status = rtems_task_start( Task_id[ index ], Tasks_Periodic, index );
     53    directive_failed( status, "rtems_task_start loop" );
     54  }
     55
     56  for ( index = NUM_PERIODIC_TASKS+1 ; index <= NUM_TASKS ; index++ ) {
     57    status = rtems_task_start( Task_id[ index ], Tasks_Aperiodic, index );
     58    directive_failed( status, "rtems_task_start loop" );
     59  }
     60
     61  status = rtems_task_delete( RTEMS_SELF );
     62  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     63}
  • new file testsuites/sptests/spcbssched03/spcbssched03.doc

    diff --git a/testsuites/sptests/spcbssched03/spcbssched03.doc b/testsuites/sptests/spcbssched03/spcbssched03.doc
    new file mode 100644
    index 0000000..6778148
    - +  
     1#
     2#  $Id$
     3#
     4#  COPYRIGHT (c) 1989-1999.
     5#  On-Line Applications Research Corporation (OAR).
     6#
     7#  The license and distribution terms for this file may be
     8#  found in the file LICENSE in this distribution or at
     9#  http://www.rtems.com/license/LICENSE.
     10#
     11
     12
     13This file describes the directives and concepts tested by this test set.
     14
     15test set name:  spcbssched03
     16
     17directives:
     18
     19
     20concepts:
     21
     22  a.  Verifies CBS Scheduling behavior.
  • new file testsuites/sptests/spcbssched03/spcbssched03.scn

    diff --git a/testsuites/sptests/spcbssched03/spcbssched03.scn b/testsuites/sptests/spcbssched03/spcbssched03.scn
    new file mode 100644
    index 0000000..63b79d1
    - +  
     1*** TEST CBS SCHEDULER 3 ***
     2PT1 - rtems_rate_monotonic_create id = 0x42010001
     3PT1 - rtems_rate_monotonic_ident id = 0x42010001
     4PT1 - (0x42010001) period 30
     5PT2 - rtems_rate_monotonic_create id = 0x42010002
     6PT2 - rtems_rate_monotonic_ident id = 0x42010002
     7PT2 - (0x42010002) period 40
     8PT3 - rtems_rate_monotonic_create id = 0x42010003
     9PT3 - rtems_rate_monotonic_ident id = 0x42010003
     10PT3 - (0x42010003) period 50
     11PT4 - rtems_rate_monotonic_create id = 0x42010004
     12PT4 - rtems_rate_monotonic_ident id = 0x42010004
     13PT4 - (0x42010004) period 70
     14AT5 AT6 P1-S ticks:2
     15P1-F ticks:12
     16P2-S ticks:12
     17P2-F ticks:22
     18P3-S ticks:22
     19P1-S ticks:32
     20P1-F ticks:42
     21P3-F ticks:42
     22P4-S ticks:42
     23P2-S ticks:52
     24P2-F ticks:62
     25P1-S ticks:62
     26P1-F ticks:72
     27P4-F ticks:72
     28P3-S ticks:72
     29P3-F ticks:82
     30AT6-S ticks:82
     31P6-F ticks:87
     32Killing task 6
     33AT5-S ticks:87
     34P1-S ticks:92
     35P1-F ticks:102
     36P2-S ticks:102
     37P2-F ticks:112
     38P4-S ticks:112
     39P1-S ticks:122
     40P1-F ticks:132
     41P3-S ticks:132
     42P3-F ticks:142
     43P2-S ticks:142
     44P2-F ticks:152
     45P4-F ticks:152
     46P1-S ticks:152
     47P1-F ticks:162
     48P2-S ticks:172
     49P2-F ticks:182
     50P1-S ticks:182
     51P1-F ticks:192
     52P3-S ticks:192
     53P3-F ticks:202
     54P4-S ticks:202
     55P1-S ticks:212
     56P1-F ticks:222
     57P4-F ticks:222
     58P2-S ticks:222
     59P2-F ticks:232
     60P3-S ticks:232
     61P3-F ticks:242
     62P1-S ticks:242
     63P1-F ticks:252
     64P2-S ticks:252
     65P2-F ticks:262
     66P4-S ticks:262
     67P1-S ticks:272
     68P1-F ticks:282
     69P3-S ticks:283
     70P3-F ticks:293
     71P2-S ticks:293
     72P2-F ticks:303
     73P1-S ticks:303
     74P1-F ticks:313
     75Signal overrun, fixing the task
     76P4-F ticks:313
     77P5-F ticks:313
     78Killing task 5
     79P3-S ticks:322
     80P1-S ticks:332
     81P1-F ticks:342
     82P3-F ticks:342
     83P2-S ticks:342
     84P2-F ticks:352
     85P4-S ticks:352
     86P4-F ticks:362
     87P1-S ticks:362
     88P1-F ticks:372
     89P2-S ticks:372
     90P2-F ticks:382
     91P3-S ticks:382
     92P1-S ticks:392
     93P1-F ticks:402
     94P4-S ticks:402
     95P2-S ticks:412
     96P2-F ticks:422
     97P1-S ticks:422
     98P1-F ticks:432
     99P4-F ticks:432
     100P3-F ticks:432
     101P1-S ticks:452
     102P1-F ticks:462
     103P2-S ticks:462
     104P2-F ticks:472
     105P4-S ticks:472
     106P1-S ticks:482
     107P1-F ticks:492
     108P4-F ticks:492
     109P2-S ticks:492
     110P2-F ticks:502
     111P3-S ticks:502
     112P1-S ticks:512
     113P1-F ticks:522
     114P3-F ticks:522
     115P2-S ticks:532
     116P4-S ticks:532
     117P1-S ticks:542
     118P1-F ticks:552
     119P4-F ticks:552
     120P2-F ticks:552
     121P1-S ticks:572
     122P1-F ticks:582
     123P2-S ticks:582
     124P3-S ticks:582
     125P1-S ticks:602
     126P1-F ticks:612
     127P3-F ticks:612
     128P4-S ticks:612
     129P4-F ticks:622
     130P2-F ticks:622
     131P2 - Deadline miss
     132P2-S ticks:622
     133P1-S ticks:632
     134P1-F ticks:642
     135P2-F ticks:642
     136P1-S ticks:662
     137P1-F ticks:672
     138P2-S ticks:672
     139P4-S ticks:672
     140P4-F ticks:682
     141P3-S ticks:682
     142P1-S ticks:692
     143P1-F ticks:702
     144P3-F ticks:702
     145P2-F ticks:702
     146P2 - Deadline miss
     147P2-S ticks:702
     148P2-F ticks:712
     149P1-S ticks:722
     150P1-F ticks:732
     151P2-S ticks:742
     152P4-S ticks:742
     153P1-S ticks:752
     154P1-F ticks:762
     155P4-F ticks:762
     156P2-F ticks:762
     157P3-S ticks:772
     158P1-S ticks:782
     159P1-F ticks:792
     160P2-S ticks:792
     161P3-F ticks:792
     162P2-F ticks:802
     163P1-S ticks:812
     164P1-F ticks:822
     165P2-S ticks:822
     166P4-S ticks:822
     167P4-F ticks:832
     168P2-F ticks:832
     169P1-S ticks:842
     170*** END OF TEST CBS SCHEDULER 3 ***
  • new file testsuites/sptests/spcbssched03/system.h

    diff --git a/testsuites/sptests/spcbssched03/system.h b/testsuites/sptests/spcbssched03/system.h
    new file mode 100644
    index 0000000..0fccc81
    - +  
     1/*  system.h
     2 *
     3 *  This include file contains information that is included in every
     4 *  function in the test set.
     5 *
     6 *  COPYRIGHT (c) 1989-1999.
     7 *  On-Line Applications Research Corporation (OAR).
     8 *
     9 *  The license and distribution terms for this file may be
     10 *  found in the file LICENSE in this distribution or at
     11 *  http://www.rtems.com/license/LICENSE.
     12 *
     13 *  $Id$
     14 */
     15
     16#include <tmacros.h>
     17
     18/* functions */
     19
     20rtems_task Init(
     21  rtems_task_argument argument
     22);
     23
     24rtems_task Tasks_Periodic(
     25  rtems_task_argument argument
     26);
     27
     28rtems_task Tasks_Aperiodic(
     29  rtems_task_argument argument
     30);
     31
     32/* configuration information */
     33
     34#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     35#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
     36
     37#define CONFIGURE_MICROSECONDS_PER_TICK 100000
     38
     39#define CONFIGURE_MAXIMUM_TASKS               7
     40#define CONFIGURE_MAXIMUM_PERIODS             10
     41
     42#define CONFIGURE_INIT_TASK_PRIORITY          100
     43#define CONFIGURE_INIT_TASK_INITIAL_MODES     RTEMS_DEFAULT_MODES
     44#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
     45
     46#define CONFIGURE_EXTRA_TASK_STACKS         (6 * 4 * RTEMS_MINIMUM_STACK_SIZE)
     47
     48#define CONFIGURE_SCHEDULER_CBS
     49
     50#include <rtems/confdefs.h>
     51
     52#include <rtems/rtems/clock.h>
     53#include <rtems/score/isr.h>
     54#include <rtems/rtems/intr.h>
     55#include <rtems/cbs.h>
     56
     57#define  JOBS_PER_HP              (389)
     58#define  HP_LENGTH                (420)
     59#define  NUM_PERIODIC_TASKS       (4)
     60#define  NUM_APERIODIC_TASKS      (2)
     61#define  NUM_TASKS                ( NUM_PERIODIC_TASKS + NUM_APERIODIC_TASKS )
     62
     63/* global variables */
     64
     65TEST_EXTERN rtems_id   Task_id[ 1+NUM_TASKS ];     /* array of task ids */
     66TEST_EXTERN rtems_name Task_name[ 1+NUM_TASKS ];   /* array of task names */
     67extern rtems_task_priority Priorities[ 1+NUM_TASKS ];
     68extern uint32_t  Periods[ 1 + NUM_PERIODIC_TASKS ];
     69extern uint32_t  Phases[1 + NUM_TASKS];
     70extern uint32_t  Execution[1 + NUM_TASKS];
     71bool Violating_task[1 + NUM_PERIODIC_TASKS];
     72
     73/* end of include file */
  • new file testsuites/sptests/spcbssched03/tasks_aperiodic.c

    diff --git a/testsuites/sptests/spcbssched03/tasks_aperiodic.c b/testsuites/sptests/spcbssched03/tasks_aperiodic.c
    new file mode 100644
    index 0000000..f8c3027
    - +  
     1/*  Tasks_Aperiodic
     2 *
     3 *  This routine serves as a test task for the CBS scheduler
     4 *  implementation. This is for aperiodic task execution.
     5 *
     6 *  Input parameters:
     7 *    argument - task argument
     8 *
     9 *  Output parameters:  NONE
     10 *
     11 *  The license and distribution terms for this file may be
     12 *  found in the file LICENSE in this distribution or at
     13 *  http://www.rtems.com/license/LICENSE.
     14 *
     15 *  $Id$
     16 */
     17
     18#include "system.h"
     19
     20rtems_task Tasks_Aperiodic(
     21  rtems_task_argument argument
     22)
     23{
     24  rtems_status_code status;
     25  int start, stop, now;
     26
     27  put_name( Task_name[ argument ], FALSE );
     28
     29  status = rtems_task_wake_after( 2 + Phases[argument] );
     30  directive_failed( status, "rtems_task_wake_after" );
     31
     32  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
     33  printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start);
     34  /* active computing */
     35
     36  while(FOREVER) {
     37    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
     38    if (now >= start + Execution[argument]) break;
     39  }
     40  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
     41  printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
     42
     43  /* delete SELF */
     44  fflush(stdout);
     45  printf( "Killing task %" PRIdPTR "\n", argument);
     46  status = rtems_task_delete(RTEMS_SELF);
     47  directive_failed(status, "rtems_task_delete of RTEMS_SELF");
     48}
  • new file testsuites/sptests/spcbssched03/tasks_periodic.c

    diff --git a/testsuites/sptests/spcbssched03/tasks_periodic.c b/testsuites/sptests/spcbssched03/tasks_periodic.c
    new file mode 100644
    index 0000000..0fa6df0
    - +  
     1/*  Tasks_Periodic
     2 *
     3 *  This routine serves as a test task for the CBS scheduler
     4 *  implementation.
     5 *
     6 *  Input parameters:
     7 *    argument - task argument
     8 *
     9 *  Output parameters:  NONE
     10 *
     11 *  The license and distribution terms for this file may be
     12 *  found in the file LICENSE in this distribution or at
     13 *  http://www.rtems.com/license/LICENSE.
     14 *
     15 *  $Id$
     16 */
     17
     18#include "system.h"
     19
     20void overrun_handler_task_4 (
     21  rtems_cbs_server_id server_id
     22)
     23{
     24  printk( "Signal overrun, fixing the task\n" );
     25  Violating_task[ 4 ] = 0;
     26  /* rtems_task_restart( RTEMS_SELF, 4 ); might be also possible*/
     27  return;
     28}
     29
     30rtems_task Tasks_Periodic(
     31  rtems_task_argument argument
     32)
     33{
     34  rtems_id          rmid;
     35  rtems_id          test_rmid;
     36  rtems_status_code status;
     37  bool              scenario_done = 0;
     38
     39  int start, stop, now;
     40
     41  rtems_cbs_server_id server_id, tsid;
     42  rtems_cbs_parameters params, tparams;
     43
     44  params.deadline = Periods[ argument ];
     45  params.budget = Execution[ argument ]+1;
     46
     47  if ( argument == 4 ) {
     48    if ( rtems_cbs_create_server( &params, &overrun_handler_task_4, &server_id ))
     49      printf( "ERROR: CREATE SERVER FAILED\n" );
     50  }
     51  else {
     52    if ( rtems_cbs_create_server( &params, NULL, &server_id ) )
     53      printf( "ERROR: CREATE SERVER FAILED\n" );
     54  }
     55  if ( rtems_cbs_attach_thread( server_id, Task_id[ argument ] ) )
     56    printf( "ERROR: ATTACH THREAD FAILED\n" );
     57  if ( rtems_cbs_get_server_id( Task_id[ argument ], &tsid ) )
     58    printf( "ERROR: GET SERVER ID FAILED\n" );
     59  if ( tsid != server_id )
     60    printf( "ERROR: SERVER ID MISMATCH\n" );
     61  if ( rtems_cbs_get_parameters( server_id, &tparams ) )
     62    printf( "ERROR: GET PARAMETERS FAILED\n" );
     63  if ( params.deadline != tparams.deadline ||
     64       params.budget != tparams.budget )
     65    printf( "ERROR: PARAMETERS MISMATCH\n" );
     66
     67  status = rtems_rate_monotonic_create( argument, &rmid );
     68  directive_failed( status, "rtems_rate_monotonic_create" );
     69  put_name( Task_name[ argument ], FALSE );
     70  printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
     71          rmid );
     72
     73  status = rtems_rate_monotonic_ident( argument, &test_rmid );
     74  directive_failed( status, "rtems_rate_monotonic_ident" );
     75  put_name( Task_name[ argument ], FALSE );
     76  printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
     77          test_rmid );
     78
     79  if ( rmid != test_rmid ) {
     80     printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%"
     81             PRIxrtems_id ")\n", rmid, test_rmid );
     82     rtems_test_exit( 0 );
     83  }
     84
     85  put_name( Task_name[ argument ], FALSE );
     86  printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
     87          rmid, Periods[ argument ] );
     88
     89  status = rtems_task_wake_after( 2 + Phases[argument] );
     90  directive_failed( status, "rtems_task_wake_after" );
     91
     92  while (FOREVER) {
     93    if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT)
     94      printf("P%" PRIdPTR " - Deadline miss\n", argument);
     95
     96    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
     97    printf("P%" PRIdPTR "-S ticks:%d\n", argument, start);
     98    if ( start >= 2*HP_LENGTH ) break; /* stop */
     99
     100    /* Specific scenario for task 4: tries to exceed announced budget,
     101       the task priority has to be pulled down to background. */
     102    if ( !scenario_done && argument == 4 && now >= 200 ) {
     103      Violating_task[ argument ] = 1;
     104      scenario_done = 1;
     105    }
     106    /* Specific scenario for task 3: changes scheduling parameters. */
     107    if ( !scenario_done && argument == 3 && now >= 250 ) {
     108      Periods[ argument ]   = Periods[ argument ] * 2;
     109      Execution[ argument ] = Execution[ argument ] * 2;
     110      params.deadline = Periods[ argument ];
     111      params.budget   = Execution[ argument ]+1;
     112      if ( rtems_cbs_set_parameters( server_id, &params) )
     113        printf( "ERROR: SET PARAMETERS FAILED\n" );
     114      if ( rtems_cbs_get_parameters( server_id, &tparams ) )
     115        printf( "ERROR: GET PARAMETERS FAILED\n" );
     116      if ( params.deadline != tparams.deadline ||
     117           params.budget != tparams.budget )
     118        printf( "ERROR: PARAMETERS MISMATCH\n" );
     119      scenario_done = 1;
     120    }
     121    /* Specific scenario for task 2: late unblock after being blocked by
     122       itself, the task priority has to be pulled down to background. */
     123    if ( !scenario_done && argument == 2 && now >= 500 ) {
     124      Violating_task[ argument ] = 1;
     125      scenario_done = 1;
     126    }
     127    if (argument == 2 && Violating_task[ argument ])
     128      rtems_task_wake_after( 10 );
     129
     130    /* active computing */
     131    while(FOREVER) {
     132      rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
     133      if ( argument == 4 && !Violating_task[ argument ] &&
     134          (now >= start + Execution[argument]))
     135        break;
     136      if ( argument != 4 && (now >= start + Execution[argument]) )
     137        break;
     138    }
     139    rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
     140    printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
     141  }
     142
     143  /* delete period and SELF */
     144  status = rtems_rate_monotonic_delete( rmid );
     145  if ( status != RTEMS_SUCCESSFUL ) {
     146    printf("rtems_rate_monotonic_delete failed with status of %d.\n",status);
     147    rtems_test_exit( 0 );
     148  }
     149  if ( rtems_cbs_cleanup() )
     150    printf( "ERROR: CBS CLEANUP\n" );
     151  fflush(stdout);
     152  puts( "*** END OF TEST CBS SCHEDULER 3 ***" );
     153  rtems_test_exit( 0 );
     154}