diff options
author | Bjorn Larsson <bjornlarsson@oarcorp.com> | 2014-03-25 09:13:03 -0500 |
---|---|---|
committer | Jennifer Averett <jennifer.averett@oarcorp.com> | 2014-03-28 12:32:10 -0500 |
commit | 9c88bc6e80fd40115fdf7ede3cef50264d656ee6 (patch) | |
tree | a898abae52506e6f3b6ca0b5d7059043593f811b /testsuites/sptests/spratemon_err01 | |
parent | samples/base_mp: Include missing header file (diff) | |
download | rtems-9c88bc6e80fd40115fdf7ede3cef50264d656ee6.tar.bz2 |
spratemon_err01: New test split from sp09.
Diffstat (limited to 'testsuites/sptests/spratemon_err01')
-rw-r--r-- | testsuites/sptests/spratemon_err01/Makefile.am | 23 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/init.c | 42 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/screen10.c | 222 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/spratemon_err01.doc | 25 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/spratemon_err01.scn | 28 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/system.h | 75 | ||||
-rw-r--r-- | testsuites/sptests/spratemon_err01/task4.c | 51 |
7 files changed, 466 insertions, 0 deletions
diff --git a/testsuites/sptests/spratemon_err01/Makefile.am b/testsuites/sptests/spratemon_err01/Makefile.am new file mode 100644 index 0000000000..e068243d2d --- /dev/null +++ b/testsuites/sptests/spratemon_err01/Makefile.am @@ -0,0 +1,23 @@ + +rtems_tests_PROGRAMS = spratemon_err01 +spratemon_err01_SOURCES = init.c screen10.c \ + task4.c system.h + +dist_rtems_tests_DATA = spratemon_err01.scn +dist_rtems_tests_DATA += spratemon_err01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spratemon_err01_OBJECTS) +LINK_LIBS = $(spratemon_err01_LDLIBS) + +spratemon_err01$(EXEEXT): $(spratemon_err01_OBJECTS) $(spratemon_err01_DEPENDENCIES) + @rm -f spratemon_err01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spratemon_err01/init.c b/testsuites/sptests/spratemon_err01/init.c new file mode 100644 index 0000000000..2243da52f6 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/init.c @@ -0,0 +1,42 @@ +/* + * COPYRIGHT (c) 2014. + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define CONFIGURE_INIT +#include "system.h" + +const char rtems_test_name[] = "SP RATE MONOTONIC ERROR 01"; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + TEST_BEGIN(); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 4 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" ); + + Screen10(); + TEST_END(); +} diff --git a/testsuites/sptests/spratemon_err01/screen10.c b/testsuites/sptests/spratemon_err01/screen10.c new file mode 100644 index 0000000000..d1c18501f6 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/screen10.c @@ -0,0 +1,222 @@ +/* Screen10 + * + * This routine generates error screen 10 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-2009. + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +void Screen10() +{ + rtems_rate_monotonic_period_status period_status; + rtems_status_code status; + + /* + * Check create error cases. + */ + status = rtems_rate_monotonic_create( Period_name[ 1 ], NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_rate_monotonic_create with NULL param" + ); + + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_rate_monotonic_create( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_create with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_create successful" ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_rate_monotonic_create of too many" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" ); + + /* + * Check ident error cases. + */ + status = rtems_rate_monotonic_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_ident with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" ); + + /* + * Check period error cases. + */ + status = rtems_rate_monotonic_period( 100, 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( rtems_build_id( 1, 1, 1, 256 ), 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_rate_monotonic_period status not defined" + ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED" + ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 ); + directive_failed( status, "rtems_rate_monotonic_period successful" ); + puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + directive_failed( status, "rtems_rate_monotonic_period status" ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL" + ); + + while ( FOREVER ) { + + status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS); + + if ( status == RTEMS_TIMEOUT ) break; + + directive_failed( + status, + "rtems_rate_monotonic_period waiting for timeout" + ); + + rtems_task_wake_after( 1 ); + } + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT" + ); + + /* + * Check get_statistics error cases. + */ + status = rtems_rate_monotonic_get_statistics( Period_id[ 1 ], NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_rate_monotonic_get_statistics with NULL param" + ); + puts( "TA1 - rtems_rate_monotonic_get_statistics - RTEMS_INVALID_ADDRESS" ); + + /* + * Check get_status error cases. + */ + status = rtems_rate_monotonic_get_status( Period_id[ 1 ], NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_rate_monotonic_get_status with NULL param" + ); + puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ADDRESS" ); + + status = rtems_rate_monotonic_get_status( 100, &period_status ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_get_status with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ID" ); + + /* + * Check cancel error cases. + */ + status = rtems_rate_monotonic_cancel( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( rtems_build_id( 1, 1, 1, 256 ) ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel will illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_cancel" ); + puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + directive_failed( status, "rtems_rate_monotonic_period restart" ); + + status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_rate_monotonic_period" + ); + puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + puts( "TA1 - yielding to TA4" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + /* + * Check delete error cases. + */ + status = rtems_rate_monotonic_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( rtems_build_id( 1, 1, 1, 256 ) ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_delete" ); + puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" ); +} diff --git a/testsuites/sptests/spratemon_err01/spratemon_err01.doc b/testsuites/sptests/spratemon_err01/spratemon_err01.doc new file mode 100644 index 0000000000..bf1a43cdf8 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/spratemon_err01.doc @@ -0,0 +1,25 @@ +# COPYRIGHT (c) 1989-2014. +# 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: spratemon_err01 + + directives: + rm_create, rm_period, rm_stats, rm_gstatus, rm_cancel, rm_delete + +concepts: + + a. Verifies all error codes returned by the executive in single + processor configurations. + + b. Verifies error conditions in the following kernel routines or macros: + _Ck_date_time, _Expired, _Q_submit, _Get_mnodes, _Get_node, + _Free_mem, _Get_mem, _Valid_block, _Set_tcb, _Set_resource, + _In_range, _On_boundary diff --git a/testsuites/sptests/spratemon_err01/spratemon_err01.scn b/testsuites/sptests/spratemon_err01/spratemon_err01.scn new file mode 100644 index 0000000000..ca2cebd624 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/spratemon_err01.scn @@ -0,0 +1,28 @@ +*** TEST RATE MONOTONIC ERROR 01 *** +TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY +TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_period - RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED +TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT +TA1 - rtems_rate_monotonic_get_statistics - RTEMS_INVALID_ADDRESS +TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ADDRESS +TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT +TA1 - yielding to TA4 +TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_delete - RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL +*** END TEST RATE MONOTONIC ERROR 01 *** diff --git a/testsuites/sptests/spratemon_err01/system.h b/testsuites/sptests/spratemon_err01/system.h new file mode 100644 index 0000000000..52bb580500 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/system.h @@ -0,0 +1,75 @@ +/* + * This include file contains information that is included in every + * function in the test set. + */ + +/* + * COPYRIGHT (c) 1989-2014. + * 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. + */ + +#include <tmacros.h> + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +); + +rtems_task Task_4( + rtems_task_argument argument +); + +void Screen10( void ); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) + +#include <rtems/confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ + +TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ +TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ + +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ + +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ + +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ + +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ + +#define Internal_port_area (void *) 0x00001000 +#define External_port_area (void *) 0x00002000 + +/* end of include file */ diff --git a/testsuites/sptests/spratemon_err01/task4.c b/testsuites/sptests/spratemon_err01/task4.c new file mode 100644 index 0000000000..73a52ea8a9 --- /dev/null +++ b/testsuites/sptests/spratemon_err01/task4.c @@ -0,0 +1,51 @@ +/* Task_4 + * + * This routine serves as a test task. Its only purpose in life is to + * generate the error where a rate monotonic period is accessed by a + * task other than its creator. + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_cancel not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_period not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + puts( "TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA4" ); +} |