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) |
---|
-
testsuites/sptests/Makefile.am
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 8fcfd6d..c710576 100644
a b SUBDIRS = \ 30 30 spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \ 31 31 spintrcritical17 spmkdir spmountmgr01 spheapprot \ 32 32 spsimplesched01 spsimplesched02 spsimplesched03 spnsext01 \ 33 spedfsched01 spedfsched02 spedfsched03 33 spedfsched01 spedfsched02 spedfsched03 \ 34 spcbssched01 spcbssched02 spcbssched03 34 35 35 36 include $(top_srcdir)/../automake/subdirs.am 36 37 include $(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 103 103 sp75/Makefile 104 104 sp76/Makefile 105 105 spassoc01/Makefile 106 spcbssched01/Makefile 107 spcbssched02/Makefile 108 spcbssched03/Makefile 106 109 spchain/Makefile 107 110 spclockget/Makefile 108 111 spcoverage/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 5 MANAGERS = io semaphore clock 6 7 rtems_tests_PROGRAMS = spcbssched01 8 spcbssched01_SOURCES = init.c task1.c system.h 9 10 dist_rtems_tests_DATA = spcbssched01.scn 11 dist_rtems_tests_DATA += spcbssched01.doc 12 13 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 14 include $(top_srcdir)/../automake/compile.am 15 include $(top_srcdir)/../automake/leaf.am 16 17 spcbssched01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 18 19 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 20 21 LINK_OBJS = $(spcbssched01_OBJECTS) $(spcbssched01_LDADD) 22 LINK_LIBS = $(spcbssched01_LDLIBS) 23 24 spcbssched01$(EXEEXT): $(spcbssched01_OBJECTS) $(spcbssched01_DEPENDENCIES) 25 @rm -f spcbssched01$(EXEEXT) 26 $(make-exe) 27 28 include $(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 27 rtems_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 12 This file describes the directives and concepts tested by this test set. 13 14 test set name: spcbssched01 15 16 directives: 17 ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, 18 tm_set, tm_get, tm_wkafter 19 20 concepts: 21 22 This 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 45 output: 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 *** 2 TA1 - rtems_clock_get_tod - 09:00:00 12/31/1988 3 TA2 - rtems_clock_get_tod - 09:00:00 12/31/1988 4 TA3 - rtems_clock_get_tod - 09:00:00 12/31/1988 5 TA1 - rtems_clock_get_tod - 09:00:05 12/31/1988 6 TA1 - rtems_clock_get_tod - 09:00:10 12/31/1988 7 TA2 - rtems_clock_get_tod - 09:00:10 12/31/1988 8 TA1 - rtems_clock_get_tod - 09:00:15 12/31/1988 9 TA3 - rtems_clock_get_tod - 09:00:15 12/31/1988 10 TA1 - rtems_clock_get_tod - 09:00:20 12/31/1988 11 TA2 - rtems_clock_get_tod - 09:00:20 12/31/1988 12 TA1 - rtems_clock_get_tod - 09:00:25 12/31/1988 13 TA1 - rtems_clock_get_tod - 09:00:30 12/31/1988 14 TA3 - rtems_clock_get_tod - 09:00:30 12/31/1988 15 TA2 - 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 20 rtems_task Init( 21 rtems_task_argument argument 22 ); 23 24 rtems_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 44 TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ 45 TEST_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 23 rtems_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 5 MANAGERS = io rate_monotonic semaphore clock 6 7 rtems_tests_PROGRAMS = spcbssched02 8 spcbssched02_SOURCES = init.c task_periodic.c system.h 9 10 dist_rtems_tests_DATA = spcbssched02.scn 11 dist_rtems_tests_DATA += spcbssched02.doc 12 13 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 14 include $(top_srcdir)/../automake/compile.am 15 include $(top_srcdir)/../automake/leaf.am 16 17 spcbssched02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 18 19 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 20 21 LINK_OBJS = $(spcbssched02_OBJECTS) $(spcbssched02_LDADD) 22 LINK_LIBS = $(spcbssched02_LDLIBS) 23 24 spcbssched02$(EXEEXT): $(spcbssched02_OBJECTS) $(spcbssched02_DEPENDENCIES) 25 @rm -f spcbssched02$(EXEEXT) 26 $(make-exe) 27 28 include $(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 24 rtems_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( ¶ms1, NULL, &server_id ) != 76 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 77 printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); 78 if ( rtems_cbs_create_server( ¶ms2, NULL, &server_id ) != 79 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 80 printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); 81 if ( rtems_cbs_create_server( ¶ms3, NULL, &server_id ) != 82 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 83 printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); 84 if ( rtems_cbs_create_server( ¶ms4, NULL, &server_id ) != 85 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 86 printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); 87 if ( rtems_cbs_create_server( ¶ms, NULL, &server_id2 ) ) 88 printf( "ERROR: CREATE SERVER FAILED\n" ); 89 if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) 90 printf( "ERROR: CREATE SERVER FAILED\n" ); 91 if ( rtems_cbs_create_server( ¶ms, 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, ¶ms ) != 138 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 139 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 140 if ( rtems_cbs_set_parameters( 5, ¶ms ) != 141 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 142 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 143 if ( rtems_cbs_set_parameters( server_id, ¶ms ) != 144 SCHEDULER_CBS_ERROR_NOSERVER ) 145 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 146 147 if ( rtems_cbs_get_parameters( -5, ¶ms ) != 148 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 149 printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); 150 if ( rtems_cbs_get_parameters( 5, ¶ms ) != 151 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 152 printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); 153 if ( rtems_cbs_get_parameters( server_id, ¶ms ) != 154 SCHEDULER_CBS_ERROR_NOSERVER ) 155 printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); 156 157 if ( rtems_cbs_set_parameters( server_id, ¶ms1 ) != 158 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 159 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 160 if ( rtems_cbs_set_parameters( server_id, ¶ms2 ) != 161 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 162 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 163 if ( rtems_cbs_set_parameters( server_id, ¶ms3 ) != 164 SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) 165 printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); 166 if ( rtems_cbs_set_parameters( server_id, ¶ms4 ) != 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 13 This file describes the directives and concepts tested by this test set. 14 15 test set name: spcbssched02 16 17 directives: 18 19 20 concepts: 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 *** 2 Init: Initializing the CBS 3 Init: Create server and Destroy server 4 Init: Attach thread 5 Init: Detach thread 6 Init: Set parameters and Get parameters 7 Init: Get server id 8 Init: Get approved budget 9 Init: Get remaining budget 10 Init: Get execution time 11 Init: Cleaning up CBS 12 Init: Initializing the CBS 13 Init: Starting periodic task 14 Periodic task: Create server and Attach thread 15 Periodic task: ID and Get parameters 16 Periodic task: Detach thread and Destroy server 17 Periodic task: Remaining budget and Execution time 18 Periodic task: Set parameters 19 Periodic task: Approved budget 20 Periodic task: Starting periodic behavior 21 P1-S ticks:1 22 P1-F ticks:11 23 P1-S ticks:31 24 P1-F ticks:41 25 P1-S ticks:61 26 P1-F ticks:71 27 P1-S ticks:91 28 P1-F ticks:101 29 P1-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 20 rtems_task Init( 21 rtems_task_argument argument 22 ); 23 24 rtems_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 55 rtems_id Task_id; 56 rtems_name Task_name; 57 rtems_task_priority Priority; 58 time_t Period; 59 time_t Execution; 60 time_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 20 rtems_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( ¶ms, 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( ¶ms, 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, ¶ms ) ) 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, ¶ms ) ) 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 5 MANAGERS = io rate_monotonic semaphore clock 6 7 rtems_tests_PROGRAMS = spcbssched03 8 spcbssched03_SOURCES = init.c tasks_periodic.c tasks_aperiodic.c system.h cbsparams.h 9 10 dist_rtems_tests_DATA = spcbssched03.scn 11 dist_rtems_tests_DATA += spcbssched03.doc 12 13 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 14 include $(top_srcdir)/../automake/compile.am 15 include $(top_srcdir)/../automake/leaf.am 16 17 spcbssched03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 18 19 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 20 21 LINK_OBJS = $(spcbssched03_OBJECTS) $(spcbssched03_LDADD) 22 LINK_LIBS = $(spcbssched03_LDLIBS) 23 24 spcbssched03$(EXEEXT): $(spcbssched03_OBJECTS) $(spcbssched03_DEPENDENCIES) 25 @rm -f spcbssched03$(EXEEXT) 26 $(make-exe) 27 28 include $(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 25 rtems_task_priority Priorities[1+NUM_TASKS]= { 0, 30, 40, 50, 70, 254, 254 }; 26 27 uint32_t Periods[1+NUM_PERIODIC_TASKS] = { 0, 30, 40, 50, 70 }; 28 29 uint32_t Execution[1+NUM_TASKS] = { 0, 10, 10, 10, 10, 100, 5 }; 30 31 uint32_t Phases[1+NUM_TASKS] = { 0, 0, 0, 0, 0, 7, 4 }; 32 33 #define build_task_name() do { \ 34 Task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );\ 35 Task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );\ 36 Task_name[ 3 ] = rtems_build_name( 'P', 'T', '3', ' ' );\ 37 Task_name[ 4 ] = rtems_build_name( 'P', 'T', '4', ' ' );\ 38 Task_name[ 5 ] = rtems_build_name( 'A', 'T', '5', ' ' );\ 39 Task_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 26 rtems_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 13 This file describes the directives and concepts tested by this test set. 14 15 test set name: spcbssched03 16 17 directives: 18 19 20 concepts: 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 *** 2 PT1 - rtems_rate_monotonic_create id = 0x42010001 3 PT1 - rtems_rate_monotonic_ident id = 0x42010001 4 PT1 - (0x42010001) period 30 5 PT2 - rtems_rate_monotonic_create id = 0x42010002 6 PT2 - rtems_rate_monotonic_ident id = 0x42010002 7 PT2 - (0x42010002) period 40 8 PT3 - rtems_rate_monotonic_create id = 0x42010003 9 PT3 - rtems_rate_monotonic_ident id = 0x42010003 10 PT3 - (0x42010003) period 50 11 PT4 - rtems_rate_monotonic_create id = 0x42010004 12 PT4 - rtems_rate_monotonic_ident id = 0x42010004 13 PT4 - (0x42010004) period 70 14 AT5 AT6 P1-S ticks:2 15 P1-F ticks:12 16 P2-S ticks:12 17 P2-F ticks:22 18 P3-S ticks:22 19 P1-S ticks:32 20 P1-F ticks:42 21 P3-F ticks:42 22 P4-S ticks:42 23 P2-S ticks:52 24 P2-F ticks:62 25 P1-S ticks:62 26 P1-F ticks:72 27 P4-F ticks:72 28 P3-S ticks:72 29 P3-F ticks:82 30 AT6-S ticks:82 31 P6-F ticks:87 32 Killing task 6 33 AT5-S ticks:87 34 P1-S ticks:92 35 P1-F ticks:102 36 P2-S ticks:102 37 P2-F ticks:112 38 P4-S ticks:112 39 P1-S ticks:122 40 P1-F ticks:132 41 P3-S ticks:132 42 P3-F ticks:142 43 P2-S ticks:142 44 P2-F ticks:152 45 P4-F ticks:152 46 P1-S ticks:152 47 P1-F ticks:162 48 P2-S ticks:172 49 P2-F ticks:182 50 P1-S ticks:182 51 P1-F ticks:192 52 P3-S ticks:192 53 P3-F ticks:202 54 P4-S ticks:202 55 P1-S ticks:212 56 P1-F ticks:222 57 P4-F ticks:222 58 P2-S ticks:222 59 P2-F ticks:232 60 P3-S ticks:232 61 P3-F ticks:242 62 P1-S ticks:242 63 P1-F ticks:252 64 P2-S ticks:252 65 P2-F ticks:262 66 P4-S ticks:262 67 P1-S ticks:272 68 P1-F ticks:282 69 P3-S ticks:283 70 P3-F ticks:293 71 P2-S ticks:293 72 P2-F ticks:303 73 P1-S ticks:303 74 P1-F ticks:313 75 Signal overrun, fixing the task 76 P4-F ticks:313 77 P5-F ticks:313 78 Killing task 5 79 P3-S ticks:322 80 P1-S ticks:332 81 P1-F ticks:342 82 P3-F ticks:342 83 P2-S ticks:342 84 P2-F ticks:352 85 P4-S ticks:352 86 P4-F ticks:362 87 P1-S ticks:362 88 P1-F ticks:372 89 P2-S ticks:372 90 P2-F ticks:382 91 P3-S ticks:382 92 P1-S ticks:392 93 P1-F ticks:402 94 P4-S ticks:402 95 P2-S ticks:412 96 P2-F ticks:422 97 P1-S ticks:422 98 P1-F ticks:432 99 P4-F ticks:432 100 P3-F ticks:432 101 P1-S ticks:452 102 P1-F ticks:462 103 P2-S ticks:462 104 P2-F ticks:472 105 P4-S ticks:472 106 P1-S ticks:482 107 P1-F ticks:492 108 P4-F ticks:492 109 P2-S ticks:492 110 P2-F ticks:502 111 P3-S ticks:502 112 P1-S ticks:512 113 P1-F ticks:522 114 P3-F ticks:522 115 P2-S ticks:532 116 P4-S ticks:532 117 P1-S ticks:542 118 P1-F ticks:552 119 P4-F ticks:552 120 P2-F ticks:552 121 P1-S ticks:572 122 P1-F ticks:582 123 P2-S ticks:582 124 P3-S ticks:582 125 P1-S ticks:602 126 P1-F ticks:612 127 P3-F ticks:612 128 P4-S ticks:612 129 P4-F ticks:622 130 P2-F ticks:622 131 P2 - Deadline miss 132 P2-S ticks:622 133 P1-S ticks:632 134 P1-F ticks:642 135 P2-F ticks:642 136 P1-S ticks:662 137 P1-F ticks:672 138 P2-S ticks:672 139 P4-S ticks:672 140 P4-F ticks:682 141 P3-S ticks:682 142 P1-S ticks:692 143 P1-F ticks:702 144 P3-F ticks:702 145 P2-F ticks:702 146 P2 - Deadline miss 147 P2-S ticks:702 148 P2-F ticks:712 149 P1-S ticks:722 150 P1-F ticks:732 151 P2-S ticks:742 152 P4-S ticks:742 153 P1-S ticks:752 154 P1-F ticks:762 155 P4-F ticks:762 156 P2-F ticks:762 157 P3-S ticks:772 158 P1-S ticks:782 159 P1-F ticks:792 160 P2-S ticks:792 161 P3-F ticks:792 162 P2-F ticks:802 163 P1-S ticks:812 164 P1-F ticks:822 165 P2-S ticks:822 166 P4-S ticks:822 167 P4-F ticks:832 168 P2-F ticks:832 169 P1-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 20 rtems_task Init( 21 rtems_task_argument argument 22 ); 23 24 rtems_task Tasks_Periodic( 25 rtems_task_argument argument 26 ); 27 28 rtems_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 65 TEST_EXTERN rtems_id Task_id[ 1+NUM_TASKS ]; /* array of task ids */ 66 TEST_EXTERN rtems_name Task_name[ 1+NUM_TASKS ]; /* array of task names */ 67 extern rtems_task_priority Priorities[ 1+NUM_TASKS ]; 68 extern uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ]; 69 extern uint32_t Phases[1 + NUM_TASKS]; 70 extern uint32_t Execution[1 + NUM_TASKS]; 71 bool 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 20 rtems_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 20 void 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 30 rtems_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( ¶ms, &overrun_handler_task_4, &server_id )) 49 printf( "ERROR: CREATE SERVER FAILED\n" ); 50 } 51 else { 52 if ( rtems_cbs_create_server( ¶ms, 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, ¶ms) ) 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 }