sptests: refactored sp09/screen14.c into two new tests

This commit is contained in:
Daniel Ramirez
2013-12-11 17:10:34 -06:00
committed by Gedare Bloom
parent bde2237020
commit 07f4edc14b
17 changed files with 618 additions and 419 deletions

View File

@@ -37,6 +37,7 @@ SUBDIRS += speventtransient01
SUBDIRS += speventsystem01
SUBDIRS += spinternalerror01
SUBDIRS += spinternalerror02
SUBDIRS += sptimer_err01 sptimer_err02
include $(top_srcdir)/../automake/subdirs.am
include $(top_srcdir)/../automake/local.am

View File

@@ -197,5 +197,7 @@ spthreadq01/Makefile
sptimespec01/Makefile
spwatchdog/Makefile
spwkspace/Makefile
sptimer_err01/Makefile
sptimer_err02/Makefile
])
AC_OUTPUT

View File

@@ -2,8 +2,8 @@
rtems_tests_PROGRAMS = sp09
sp09_SOURCES = init.c delay.c isr.c screen01.c screen02.c screen03.c screen04.c \
screen05.c screen06.c screen07.c screen08.c screen09.c screen10.c \
screen11.c screen12.c screen13.c screen14.c task1.c task2.c task3.c \
task4.c system.h
screen11.c screen12.c screen13.c task1.c task2.c task3.c task4.c \
system.h
dist_rtems_tests_DATA = sp09.scn
dist_rtems_tests_DATA += sp09.doc

View File

