diff options
author | Daniel Ramirez <javamonn@gmail.com> | 2013-12-11 17:10:34 -0600 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-12-11 20:11:08 -0500 |
commit | 07f4edc14b283486c9493b8e8083967c6ddeb47e (patch) | |
tree | 9fe46ce063c00369df4098f5af0cb16e7f9e9ce7 /testsuites/sptests/sptimer_err01 | |
parent | PR1960: ERC32_Is_interrupt_masked for ERC32 in erc32.h (diff) | |
download | rtems-07f4edc14b283486c9493b8e8083967c6ddeb47e.tar.bz2 |
sptests: refactored sp09/screen14.c into two new tests
Diffstat (limited to 'testsuites/sptests/sptimer_err01')
-rw-r--r-- | testsuites/sptests/sptimer_err01/Makefile.am | 22 | ||||
-rw-r--r-- | testsuites/sptests/sptimer_err01/init.c | 254 | ||||
-rw-r--r-- | testsuites/sptests/sptimer_err01/sptimer_err01.doc | 22 | ||||
-rw-r--r-- | testsuites/sptests/sptimer_err01/sptimer_err01.scn | 23 |
4 files changed, 321 insertions, 0 deletions
diff --git a/testsuites/sptests/sptimer_err01/Makefile.am b/testsuites/sptests/sptimer_err01/Makefile.am new file mode 100644 index 0000000000..25d43bcf7f --- /dev/null +++ b/testsuites/sptests/sptimer_err01/Makefile.am @@ -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 diff --git a/testsuites/sptests/sptimer_err01/init.c b/testsuites/sptests/sptimer_err01/init.c new file mode 100644 index 0000000000..149808660f --- /dev/null +++ b/testsuites/sptests/sptimer_err01/init.c @@ -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 */ diff --git a/testsuites/sptests/sptimer_err01/sptimer_err01.doc b/testsuites/sptests/sptimer_err01/sptimer_err01.doc new file mode 100644 index 0000000000..ecad1b322a --- /dev/null +++ b/testsuites/sptests/sptimer_err01/sptimer_err01.doc @@ -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. diff --git a/testsuites/sptests/sptimer_err01/sptimer_err01.scn b/testsuites/sptests/sptimer_err01/sptimer_err01.scn new file mode 100644 index 0000000000..455017e21b --- /dev/null +++ b/testsuites/sptests/sptimer_err01/sptimer_err01.scn @@ -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 *** + |