summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sptask_err02
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/sptask_err02
parentsptask_err03: New test split from sp09 screen 3. (diff)
downloadrtems-df367faddb9e927d18859692d1c0bbd613953328.tar.bz2
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/sptask_err02')
-rw-r--r--testsuites/sptests/sptask_err02/Makefile.am22
-rw-r--r--testsuites/sptests/sptask_err02/init.c119
-rw-r--r--testsuites/sptests/sptask_err02/sptask_err02.doc25
-rw-r--r--testsuites/sptests/sptask_err02/sptask_err02.scn12
-rw-r--r--testsuites/sptests/sptask_err02/system.h37
5 files changed, 215 insertions, 0 deletions
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 <tmacros.h>
+
+/* 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 <rtems/confdefs.h>
+
+/* global variables */
+
+/* end of include file */