summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spsem_err01
diff options
context:
space:
mode:
authorBjorn Larsson <bjornlarsson@oarcorp.com>2014-03-26 09:56:43 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-03-28 13:08:57 -0500
commitd6f65e40eaee24f67fdd26fbc64fad7b7271932d (patch)
tree0330ef8fcdef4040d6f63203a6056a46bcaf1c51 /testsuites/sptests/spsem_err01
parentsptests: Split sp09 screens 7,8 into spmsg1_err01 and spmsgq_err02. (diff)
downloadrtems-d6f65e40eaee24f67fdd26fbc64fad7b7271932d.tar.bz2
sptests: split sp09 screen 5,6 into spsem_err01, spsem_err02, and sptask_err01.
sp09 screen 5 split into spsem_err01, sp09 screen 6 split into spsem_err02, and sptask_err01.
Diffstat (limited to 'testsuites/sptests/spsem_err01')
-rw-r--r--testsuites/sptests/spsem_err01/Makefile.am22
-rw-r--r--testsuites/sptests/spsem_err01/init.c243
-rw-r--r--testsuites/sptests/spsem_err01/spsem_err01.doc26
-rw-r--r--testsuites/sptests/spsem_err01/spsem_err01.scn19
-rw-r--r--testsuites/sptests/spsem_err01/system.h64
5 files changed, 374 insertions, 0 deletions
diff --git a/testsuites/sptests/spsem_err01/Makefile.am b/testsuites/sptests/spsem_err01/Makefile.am
new file mode 100644
index 0000000000..dd99edca0f
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = spsem_err01
+spsem_err01_SOURCES = init.c system.h
+
+dist_rtems_tests_DATA = spsem_err01.scn
+dist_rtems_tests_DATA += spsem_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 = $(spsem_err01_OBJECTS)
+LINK_LIBS = $(spsem_err01_LDLIBS)
+
+spsem_err01$(EXEEXT): $(spsem_err01_OBJECTS) $(spsem_err01_DEPENDENCIES)
+ @rm -f spsem_err01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spsem_err01/init.c b/testsuites/sptests/spsem_err01/init.c
new file mode 100644
index 0000000000..6d2d8c08c1
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/init.c
@@ -0,0 +1,243 @@
+/*
+ * 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"
+
+#define MESSAGE_SIZE (sizeof(long) * 4)
+
+const char rtems_test_name[] = "SP SEMAPHORE ERROR 01";
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ TEST_BEGIN();
+
+ 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', ' ' );
+
+ /* invalid name */
+ status = rtems_semaphore_create(
+ 0,
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_create with illegal name"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" );
+
+ /* NULL Id parameter */
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ NULL
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ADDRESS,
+ "rtems_semaphore_create with NULL param"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_ADDRESS" );
+
+ /* OK */
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+ puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" );
+
+ do {
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ } while (status == RTEMS_SUCCESSFUL);
+
+ fatal_directive_status(
+ status,
+ RTEMS_TOO_MANY,
+ "rtems_semaphore_create of too many"
+ );
+ puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - FIFO and inherit - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_PRIORITY_CEILING | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_FIFO RTEMS_CEILING_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - FIFO and ceiling - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY_CEILING |
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY,
+ 10,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of binary with ceiling and inherit"
+ );
+ puts(
+ "TA1 - rtems_semaphore_create - ceiling and inherit - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_NOT_DEFINED,
+ "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 2,
+ RTEMS_BINARY_SEMAPHORE,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NUMBER,
+ "rtems_semaphore_create of binary semaphore with count > 1"
+ );
+ puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" );
+
+ /*
+ * The check for an object being global is only made if
+ * multiprocessing is enabled.
+ */
+
+#if defined(RTEMS_MULTIPROCESSING)
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_GLOBAL,
+ RTEMS_NO_PRIORITY,
+ &Junk_id
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_MP_NOT_CONFIGURED,
+ "rtems_semaphore_create of mp not configured"
+ );
+#endif
+ puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
+
+ status = rtems_semaphore_delete( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_delete( rtems_build_id( 1, 0, 0, 0 ) );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_delete with local illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (local)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_ident( 100, 1, &Junk_id );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_NAME,
+ "rtems_semaphore_ident will illegal name (global)"
+ );
+ puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
+
+ status = rtems_semaphore_release( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_release with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
+
+ status = rtems_semaphore_flush( 100 );
+ fatal_directive_status(
+ status,
+ RTEMS_INVALID_ID,
+ "rtems_semaphore_flush with illegal id"
+ );
+ puts( "TA1 - rtems_semaphore_flush - RTEMS_INVALID_ID" );
+
+ TEST_END();
+}
diff --git a/testsuites/sptests/spsem_err01/spsem_err01.doc b/testsuites/sptests/spsem_err01/spsem_err01.doc
new file mode 100644
index 0000000000..a4bd583d49
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/spsem_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: spsem_err01
+
+directives:
+
+ sm_create, sm_delete, sm_ident, sm_release, sm_flush,
+
+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/spsem_err01/spsem_err01.scn b/testsuites/sptests/spsem_err01/spsem_err01.scn
new file mode 100644
index 0000000000..00d363d15f
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/spsem_err01.scn
@@ -0,0 +1,19 @@
+*** TEST SEMAPHORE ERROR 01 ***
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_create - RTEMS_INVALID_ADDRESS
+TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY
+TA1 - rtems_semaphore_create - FIFO and inherit - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - FIFO and ceiling - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - ceiling and inherit - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED
+TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER
+TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED
+TA1 - rtems_semaphore_delete - RTEMS_INVALID_ID
+TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID
+TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME
+TA1 - rtems_semaphore_release - RTEMS_INVALID_ID
+TA1 - rtems_semaphore_flush - RTEMS_INVALID_ID
+*** END TEST SEMAPHORE ERROR 01 ***
diff --git a/testsuites/sptests/spsem_err01/system.h b/testsuites/sptests/spsem_err01/system.h
new file mode 100644
index 0000000000..76426b223f
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/system.h
@@ -0,0 +1,64 @@
+/*
+ * 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 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_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 */