From df367faddb9e927d18859692d1c0bbd613953328 Mon Sep 17 00:00:00 2001 From: Bjorn Larsson Date: Fri, 28 Mar 2014 13:05:57 -0500 Subject: sptests: New tests split from sp09 screen 1 and screen 2. Split sp09 screen 1 into new test sptask_err04. Split sp09 screen 2 into new tests sptask__err02 and spclock_err01, as well as moving one verification into sptimer_err01. --- testsuites/sptests/sptask_err04/Makefile.am | 22 ++ testsuites/sptests/sptask_err04/init.c | 88 +++++++ testsuites/sptests/sptask_err04/sptask_err04.doc | 27 +++ testsuites/sptests/sptask_err04/sptask_err04.scn | 24 ++ testsuites/sptests/sptask_err04/system.h | 45 ++++ testsuites/sptests/sptask_err04/task1.c | 277 +++++++++++++++++++++++ 6 files changed, 483 insertions(+) create mode 100644 testsuites/sptests/sptask_err04/Makefile.am create mode 100644 testsuites/sptests/sptask_err04/init.c create mode 100644 testsuites/sptests/sptask_err04/sptask_err04.doc create mode 100644 testsuites/sptests/sptask_err04/sptask_err04.scn create mode 100644 testsuites/sptests/sptask_err04/system.h create mode 100644 testsuites/sptests/sptask_err04/task1.c (limited to 'testsuites/sptests/sptask_err04') diff --git a/testsuites/sptests/sptask_err04/Makefile.am b/testsuites/sptests/sptask_err04/Makefile.am new file mode 100644 index 0000000000..7c21fc4819 --- /dev/null +++ b/testsuites/sptests/sptask_err04/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = sptask_err04 +sptask_err04_SOURCES = init.c task1.c system.h + +dist_rtems_tests_DATA = sptask_err04.scn +dist_rtems_tests_DATA += sptask_err04.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 = $(sptask_err04_OBJECTS) +LINK_LIBS = $(sptask_err04_LDLIBS) + +sptask_err04$(EXEEXT): $(sptask_err04_OBJECTS) $(sptask_err04_DEPENDENCIES) + @rm -f sptask_err04$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sptask_err04/init.c b/testsuites/sptests/sptask_err04/init.c new file mode 100644 index 0000000000..90cb2e1d5b --- /dev/null +++ b/testsuites/sptests/sptask_err04/init.c @@ -0,0 +1,88 @@ +/* + * 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" + +#include + +const char rtems_test_name[] = "TASK ERROR 04"; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + TEST_BEGIN(); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + /* priority of 0 error */ + status = rtems_task_create( + Task_name[1], + 0, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_create with illegal priority" + ); + puts( "INIT - rtems_task_create - priority of 0 - RTEMS_INVALID_PRIORITY" ); + + /* priority > 255 error */ + status = rtems_task_create( + Task_name[1], + 257, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_create with illegal priority" + ); + puts( + "INIT - rtems_task_create - priority too high - RTEMS_INVALID_PRIORITY" + ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + RTEMS_MINIMUM_STACK_SIZE * 3, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_restart( Task_id[ 1 ], 0 ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_restart of DORMANT task" + ); + puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sptask_err04/sptask_err04.doc b/testsuites/sptests/sptask_err04/sptask_err04.doc new file mode 100644 index 0000000000..3773cb61ec --- /dev/null +++ b/testsuites/sptests/sptask_err04/sptask_err04.doc @@ -0,0 +1,27 @@ +# 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: sptask_err04 + +directives: + t_delete, t_getnote, t_ident, t_restart, t_resume, t_setpriority, + t_mode, t_start, t_suspend, + + +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/sptask_err04/sptask_err04.scn b/testsuites/sptests/sptask_err04/sptask_err04.scn new file mode 100644 index 0000000000..c21cce3620 --- /dev/null +++ b/testsuites/sptests/sptask_err04/sptask_err04.scn @@ -0,0 +1,24 @@ +*** TEST TASK ERROR 04 *** +TA1 - rtems_task_is_suspended - RTEMS_INVALID_ID +TA1 - rtems_task_delete - RTEMS_INVALID_ID +TA1 - rtems_task_get_note - RTEMS_INVALID_ADDRESS +TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_get_note - RTEMS_INVALID_ID +TA1 - rtems_task_get_note - RTEMS_INVALID_ID +TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS +TA1 - rtems_task_ident - global RTEMS_INVALID_NAME +TA1 - rtems_task_ident - local RTEMS_INVALID_NAME +TA1 - rtems_task_ident - RTEMS_INVALID_NODE +TA1 - rtems_task_restart - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE +TA1 - rtems_task_set_priority - RTEMS_INVALID_ADDRESS +TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY +TA1 - rtems_task_set_priority - RTEMS_INVALID_ID +TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_set_note - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INCORRECT_STATE +TA1 - rtems_task_suspend - RTEMS_INVALID_ID +TA1 - rtems_task_mode - RTEMS_INVALID_ADDRESS +*** END TEST TASK DELETE ERROR 04 *** diff --git a/testsuites/sptests/sptask_err04/system.h b/testsuites/sptests/sptask_err04/system.h new file mode 100644 index 0000000000..e6632ff500 --- /dev/null +++ b/testsuites/sptests/sptask_err04/system.h @@ -0,0 +1,45 @@ +/* + * 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 + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 3 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ + +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ + +/* end of include file */ diff --git a/testsuites/sptests/sptask_err04/task1.c b/testsuites/sptests/sptask_err04/task1.c new file mode 100644 index 0000000000..022aff9967 --- /dev/null +++ b/testsuites/sptests/sptask_err04/task1.c @@ -0,0 +1,277 @@ +/* Task_1 + * + * This task generates all possible errors for the RTEMS 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.org/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" +#include + + +rtems_task Task_1( + rtems_task_argument argument +) +{ + uint32_t notepad_value; + rtems_id self_id; + rtems_task_priority previous_priority; + rtems_status_code status; + + /* bad Id */ + status = rtems_task_is_suspended( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_set_priority with illegal id" + ); + puts( "TA1 - rtems_task_is_suspended - RTEMS_INVALID_ID" ); + + /* bad Id */ + status = rtems_task_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_delete with illegal id" + ); + puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" ); + + /* NULL return */ + status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_FIRST, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_task_get_note with NULL param" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ADDRESS" ); + + /* note too high */ + status = rtems_task_get_note( RTEMS_SELF, 100, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_task_get_note with illegal notepad" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" ); + + /* bad Id */ + status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_get_note with illegal id" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); + + /* unused Id so invalid now */ + status = rtems_task_get_note( + _RTEMS_tasks_Information.maximum_id, + RTEMS_NOTEPAD_LAST, + ¬epad_value + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_get_note with illegal id" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); + + status = rtems_task_get_note( + _RTEMS_tasks_Information.minimum_id + (3L<