diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-09-11 20:56:45 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-09-11 20:56:45 +0000 |
commit | 0d6aee4e35fc675f975a679dc1fd58d873d093e1 (patch) | |
tree | 29413772e49aa1f3749be945f3f9e19fe375a0ff /testsuites/sptests/spedfsched01 | |
parent | 2011-09-11 Petr Benes <benesp16@fel.cvut.cz> (diff) | |
download | rtems-0d6aee4e35fc675f975a679dc1fd58d873d093e1.tar.bz2 |
2011-09-11 Petr Benes <benesp16@fel.cvut.cz>
PR 1897/testing
* Makefile.am, configure.ac: Add tests for Earliest Deadline First
(EDF) Scheduling Algorithm implementation.
* spedfsched01/.cvsignore, spedfsched01/Makefile.am,
spedfsched01/init.c, spedfsched01/spedfsched01.doc,
spedfsched01/spedfsched01.scn, spedfsched01/system.h,
spedfsched01/task1.c, spedfsched02/.cvsignore,
spedfsched02/Makefile.am, spedfsched02/getall.c, spedfsched02/init.c,
spedfsched02/spedfsched02.doc, spedfsched02/spedfsched02.scn,
spedfsched02/system.h, spedfsched02/task1.c, spedfsched03/.cvsignore,
spedfsched03/Makefile.am, spedfsched03/edfparams.h,
spedfsched03/init.c, spedfsched03/spedfsched03.doc,
spedfsched03/spedfsched03.scn, spedfsched03/system.h,
spedfsched03/tasks_aperiodic.c, spedfsched03/tasks_periodic.c: New
files.
Diffstat (limited to 'testsuites/sptests/spedfsched01')
-rw-r--r-- | testsuites/sptests/spedfsched01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/init.c | 85 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/spedfsched01.doc | 47 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/spedfsched01.scn | 16 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/system.h | 47 | ||||
-rw-r--r-- | testsuites/sptests/spedfsched01/task1.c | 57 |
7 files changed, 282 insertions, 0 deletions
diff --git a/testsuites/sptests/spedfsched01/.cvsignore b/testsuites/sptests/spedfsched01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spedfsched01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spedfsched01/Makefile.am b/testsuites/sptests/spedfsched01/Makefile.am new file mode 100644 index 0000000000..95f6182ef9 --- /dev/null +++ b/testsuites/sptests/spedfsched01/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = io semaphore clock + +rtems_tests_PROGRAMS = spedfsched01 +spedfsched01_SOURCES = init.c task1.c system.h + +dist_rtems_tests_DATA = spedfsched01.scn +dist_rtems_tests_DATA += spedfsched01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +spedfsched01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spedfsched01_OBJECTS) $(spedfsched01_LDADD) +LINK_LIBS = $(spedfsched01_LDLIBS) + +spedfsched01$(EXEEXT): $(spedfsched01_OBJECTS) $(spedfsched01_DEPENDENCIES) + @rm -f spedfsched01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spedfsched01/init.c b/testsuites/sptests/spedfsched01/init.c new file mode 100644 index 0000000000..d13e61ce74 --- /dev/null +++ b/testsuites/sptests/spedfsched01/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*** EDF 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/spedfsched01/spedfsched01.doc b/testsuites/sptests/spedfsched01/spedfsched01.doc new file mode 100644 index 0000000000..77009a7d87 --- /dev/null +++ b/testsuites/sptests/spedfsched01/spedfsched01.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: spedfsched01 + +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 EDF-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/spedfsched01/spedfsched01.scn b/testsuites/sptests/spedfsched01/spedfsched01.scn new file mode 100644 index 0000000000..63ff9c6d6a --- /dev/null +++ b/testsuites/sptests/spedfsched01/spedfsched01.scn @@ -0,0 +1,16 @@ +*** EDF 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 EDF SCHEDULER TEST 1 *** diff --git a/testsuites/sptests/spedfsched01/system.h b/testsuites/sptests/spedfsched01/system.h new file mode 100644 index 0000000000..43594c420d --- /dev/null +++ b/testsuites/sptests/spedfsched01/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_EDF + +#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/spedfsched01/task1.c b/testsuites/sptests/spedfsched01/task1.c new file mode 100644 index 0000000000..1ac1ce33ce --- /dev/null +++ b/testsuites/sptests/spedfsched01/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 EDF 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" ); + } +} |