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/Makefile.am | 5 +- testsuites/sptests/configure.ac | 4 +- testsuites/sptests/sp09/Makefile.am | 24 -- testsuites/sptests/sp09/delay.c | 29 -- testsuites/sptests/sp09/init.c | 106 ------- testsuites/sptests/sp09/isr.c | 28 -- testsuites/sptests/sp09/screen01.c | 266 ----------------- testsuites/sptests/sp09/screen02.c | 313 --------------------- testsuites/sptests/sp09/sp09.doc | 29 -- testsuites/sptests/sp09/sp09.scn | 59 ---- testsuites/sptests/sp09/system.h | 103 ------- testsuites/sptests/sp09/task1.c | 36 --- testsuites/sptests/sp09/task2.c | 49 ---- testsuites/sptests/sp09/task3.c | 54 ---- testsuites/sptests/spclock_err01/Makefile.am | 22 ++ testsuites/sptests/spclock_err01/delay.c | 29 ++ testsuites/sptests/spclock_err01/init.c | 218 ++++++++++++++ testsuites/sptests/spclock_err01/spclock_err01.doc | 26 ++ testsuites/sptests/spclock_err01/spclock_err01.scn | 23 ++ testsuites/sptests/spclock_err01/system.h | 71 +++++ testsuites/sptests/sptask_err02/Makefile.am | 22 ++ testsuites/sptests/sptask_err02/init.c | 119 ++++++++ testsuites/sptests/sptask_err02/sptask_err02.doc | 25 ++ testsuites/sptests/sptask_err02/sptask_err02.scn | 12 + testsuites/sptests/sptask_err02/system.h | 37 +++ 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 ++++++++++++++++++ testsuites/sptests/sptimer_err01/init.c | 15 + testsuites/sptests/sptimer_err01/sptimer_err01.scn | 2 +- 33 files changed, 1109 insertions(+), 1100 deletions(-) delete mode 100644 testsuites/sptests/sp09/Makefile.am delete mode 100644 testsuites/sptests/sp09/delay.c delete mode 100644 testsuites/sptests/sp09/init.c delete mode 100644 testsuites/sptests/sp09/isr.c delete mode 100644 testsuites/sptests/sp09/screen01.c delete mode 100644 testsuites/sptests/sp09/screen02.c delete mode 100644 testsuites/sptests/sp09/sp09.doc delete mode 100644 testsuites/sptests/sp09/sp09.scn delete mode 100644 testsuites/sptests/sp09/system.h delete mode 100644 testsuites/sptests/sp09/task1.c delete mode 100644 testsuites/sptests/sp09/task2.c delete mode 100644 testsuites/sptests/sp09/task3.c create mode 100644 testsuites/sptests/spclock_err01/Makefile.am create mode 100644 testsuites/sptests/spclock_err01/delay.c create mode 100644 testsuites/sptests/spclock_err01/init.c create mode 100644 testsuites/sptests/spclock_err01/spclock_err01.doc create mode 100644 testsuites/sptests/spclock_err01/spclock_err01.scn create mode 100644 testsuites/sptests/spclock_err01/system.h create mode 100644 testsuites/sptests/sptask_err02/Makefile.am create mode 100644 testsuites/sptests/sptask_err02/init.c create mode 100644 testsuites/sptests/sptask_err02/sptask_err02.doc create mode 100644 testsuites/sptests/sptask_err02/sptask_err02.scn create mode 100644 testsuites/sptests/sptask_err02/system.h 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') diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 41dfc5fa67..4722d4231d 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal ## Test names are spaced to indicate gaps in numbering from tests being ## deleted over the years. SUBDIRS = \ - sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 \ + sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 \ sp10 sp11 sp12 sp13 sp14 sp15 sp16 sp17 sp18 sp19 \ sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp27a sp28 sp29 \ sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \ @@ -31,7 +31,8 @@ SUBDIRS = \ spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \ spregion_err01 sppartition_err01 spratemon_err01 spintr_err01 \ spsignal_err01 spport_err01 spmsgq_err01 spmsgq_err02 spsem_err01 \ - spsem_err02 sptask_err01 spevent_err03 sptask_err03 + spsem_err02 sptask_err01 spevent_err03 sptask_err03 sptask_err02 \ + sptask_err04 spclock_err01 SUBDIRS += spprofiling01 SUBDIRS += spcache01 SUBDIRS += sptls03 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 9d6d4a9194..6a48dd97a0 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -59,7 +59,6 @@ sp05/Makefile sp06/Makefile sp07/Makefile sp08/Makefile -sp09/Makefile sp10/Makefile sp11/Makefile sp12/Makefile @@ -135,6 +134,7 @@ spcbssched02/Makefile spcbssched03/Makefile spchain/Makefile spclockget/Makefile +spclock_err01/Makefile spclock_err02/Makefile spcoverage/Makefile spedfsched01/Makefile @@ -223,7 +223,9 @@ sptimespec01/Makefile spwatchdog/Makefile spwkspace/Makefile sptask_err01/Makefile +sptask_err02/Makefile sptask_err03/Makefile +sptask_err04/Makefile sptimer_err01/Makefile sptimer_err02/Makefile spcpuset01/Makefile diff --git a/testsuites/sptests/sp09/Makefile.am b/testsuites/sptests/sp09/Makefile.am deleted file mode 100644 index 2c6f903f9d..0000000000 --- a/testsuites/sptests/sp09/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ - -rtems_tests_PROGRAMS = sp09 -sp09_SOURCES = init.c delay.c isr.c screen01.c screen02.c \ - task1.c task2.c task3.c \ - system.h - -dist_rtems_tests_DATA = sp09.scn -dist_rtems_tests_DATA += sp09.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 = $(sp09_OBJECTS) -LINK_LIBS = $(sp09_LDLIBS) - -sp09$(EXEEXT): $(sp09_OBJECTS) $(sp09_DEPENDENCIES) - @rm -f sp09$(EXEEXT) - $(make-exe) - -include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp09/delay.c b/testsuites/sptests/sp09/delay.c deleted file mode 100644 index cdd54c84f8..0000000000 --- a/testsuites/sptests/sp09/delay.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Delayed_routine - * - * This routine is used as the timer routine for Timer Manager tests. - * - * Input parameters: - * ignored - this parameter is ignored - * - * 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" - -rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address -) -{ -} diff --git a/testsuites/sptests/sp09/init.c b/testsuites/sptests/sp09/init.c deleted file mode 100644 index 3c5aadf3dc..0000000000 --- a/testsuites/sptests/sp09/init.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define CONFIGURE_INIT -#include "system.h" - -const char rtems_test_name[] = "SP 9"; - -rtems_task Init( - rtems_task_argument argument -) -{ - rtems_status_code status; - - TEST_BEGIN(); - - 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', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); - Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); - Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' ); - Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' ); - Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' ); - Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' ); - - Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); - Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); - Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); - - Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); - Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' ); - - Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); - - Period_name[ 1 ] = rtems_build_name( 'T', 'M', '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/sp09/isr.c b/testsuites/sptests/sp09/isr.c deleted file mode 100644 index 1144760338..0000000000 --- a/testsuites/sptests/sp09/isr.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Service_routine - * - * This routine is used as the timer routine for Interrupt Manager tests. - * - * Input parameters: - * ignored - this parameter is ignored - * - * 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" - -rtems_isr Service_routine( - rtems_vector_number ignored -) -{ -} diff --git a/testsuites/sptests/sp09/screen01.c b/testsuites/sptests/sp09/screen01.c deleted file mode 100644 index 004e5c5715..0000000000 --- a/testsuites/sptests/sp09/screen01.c +++ /dev/null @@ -1,266 +0,0 @@ -/* Screen1 - * - * This routine generates error screen 1 for test 9. - * - * 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.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "system.h" - -#include - -void Screen1() -{ - 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< -TA1 - rtems_clock_get_tod - RTEMS_INVALID_ADDRESS -TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_INVALID_ADDRESS -TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -TA1 - rtems_clock_get_uptime - RTEMS_INVALID_ADDRESS -TA1 - rtems_clock_get_uptime_timeval -TA1 - rtems_clock_get_uptime_seconds -TA1 - rtems_clock_get_uptime_nanoseconds -TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS -TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -TA1 - rtems_clock_set_nanoseconds_extension - RTEMS_INVALID_ADDRESS -TA1 - rtems_clock_set - RTEMS_INVALID_ADDRESS -TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS -TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED -TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK -TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL -TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds -TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS -TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL -TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK -TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK -TA1 - current time - 08:30:51 02/05/1988 -TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK -*** END OF TEST 9 *** diff --git a/testsuites/sptests/sp09/system.h b/testsuites/sptests/sp09/system.h deleted file mode 100644 index cf2c2e3277..0000000000 --- a/testsuites/sptests/sp09/system.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.org/license/LICENSE. - */ - -#include - -/* functions */ - -rtems_task Init( - rtems_task_argument argument -); - -rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address -); - -rtems_task Task_1( - rtems_task_argument argument -); - -rtems_task Task_2( - rtems_task_argument argument -); - -rtems_task Task_3( - rtems_task_argument argument -); - -rtems_isr Service_routine( - rtems_vector_number ignored -); - -rtems_timer_service_routine Io_during_interrupt( - rtems_id ignored -); - -void Screen1( void ); - -void Screen2( void ); - -void Screen3( void ); - -void Screen4( void ); - -void Screen5( void ); - -void Screen6( void ); - -/* configuration information */ - -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_MAXIMUM_TASKS 9 -#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_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) - -#include - -/* 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/sp09/task1.c b/testsuites/sptests/sp09/task1.c deleted file mode 100644 index 7fce5c66a7..0000000000 --- a/testsuites/sptests/sp09/task1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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" - -rtems_task Task_1( - rtems_task_argument argument -) -{ - Screen1(); - rtems_test_pause_and_screen_number( 2 ); - - Screen2(); - - TEST_END(); - - rtems_test_exit( 0 ); -} diff --git a/testsuites/sptests/sp09/task2.c b/testsuites/sptests/sp09/task2.c deleted file mode 100644 index 550b6a0a48..0000000000 --- a/testsuites/sptests/sp09/task2.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Task_2 - * - * This routine serves as a test task. Its only purpose is to generate the - * error where a semaphore is deleted while a task is waiting for it. - * - * 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" - -rtems_task Task_2( - rtems_task_argument argument -) -{ - rtems_status_code status; - - puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" ); - status = rtems_semaphore_obtain( - Semaphore_id[ 1 ], - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT - ); - fatal_directive_status( - status, - RTEMS_OBJECT_WAS_DELETED, - "rtems_semaphore_obtain waiting to be deleted" - ); - puts( - "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED" - ); - - puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); - status = rtems_task_delete( RTEMS_SELF ); - directive_failed( status, "rtems_task_delete of TA2" ); -} diff --git a/testsuites/sptests/sp09/task3.c b/testsuites/sptests/sp09/task3.c deleted file mode 100644 index 96e16ab71f..0000000000 --- a/testsuites/sptests/sp09/task3.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Task_3 - * - * This routine serves as a test task. Its only purpose in life is to - * generate the error where a message queue is deleted while a task - * is waiting there for a message. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2007. - * 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" - -rtems_task Task_3( - rtems_task_argument argument -) -{ - rtems_status_code status; - long buffer[ 4 ]; - size_t size; - - puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" ); - status = rtems_message_queue_receive( - Queue_id[ 1 ], - (long (*)[4])buffer, - &size, - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT - ); - fatal_directive_status( - status, - RTEMS_OBJECT_WAS_DELETED, - "rtems_message_queue_receive waiting to be deleted" - ); - puts( - "TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED" - ); - - puts( "TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); - status = rtems_task_delete( RTEMS_SELF ); - directive_failed( status, "rtems_task_delete of TA3" ); -} diff --git a/testsuites/sptests/spclock_err01/Makefile.am b/testsuites/sptests/spclock_err01/Makefile.am new file mode 100644 index 0000000000..f9cf1fc507 --- /dev/null +++ b/testsuites/sptests/spclock_err01/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = spclock_err01 +spclock_err01_SOURCES = init.c delay.c system.h + +dist_rtems_tests_DATA = spclock_err01.scn +dist_rtems_tests_DATA += spclock_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 = $(spclock_err01_OBJECTS) +LINK_LIBS = $(spclock_err01_LDLIBS) + +spclock_err01$(EXEEXT): $(spclock_err01_OBJECTS) $(spclock_err01_DEPENDENCIES) + @rm -f spclock_err01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spclock_err01/delay.c b/testsuites/sptests/spclock_err01/delay.c new file mode 100644 index 0000000000..246994130f --- /dev/null +++ b/testsuites/sptests/spclock_err01/delay.c @@ -0,0 +1,29 @@ +/* Delayed_routine + * + * This routine is used as the timer routine for Timer Manager tests. + * + * Input parameters: + * ignored - this parameter is ignored + * + * 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_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +) +{ +} diff --git a/testsuites/sptests/spclock_err01/init.c b/testsuites/sptests/spclock_err01/init.c new file mode 100644 index 0000000000..78f57b57cb --- /dev/null +++ b/testsuites/sptests/spclock_err01/init.c @@ -0,0 +1,218 @@ +/* + * 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 CLOCK ERROR 2"; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_interval interval; + struct timeval tv; + rtems_status_code status; + + TEST_BEGIN(); + + puts( "TA1 - rtems_clock_get_tod - RTEMS_INVALID_ADDRESS" ); + status = rtems_clock_get_tod( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_get_tod NULL param" + ); + +/* errors before clock is set */ + + status = rtems_clock_get_tod( &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_clock_get_tod before clock is set #1" + ); + puts( "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED" ); + } + + puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_INVALID_ADDRESS" ); + status = rtems_clock_get_seconds_since_epoch( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_get_seconds_since_epoch NULL param" + ); + + status = rtems_clock_get_seconds_since_epoch( &interval ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_clock_get_seconds_before_epoch" + ); + puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED" ); + } + + puts( "TA1 - rtems_clock_get_uptime - RTEMS_INVALID_ADDRESS" ); + status = rtems_clock_get_uptime( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_get_uptime NULL param" + ); + + puts( "TA1 - rtems_clock_get_uptime_timeval" ); + rtems_clock_get_uptime_timeval( &tv ); + + puts( "TA1 - rtems_clock_get_uptime_seconds" ); + rtems_clock_get_uptime_seconds(); + + puts( "TA1 - rtems_clock_get_uptime_nanoseconds" ); + rtems_clock_get_uptime_nanoseconds(); + + puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS" ); + status = rtems_clock_get_tod_timeval( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_get_tod_timeval NULL param" + ); + + status = rtems_clock_get_tod_timeval( &tv ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_clock_get_timeval" + ); + puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED" ); + } + + puts( "TA1 - rtems_clock_set_nanoseconds_extension - RTEMS_INVALID_ADDRESS" ); + status = rtems_clock_set_nanoseconds_extension( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_set_nanoseconds_extension NULL param" + ); + + /* NULL parameter */ + status = rtems_clock_set( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_clock_set sull pointer" + ); + puts( "TA1 - rtems_clock_set - RTEMS_INVALID_ADDRESS" ); + + build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 15, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid month" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 32, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid day" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 61, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid minute" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 61, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( + &time, 2, 5, 1988, 8, 30, 45, + rtems_clock_get_ticks_per_second() + 1 + ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid ticks per second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set successful" ); + puts( " - RTEMS_SUCCESSFUL" ); + + rtems_clock_get_tod( &time ); + print_time( "TA1 - current time - ", &time, "\n" ); + + TEST_END(); +} diff --git a/testsuites/sptests/spclock_err01/spclock_err01.doc b/testsuites/sptests/spclock_err01/spclock_err01.doc new file mode 100644 index 0000000000..431ba5e531 --- /dev/null +++ b/testsuites/sptests/spclock_err01/spclock_err01.doc @@ -0,0 +1,26 @@ +# 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: spclock_err01 + +directives: + c_gettod, c_secspoch, c_uptime, c_uptimeval, c_upsec, c_upnanosec, + c_todtimeval, c_nsecexten, c_set, tm_firewhen, c_ticksps, + +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/spclock_err01/spclock_err01.scn b/testsuites/sptests/spclock_err01/spclock_err01.scn new file mode 100644 index 0000000000..887c939d13 --- /dev/null +++ b/testsuites/sptests/spclock_err01/spclock_err01.scn @@ -0,0 +1,23 @@ +*** TEST CLOCK ERROR 01 *** +TA1 - rtems_clock_get_tod - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED +TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED +TA1 - rtems_clock_get_uptime - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_get_uptime_timeval +TA1 - rtems_clock_get_uptime_seconds +TA1 - rtems_clock_get_uptime_nanoseconds +TA1 - rtems_clock_get_tod_timeval - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED +TA1 - rtems_clock_set_nanoseconds_extension - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_set - RTEMS_INVALID_ADDRESS +TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL +TA1 - current time - 08:30:45 02/05/1988 +*** END TEST CLOCK ERROR 01 *** diff --git a/testsuites/sptests/spclock_err01/system.h b/testsuites/sptests/spclock_err01/system.h new file mode 100644 index 0000000000..d844d6e567 --- /dev/null +++ b/testsuites/sptests/spclock_err01/system.h @@ -0,0 +1,71 @@ +/* + * 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_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +); + +/* 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_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) + +#include + +/* 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/sptask_err02/Makefile.am b/testsuites/sptests/sptask_err02/Makefile.am new file mode 100644 index 0000000000..0c0edfd157 --- /dev/null +++ b/testsuites/sptests/sptask_err02/Makefile.am @@ -0,0 +1,22 @@ + +rtems_tests_PROGRAMS = sptask_err02 +sptask_err02_SOURCES = init.c system.h + +dist_rtems_tests_DATA = sptask_err02.scn +dist_rtems_tests_DATA += sptask_err02.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_err02_OBJECTS) +LINK_LIBS = $(sptask_err02_LDLIBS) + +sptask_err02$(EXEEXT): $(sptask_err02_OBJECTS) $(sptask_err02_DEPENDENCIES) + @rm -f sptask_err02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sptask_err02/init.c b/testsuites/sptests/sptask_err02/init.c new file mode 100644 index 0000000000..8eaf4646fc --- /dev/null +++ b/testsuites/sptests/sptask_err02/init.c @@ -0,0 +1,119 @@ +/* + * 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 TASK ERROR 02"; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + TEST_BEGIN(); + + /* wake when NULL param */ + status = rtems_task_wake_when( NULL ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_task_wake_when NULL param" + ); + puts( "TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS" ); + + /* wake when before set */ + status = rtems_task_wake_when( &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_task_wake_when before clock is set" + ); + puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); + } + /* rtems_task_wake_when */ + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set successful" ); + puts( " - RTEMS_SUCCESSFUL" ); + + build_time( + &time, + 2, 5, 1988, 8, 30, 48, + rtems_clock_get_ticks_per_second() + 1 + ); + time.second += 3; + puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" ); + + /* NULL time */ + status = rtems_task_wake_when( NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_task_wake_when with NULL" + ); + puts( "TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS" ); + + /* invalid ticks */ + status = rtems_task_wake_when( &time ); + directive_failed( + status, + "rtems_task_wake_when with invalid ticks per second" + ); + puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); + + build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + rtems_clock_get_tod( &time ); + print_time( "TA1 - current time - ", &time, "\n" ); + + time.month = 1; + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when before current time" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + TEST_END(); +} diff --git a/testsuites/sptests/sptask_err02/sptask_err02.doc b/testsuites/sptests/sptask_err02/sptask_err02.doc new file mode 100644 index 0000000000..c37d1c22b1 --- /dev/null +++ b/testsuites/sptests/sptask_err02/sptask_err02.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: sptask_err02 + +directives: + t_wkwhen, c_set, c_getticksps, c_gettod + +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_err02/sptask_err02.scn b/testsuites/sptests/sptask_err02/sptask_err02.scn new file mode 100644 index 0000000000..1503972dac --- /dev/null +++ b/testsuites/sptests/sptask_err02/sptask_err02.scn @@ -0,0 +1,12 @@ +*** TEST TASK ERROR 02 *** +TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS +TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds +TA1 - rtems_task_wake_when - RTEMS_INVALID_ADDRESS +TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK +TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - current time - 08:30:51 02/05/1988 +TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK +*** END TEST TASK ERROR 02 *** diff --git a/testsuites/sptests/sptask_err02/system.h b/testsuites/sptests/sptask_err02/system.h new file mode 100644 index 0000000000..c72eea9791 --- /dev/null +++ b/testsuites/sptests/sptask_err02/system.h @@ -0,0 +1,37 @@ +/* + * 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 +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include + +/* global variables */ + +/* end of include file */ 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<