@@ -33,8 +33,6 @@ rtems_task Init(
Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' );
Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' );
Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
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', ' ' );

View File

@@ -1,368 +0,0 @@
/* Screen14
*
* This routine generates error screen 14 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 Screen14()
{
rtems_status_code status;
rtems_time_of_day time;
rtems_timer_information timer_info;
bool skipUnsatisfied;
/* NULL Id */
status = rtems_timer_create( Timer_name[ 1 ], NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_create NULL param"
);
puts( "TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS" );
/* bad name */
status = rtems_timer_create( 0, &Junk_id );
fatal_directive_status(
status,
RTEMS_INVALID_NAME,
"rtems_timer_create with illegal name"
);
puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" );
/* OK */
status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
directive_failed( status, "rtems_timer_create" );
puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" );
status = rtems_timer_create( 2, &Junk_id );
fatal_directive_status(
status,
RTEMS_TOO_MANY,
"rtems_timer_create for too many"
);
puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" );
status = rtems_timer_delete( 100 );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_delete with illegal id"
);
puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" );
status = rtems_timer_delete( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_delete with illegal id"
);
puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" );
status = rtems_timer_ident( 0, &Junk_id );
fatal_directive_status(
status,
RTEMS_INVALID_NAME,
"rtems_timer_ident with illegal name"
);
puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" );
status = rtems_timer_cancel( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_cancel with illegal id"
);
puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" );
status = rtems_timer_reset( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_reset with illegal id"
);
puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" );
status = rtems_timer_reset( Timer_id[ 1 ] );
fatal_directive_status(
status,
RTEMS_NOT_DEFINED,
"rtems_timer_reset before initiated"
);
puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" );
/* bad id */
status = rtems_timer_fire_after(
rtems_build_id( 1, 1, 1, 256 ),
5 * rtems_clock_get_ticks_per_second(),
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_fire_after illegal id"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" );
/* bad id */
build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
status = rtems_timer_fire_when(
rtems_build_id( 1, 1, 1, 256 ),
&time,
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_fire_when with illegal id"
);
puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" );
/* NULL routine */
status = rtems_timer_fire_after( Timer_id[ 1 ], 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_fire_after with NULL handler"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS" );
/* 0 ticks */
status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_NUMBER,
"rtems_timer_fire_after with 0 ticks"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" );
/* NULL routine */
status = rtems_timer_fire_when( Timer_id[ 1 ], &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_fire_when with NULL handler"
);
puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS" );
/* invalid time -- before RTEMS epoch */
build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_fire_when with illegal time"
);
print_time(
"TA1 - rtems_timer_fire_when - ",
&time,
" - RTEMS_INVALID_CLOCK\n"
);
status = rtems_clock_get_tod( &time );
directive_failed( status, "rtems_clock_get_tod" );
print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" );
build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_fire_when before current time"
);
print_time(
"TA1 - rtems_timer_fire_when - ",
&time,
" - before RTEMS_INVALID_CLOCK\n"
);
/* null param */
status = rtems_timer_get_information( Timer_id[ 1 ], NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_get_information with NULL param"
);
puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS" );
/* invalid id */
status = rtems_timer_get_information( 100, &timer_info );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_get_information with illegal id"
);
puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ID" );
/* timer server interface routines */
/* incorrect state */
status = rtems_timer_server_fire_after( 0, 5, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INCORRECT_STATE,
"rtems_timer_server_fire_after incorrect state"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" );
/* incorrect state */
status = rtems_timer_server_fire_when( 0, &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INCORRECT_STATE,
"rtems_timer_server_fire_when incorrect state"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" );
/* invalid priority */
status = rtems_timer_initiate_server( 0, 0, 0 );
fatal_directive_status(
status,
RTEMS_INVALID_PRIORITY,
"rtems_timer_initiate_server invalid priority"
);
puts( "TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY" );
skipUnsatisfied = false;
#if defined(__m32c__)
skipUnsatisfied = true;
#endif
if (skipUnsatisfied) {
puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED -- SKIPPED" );
} else {
status = rtems_timer_initiate_server(
RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
0x10000000,
0
);
fatal_directive_status(
status,
RTEMS_UNSATISFIED,
"rtems_timer_initiate_server too much stack "
);
puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED" );
}
status =
rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0, 0 );
directive_failed( status, "rtems_timer_initiate_server" );
puts( "TA1 - rtems_timer_initiate_server - SUCCESSFUL" );
/* NULL routine */
status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_after NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" );
/* bad Id */
status = rtems_timer_server_fire_after(
rtems_build_id( 1, 1, 1, 256 ),
5 * rtems_clock_get_ticks_per_second(),
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_server_fire_after illegal id"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" );
/* bad id */
build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
status = rtems_timer_server_fire_when(
rtems_build_id( 1, 1, 1, 256 ),
&time,
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_server_fire_when with illegal id"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" );
/* NULL routine */
status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_after NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" );
/* 0 ticks */
status = rtems_timer_server_fire_after(
Timer_id[ 1 ], 0, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_NUMBER,
"rtems_timer_server_fire_after with 0 ticks"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" );
/* illegal time */
build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
status = rtems_timer_server_fire_when(
Timer_id[ 1 ], &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_server_fire_when with illegal time"
);
print_time(
"TA1 - rtems_timer_server_fire_when - ",
&time,
" - RTEMS_INVALID_CLOCK\n"
);
status = rtems_clock_get_tod( &time );
directive_failed( status, "rtems_clock_get_tod" );
print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" );
/* when NULL routine */
status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_when NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS" );
/* before current time */
build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
status = rtems_timer_server_fire_when(
Timer_id[ 1 ], &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_server_fire_when before current time"
);
print_time(
"TA1 - rtems_timer_server_fire_when - ",
&time,
" - before RTEMS_INVALID_CLOCK\n"
);
}

View File

@@ -12,10 +12,8 @@ This file describes the directives and concepts tested by this test set.
test set name: test9
directives:
ex_init, ex_start, tm_tick, i_return,
t_create,t_delete, t_getreg, t_ident, t_restart, t_resume, t_setpri,
t_setreg, t_start, t_suspend, tm_delete, tm_get,
tm_set, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete,
ex_init, ex_start, tm_tick, i_return, t_resume, t_setpri, t_setreg, t_start,
t_suspend, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete,
sm_ident, sm_p, sm_v, q_broadcast, q_create, q_delete, q_ident, q_receive,
q_send, q_urgent, as_catch, as_send, as_return, rn_create, rn_delete,
rn_getseg, rn_ident, rn_retseg, pt_create, pt_delete, pt_getbug, pt_ident,

View File

@@ -295,39 +295,4 @@ TA1 - rtems_clock_set - 23:59:59 12/31/2099 - RTEMS_SUCCESSFUL
TA1 - rtems_clock_get_tod - 17:31:44 11/25/1963 - RTEMS_SUCCESSFUL
TA1 - rtems_clock_set - 23:59:59 12/31/1991 - RTEMS_SUCCESSFUL
TA1 - rtems_clock_get_tod - 00:00:00 01/01/1992 - RTEMS_SUCCESSFUL
<pause - screen 14>
TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_create - RTEMS_INVALID_NAME
TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL
TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY
TA1 - rtems_timer_delete - local RTEMS_INVALID_ID
TA1 - rtems_timer_delete - global RTEMS_INVALID_ID
TA1 - rtems_timer_ident - RTEMS_INVALID_NAME
TA1 - rtems_timer_cancel - RTEMS_INVALID_ID
TA1 - rtems_timer_reset - RTEMS_INVALID_ID
TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED
TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID
TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID
TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
TA1 - rtems_clock_get_tod - 00:00:00 01/01/1992
TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_get_information - RTEMS_INVALID_ID
TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE
TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE
TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY
TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED
TA1 - rtems_timer_initiate_server - SUCCESSFUL
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID
TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER
TA1 - rtems_timer_server_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
TA1 - rtems_clock_get_tod - 00:00:00 01/01/1992
TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
*** END OF TEST 9 ***

View File

@@ -74,8 +74,6 @@ void Screen12( void );
void Screen13( void );
void Screen14( void );
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
@@ -102,9 +100,6 @@ void Screen14( void );
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 Timer_name[ 2 ]; /* array of timer names */
TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */
TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */

View File

@@ -62,9 +62,6 @@ rtems_task Task_1(
rtems_test_pause_and_screen_number( 13 );
Screen13();
rtems_test_pause_and_screen_number( 14 );
Screen14();
puts( "*** END OF TEST 9 ***" );
rtems_test_exit( 0 );

View File

@@ -0,0 +1,22 @@
MANAGERS = all
rtems_tests_PROGRAMS = sptimer_err01
sptimer_err01_SOURCES = init.c
dist_rtems_tests_DATA = sptimer_err01.scn
dist_rtems_tests_DATA += sptimer_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 = $(sptimer_err01_OBJECTS) $(sptimer_err01_LDADD)
LINK_LIBS = $(sptimer_err01_LDLIBS)
sptimer_err01$(EXEEXT): $(sptimer_err01_OBJECTS) $(sptimer_err01_DEPENDENCIES)
@rm -f sptimer_err01$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,254 @@
/*
* COPYRIGHT (c) 2013.
* 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 <tmacros.h>
#include "test_support.h"
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
rtems_timer_service_routine Delayed_routine(
rtems_id ignored_id,
void *ignored_address
);
rtems_task Init(
rtems_task_argument argument
)
{
puts( "\n\n*** TEST SPTIMER_ERR01 ***" );
rtems_status_code status;
rtems_time_of_day time;
rtems_timer_information timer_info;
rtems_name timer_name;
rtems_id timer_id;
rtems_id junk_id;
timer_name = rtems_build_name( 'T', 'M', '1', ' ' );
/* Set System time */
build_time( &time, 12, 31, 1992, 9, 0, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
/* NULL Id */
status = rtems_timer_create( timer_name, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_create NULL param"
);
puts( "TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS" );
/* bad name */
status = rtems_timer_create( 0, &junk_id );
fatal_directive_status(
status,
RTEMS_INVALID_NAME,
"rtems_timer_create with illegal name"
);
puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" );
/* OK */
status = rtems_timer_create( timer_name, &timer_id );
directive_failed( status, "rtems_timer_create" );
puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" );
status = rtems_timer_create( 2, &junk_id );
fatal_directive_status(
status,
RTEMS_TOO_MANY,
"rtems_timer_create for too many"
);
puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" );
status = rtems_timer_delete( 100 );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_delete with illegal id"
);
puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" );
status = rtems_timer_delete( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_delete with illegal id"
);
puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" );
status = rtems_timer_ident( 0, &junk_id );
fatal_directive_status(
status,
RTEMS_INVALID_NAME,
"rtems_timer_ident with illegal name"
);
puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" );
status = rtems_timer_cancel( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_cancel with illegal id"
);
puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" );
status = rtems_timer_reset( rtems_build_id( 1, 1, 1, 256 ) );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_reset with illegal id"
);
puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" );
status = rtems_timer_reset( timer_id );
fatal_directive_status(
status,
RTEMS_NOT_DEFINED,
"rtems_timer_reset before initiated"
);
puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" );
/* bad id */
status = rtems_timer_fire_after(
rtems_build_id( 1, 1, 1, 256 ),
5 * rtems_clock_get_ticks_per_second(),
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_fire_after illegal id"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" );
/* bad id */
build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
status = rtems_timer_fire_when(
rtems_build_id( 1, 1, 1, 256 ),
&time,
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_fire_when with illegal id"
);
puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" );
/* NULL routine */
status = rtems_timer_fire_after( timer_id, 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_fire_after with NULL handler"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS" );
/* 0 ticks */
status = rtems_timer_fire_after( timer_id, 0, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_NUMBER,
"rtems_timer_fire_after with 0 ticks"
);
puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" );
/* NULL routine */
status = rtems_timer_fire_when( timer_id, &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_fire_when with NULL handler"
);
puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS" );
/* invalid time -- before RTEMS epoch */
build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
status = rtems_timer_fire_when( timer_id, &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_fire_when with illegal time"
);
print_time(
"TA1 - rtems_timer_fire_when - ",
&time,
" - RTEMS_INVALID_CLOCK\n"
);
status = rtems_clock_get_tod( &time );
directive_failed( status, "rtems_clock_get_tod" );
print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" );
build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
status = rtems_timer_fire_when( timer_id, &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_fire_when before current time"
);
print_time(
"TA1 - rtems_timer_fire_when - ",
&time,
" - before RTEMS_INVALID_CLOCK\n"
);
/* null param */
status = rtems_timer_get_information( timer_id, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_get_information with NULL param"
);
puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS" );
/* invalid id */
status = rtems_timer_get_information( 100, &timer_info );
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_get_information with illegal id"
);
puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ID" );
puts( "*** END OF TEST SPTIMER_ERR01 ***" );
rtems_test_exit(0);
}
rtems_timer_service_routine Delayed_routine(
rtems_id ignored_id,
void *ignored_address
)
{
/* Empty routine that gets passed to rtems_timer_fire_when */
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

View File

@@ -0,0 +1,22 @@
# COPYRIGHT (c) 1989-2013.
# 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: sptimer_err02
directives:
rtems_timer_create, rtems_timer_delete, rtems_timer_ident, rtems_timer_cancel,
rtems_timer_reset, rtems_timer_fire_after, rtems_timer_fire_when,
rtems_clock_get_tod, rtems_timer_get_information
concepts:
+ Verifies error codes returned by the executive for rtems_timer functions in
a non server context.

View File

@@ -0,0 +1,23 @@
*** TEST SPTIMER_ERR01 ***
TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_create - RTEMS_INVALID_NAME
TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL
TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY
TA1 - rtems_timer_delete - local RTEMS_INVALID_ID
TA1 - rtems_timer_delete - global RTEMS_INVALID_ID
TA1 - rtems_timer_ident - RTEMS_INVALID_NAME
TA1 - rtems_timer_cancel - RTEMS_INVALID_ID
TA1 - rtems_timer_reset - RTEMS_INVALID_ID
TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED
TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID
TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID
TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
TA1 - rtems_clock_get_tod - 09:00:00 12/31/1992
TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_get_information - RTEMS_INVALID_ID
*** END OF TEST SPTIMER_ERR01 ***

View File

@@ -0,0 +1,22 @@
MANAGERS = all
rtems_tests_PROGRAMS = sptimer_err02
sptimer_err02_SOURCES = init.c
dist_rtems_tests_DATA = sptimer_err02.scn
dist_rtems_tests_DATA += sptimer_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 = $(sptimer_err02_OBJECTS) $(sptimer_err02_LDADD)
LINK_LIBS = $(sptimer_err02_LDLIBS)
sptimer_err02$(EXEEXT): $(sptimer_err02_OBJECTS) $(sptimer_err02_DEPENDENCIES)
@rm -f sptimer_err02$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,228 @@
/*
* COPYRIGHT (c) 1989-2013.
* 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 <tmacros.h>
#include "test_support.h"
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
rtems_timer_service_routine Delayed_routine(
rtems_id ignored_id,
void *ignored_address
);
rtems_task Init(
rtems_task_argument argument
)
{
puts( "\n\n*** TEST SPTIMER_ERR02 ***" );
rtems_status_code status;
rtems_time_of_day time;
rtems_id timer_id;
rtems_name timer_name;
bool skipUnsatisfied;
/* Set System time */
build_time( &time, 12, 31, 1992, 9, 0, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
timer_name = rtems_build_name( 'T', 'M', '1', ' ' );
/* OK */
status = rtems_timer_create( timer_name, &timer_id );
directive_failed( status, "rtems_timer_create" );
puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" );
/* incorrect state */
status = rtems_timer_server_fire_after( 0, 5, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INCORRECT_STATE,
"rtems_timer_server_fire_after incorrect state"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" );
/* incorrect state */
status = rtems_timer_server_fire_when( 0, &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INCORRECT_STATE,
"rtems_timer_server_fire_when incorrect state"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" );
/* invalid priority */
status = rtems_timer_initiate_server( 0, 0, 0 );
fatal_directive_status(
status,
RTEMS_INVALID_PRIORITY,
"rtems_timer_initiate_server invalid priority"
);
puts( "TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY" );
skipUnsatisfied = false;
#if defined(__m32c__)
skipUnsatisfied = true;
#endif
if (skipUnsatisfied) {
puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED -- SKIPPED" );
} else {
status = rtems_timer_initiate_server(
RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
0x10000000,
0
);
fatal_directive_status(
status,
RTEMS_UNSATISFIED,
"rtems_timer_initiate_server too much stack "
);
puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED" );
}
status =
rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0, 0 );
directive_failed( status, "rtems_timer_initiate_server" );
puts( "TA1 - rtems_timer_initiate_server - SUCCESSFUL" );
/* NULL routine */
status = rtems_timer_server_fire_after( timer_id, 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_after NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" );
/* bad Id */
status = rtems_timer_server_fire_after(
rtems_build_id( 1, 1, 1, 256 ),
5 * rtems_clock_get_ticks_per_second(),
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_server_fire_after illegal id"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" );
/* bad id */
build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
status = rtems_timer_server_fire_when(
rtems_build_id( 1, 1, 1, 256 ),
&time,
Delayed_routine,
NULL
);
fatal_directive_status(
status,
RTEMS_INVALID_ID,
"rtems_timer_server_fire_when with illegal id"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" );
/* NULL routine */
status = rtems_timer_server_fire_after( timer_id, 1, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_after NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" );
/* 0 ticks */
status = rtems_timer_server_fire_after(
timer_id, 0, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_NUMBER,
"rtems_timer_server_fire_after with 0 ticks"
);
puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" );
/* illegal time */
build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
status = rtems_timer_server_fire_when(
timer_id, &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_server_fire_when with illegal time"
);
print_time(
"TA1 - rtems_timer_server_fire_when - ",
&time,
" - RTEMS_INVALID_CLOCK\n"
);
status = rtems_clock_get_tod( &time );
directive_failed( status, "rtems_clock_get_tod" );
print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" );
/* when NULL routine */
status = rtems_timer_server_fire_when( timer_id, &time, NULL, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_ADDRESS,
"rtems_timer_server_fire_when NULL routine"
);
puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS" );
/* before current time */
build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
status = rtems_timer_server_fire_when(
timer_id, &time, Delayed_routine, NULL );
fatal_directive_status(
status,
RTEMS_INVALID_CLOCK,
"rtems_timer_server_fire_when before current time"
);
print_time(
"TA1 - rtems_timer_server_fire_when - ",
&time,
" - before RTEMS_INVALID_CLOCK\n"
);
puts( "*** END OF TEST SPTIMER_ERR02 ***" );
rtems_test_exit(0);
}
rtems_timer_service_routine Delayed_routine(
rtems_id ignored_id,
void *ignored_address
)
{
/* Empty routine that gets passed to rtems_timer_fire_when */
}
#define CONFIGURE_INIT
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
/* Two Tasks: Init and Timer Server */
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE)
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,22 @@
# COPYRIGHT (c) 1989-2013.
# 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: sptimer_err02
directives:
rtems_timer_create, rtems_timer_server_fire_after,
rtems_timer_server_fire_when, rtems_timer_initiate_server,
concepts:
+ Verifies error codes returned by the executive for rtems_timer functions in
a server context.

View File

@@ -0,0 +1,18 @@
*** TEST SPTIMER_ERR02 ***
TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL
TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE
TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE
TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY
TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED
TA1 - rtems_timer_initiate_server - SUCCESSFUL
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID
TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER
TA1 - rtems_timer_server_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK
TA1 - rtems_clock_get_tod - 09:00:00 12/31/1992
TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS
TA1 - rtems_timer_server_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK
*** END OF TEST SPTIMER_ERR02 ***