diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-09-15 15:56:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-09-15 15:56:01 +0000 |
commit | bd1b8de26546f0e86d76bec2e407a08245560f83 (patch) | |
tree | abf16b06b8fa2a6eb50273f5c62140a57ce787e0 /testsuites/sptests/spcbssched01 | |
parent | 2011-09-15 Petr Benes <benesp16@fel.cvut.cz> (diff) | |
download | rtems-bd1b8de26546f0e86d76bec2e407a08245560f83.tar.bz2 |
2011-09-15 Petr Benes <benesp16@fel.cvut.cz>
PR 1907/testing
* Makefile.am, configure.ac: Add tests for the CBS (Constant Bandwidth
Server) scheduler.
* spcbssched01/.cvsignore, spcbssched01/Makefile.am,
spcbssched01/init.c, spcbssched01/spcbssched01.doc,
spcbssched01/spcbssched01.scn, spcbssched01/system.h,
spcbssched01/task1.c, spcbssched02/.cvsignore,
spcbssched02/Makefile.am, spcbssched02/init.c,
spcbssched02/spcbssched02.doc, spcbssched02/spcbssched02.scn,
spcbssched02/system.h, spcbssched02/task_periodic.c,
spcbssched03/.cvsignore, spcbssched03/Makefile.am,
spcbssched03/cbsparams.h, spcbssched03/init.c,
spcbssched03/spcbssched03.doc, spcbssched03/spcbssched03.scn,
spcbssched03/system.h, spcbssched03/tasks_aperiodic.c,
spcbssched03/tasks_periodic.c: New files.
Diffstat (limited to 'testsuites/sptests/spcbssched01')
-rw-r--r-- | testsuites/sptests/spcbssched01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/init.c | 85 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/spcbssched01.doc | 47 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/spcbssched01.scn | 16 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/system.h | 47 | ||||
-rw-r--r-- | testsuites/sptests/spcbssched01/task1.c | 57 |
7 files changed, 282 insertions, 0 deletions
diff --git a/testsuites/sptests/spcbssched01/.cvsignore b/testsuites/sptests/spcbssched01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spcbssched01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spcbssched01/Makefile.am b/testsuites/sptests/spcbssched01/Makefile.am new file mode 100644 index 0000000000..bc0b3e6587 --- /dev/null +++ b/testsuites/sptests/spcbssched01/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = io semaphore clock + +rtems_tests_PROGRAMS = spcbssched01 +spcbssched01_SOURCES = init.c task1.c system.h + +dist_rtems_tests_DATA = spcbssched01.scn +dist_rtems_tests_DATA += spcbssched01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +spcbssched01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spcbssched01_OBJECTS) $(spcbssched01_LDADD) +LINK_LIBS = $(spcbssched01_LDLIBS) + +spcbssched01$(EXEEXT): $(spcbssched01_OBJECTS) $(spcbssched01_DEPENDENCIES) + @rm -f spcbssched01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spcbssched01/init.c b/testsuites/sptests/spcbssched01/init.c new file mode 100644 index 0000000000..a87e2cf13c --- /dev/null +++ b/testsuites/sptests/spcbssched01/init.c @@ -0,0 +1,85 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** CBS SCHEDULER TEST 1 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_INTERRUPT_LEVEL(31), + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 3, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/spcbssched01/spcbssched01.doc b/testsuites/sptests/spcbssched01/spcbssched01.doc new file mode 100644 index 0000000000..7c5ab0d832 --- /dev/null +++ b/testsuites/sptests/spcbssched01/spcbssched01.doc @@ -0,0 +1,47 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-1999. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This file describes the directives and concepts tested by this test set. + +test set name: spcbssched01 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter + +concepts: + +This test is identical to sp01 but for CBS-based scheduling: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handle a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies implementation of SuperCore TOD_MILLISECONDS_TO_TICKS. Normal + computation in applications is via a macro at the Classic API level. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. diff --git a/testsuites/sptests/spcbssched01/spcbssched01.scn b/testsuites/sptests/spcbssched01/spcbssched01.scn new file mode 100644 index 0000000000..f53dbb5406 --- /dev/null +++ b/testsuites/sptests/spcbssched01/spcbssched01.scn @@ -0,0 +1,16 @@ +*** CBS SCHEDULER TEST 1 *** +TA1 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA3 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:05 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:10 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:10 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:15 12/31/1988 +TA3 - rtems_clock_get_tod - 09:00:15 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:20 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:20 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:25 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:30 12/31/1988 +TA3 - rtems_clock_get_tod - 09:00:30 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:30 12/31/1988 +*** END OF CBS SCHEDULER TEST 1 *** diff --git a/testsuites/sptests/spcbssched01/system.h b/testsuites/sptests/spcbssched01/system.h new file mode 100644 index 0000000000..b42384a0e8 --- /dev/null +++ b/testsuites/sptests/spcbssched01/system.h @@ -0,0 +1,47 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <tmacros.h> + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1_through_3( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_SCHEDULER_CBS + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_MAXIMUM_TASKS 4 + +#include <rtems/confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +/* end of include file */ diff --git a/testsuites/sptests/spcbssched01/task1.c b/testsuites/sptests/spcbssched01/task1.c new file mode 100644 index 0000000000..3d9e1e59c9 --- /dev/null +++ b/testsuites/sptests/spcbssched01/task1.c @@ -0,0 +1,57 @@ +/* Task_1_through_3 + * + * This routine serves as a test task. It verifies the basic task + * switching capabilities of the executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + rtems_interval ticks; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + /* + * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to + * test C implementation in SuperCore -- not macro version used + * everywhere else. + */ + ticks = TOD_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); + + while( FOREVER ) { + status = rtems_clock_get_tod( &time ); + directive_failed( status, "rtems_clock_get_tod" ); + + if ( time.second >= 35 ) { + puts( "*** END OF CBS SCHEDULER TEST 1 ***" ); + rtems_test_exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + + status = rtems_task_wake_after( ticks ); + directive_failed( status, "rtems_task_wake_after" ); + } +} |