summaryrefslogtreecommitdiff
path: root/testsuites/sptests/spclock_err01
diff options
context:
space:
mode:
authorBjorn Larsson <bjornlarsson@oarcorp.com>2014-03-28 13:05:57 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-03-28 13:09:06 -0500
commitdf367faddb9e927d18859692d1c0bbd613953328 (patch)
treec8759062d0b16561dec87b949a47bcd3da722d9b /testsuites/sptests/spclock_err01
parent719c7e55e4e9ee8c3e0184409cfd5862d501b1ba (diff)
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.
Diffstat (limited to 'testsuites/sptests/spclock_err01')
-rw-r--r--testsuites/sptests/spclock_err01/Makefile.am22
-rw-r--r--testsuites/sptests/spclock_err01/delay.c29
-rw-r--r--testsuites/sptests/spclock_err01/init.c218
-rw-r--r--testsuites/sptests/spclock_err01/spclock_err01.doc26
-rw-r--r--testsuites/sptests/spclock_err01/spclock_err01.scn23
-rw-r--r--testsuites/sptests/spclock_err01/system.h71
6 files changed, 389 insertions, 0 deletions
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 <tmacros.h>
+
+/* 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 <rtems/confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */
+
+TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
+TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */
+
+TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */
+TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */
+
+TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */
+TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */
+
+TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */
+TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */
+
+TEST_EXTERN rtems_id Junk_id; /* id used to return errors */
+
+#define Internal_port_area (void *) 0x00001000
+#define External_port_area (void *) 0x00002000
+
+/* end of include file */