[PATCH 6/9] sptests: split sp09 screen 5, 6 into spsem_err01, spsem_err02, and sptask_err01.

Jennifer Averett jennifer.averett at oarcorp.com
Thu Mar 27 15:30:03 UTC 2014


From: Björn Larsson <BjornL at rtems.org>

sp09 screen 5 split into spsem_err01, sp09 screen 6 split into
spsem_err02, and sptask_err01.
---
 testsuites/sptests/Makefile.am                   |   3 +-
 testsuites/sptests/configure.ac                  |   3 +
 testsuites/sptests/sp09/Makefile.am              |   1 -
 testsuites/sptests/sp09/screen05.c               | 235 ----------------------
 testsuites/sptests/sp09/screen06.c               | 128 ------------
 testsuites/sptests/sp09/sp09.scn                 |  36 ----
 testsuites/sptests/sp09/task1.c                  |   6 -
 testsuites/sptests/spsem_err01/Makefile.am       |  22 +++
 testsuites/sptests/spsem_err01/init.c            | 241 +++++++++++++++++++++++
 testsuites/sptests/spsem_err01/spsem_err01.doc   |  26 +++
 testsuites/sptests/spsem_err01/spsem_err01.scn   |  19 ++
 testsuites/sptests/spsem_err01/system.h          |  64 ++++++
 testsuites/sptests/spsem_err02/Makefile.am       |  22 +++
 testsuites/sptests/spsem_err02/init.c            | 156 +++++++++++++++
 testsuites/sptests/spsem_err02/spsem_err02.doc   |  25 +++
 testsuites/sptests/spsem_err02/spsem_err02.scn   |  20 ++
 testsuites/sptests/spsem_err02/system.h          |  54 +++++
 testsuites/sptests/spsem_err02/task2.c           |  48 +++++
 testsuites/sptests/sptask_err01/Makefile.am      |  22 +++
 testsuites/sptests/sptask_err01/init.c           |  55 ++++++
 testsuites/sptests/sptask_err01/sptask_err01.doc |  25 +++
 testsuites/sptests/sptask_err01/sptask_err01.scn |   7 +
 testsuites/sptests/sptask_err01/system.h         |  51 +++++
 testsuites/sptests/sptask_err01/task2.c          |  34 ++++
 24 files changed, 896 insertions(+), 407 deletions(-)
 delete mode 100644 testsuites/sptests/sp09/screen05.c
 delete mode 100644 testsuites/sptests/sp09/screen06.c
 create mode 100644 testsuites/sptests/spsem_err01/Makefile.am
 create mode 100644 testsuites/sptests/spsem_err01/init.c
 create mode 100644 testsuites/sptests/spsem_err01/spsem_err01.doc
 create mode 100644 testsuites/sptests/spsem_err01/spsem_err01.scn
 create mode 100644 testsuites/sptests/spsem_err01/system.h
 create mode 100644 testsuites/sptests/spsem_err02/Makefile.am
 create mode 100644 testsuites/sptests/spsem_err02/init.c
 create mode 100644 testsuites/sptests/spsem_err02/spsem_err02.doc
 create mode 100644 testsuites/sptests/spsem_err02/spsem_err02.scn
 create mode 100644 testsuites/sptests/spsem_err02/system.h
 create mode 100644 testsuites/sptests/spsem_err02/task2.c
 create mode 100644 testsuites/sptests/sptask_err01/Makefile.am
 create mode 100644 testsuites/sptests/sptask_err01/init.c
 create mode 100644 testsuites/sptests/sptask_err01/sptask_err01.doc
 create mode 100644 testsuites/sptests/sptask_err01/sptask_err01.scn
 create mode 100644 testsuites/sptests/sptask_err01/system.h
 create mode 100644 testsuites/sptests/sptask_err01/task2.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 94e0878..a09c5d5 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -30,7 +30,8 @@ SUBDIRS = \
     spsimplesched03 spnsext01 spedfsched01 spedfsched02 spedfsched03 \
     spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \
     spregion_err01 sppartition_err01 spratemon_err01 spintr_err01 \
-    spsignal_err01 spport_err01 spmsgq_err01 spmsgq_err02
+    spsignal_err01 spport_err01 spmsgq_err01 spmsgq_err02 spsem_err01 \
+    spsem_err02 sptask_err01
 SUBDIRS += spprofiling01
 SUBDIRS += spcache01
 SUBDIRS += sptls03
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 0f88f68..db0c0a2 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -205,6 +205,8 @@ spprivenv01/Makefile
 spqreslib/Makefile
 spratemon_err01/Makefile
 sprbtree01/Makefile
+spsem_err01/Makefile
+spsem_err02/Makefile
 spsem01/Makefile
 spsem02/Makefile
 spsignal_err01/Makefile
@@ -218,6 +220,7 @@ spthreadq01/Makefile
 sptimespec01/Makefile
 spwatchdog/Makefile
 spwkspace/Makefile
+sptask_err01/Makefile
 sptimer_err01/Makefile
 sptimer_err02/Makefile
 spcpuset01/Makefile
diff --git a/testsuites/sptests/sp09/Makefile.am b/testsuites/sptests/sp09/Makefile.am
index ada2075..b001205 100644
--- a/testsuites/sptests/sp09/Makefile.am
+++ b/testsuites/sptests/sp09/Makefile.am
@@ -1,7 +1,6 @@
 
 rtems_tests_PROGRAMS = sp09
 sp09_SOURCES = init.c delay.c isr.c screen01.c screen02.c screen03.c screen04.c \
-    screen05.c screen06.c \
     task1.c task2.c task3.c \
     system.h
 
diff --git a/testsuites/sptests/sp09/screen05.c b/testsuites/sptests/sp09/screen05.c
deleted file mode 100644
index ce3ea4c..0000000
--- a/testsuites/sptests/sp09/screen05.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*  Screen5
- *
- *  This routine generates error screen 5 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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "system.h"
-
-void Screen5()
-{
-  rtems_status_code status;
-
-  /* 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" );
-}
diff --git a/testsuites/sptests/sp09/screen06.c b/testsuites/sptests/sp09/screen06.c
deleted file mode 100644
index da1ab11..0000000
--- a/testsuites/sptests/sp09/screen06.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*  Screen6
- *
- *  This routine generates error screen 6 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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "system.h"
-
-void Screen6()
-{
-  rtems_status_code status;
-
-  status = rtems_semaphore_obtain(
-    100,
-    RTEMS_DEFAULT_OPTIONS,
-    RTEMS_NO_TIMEOUT
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_semaphore_obtain with illegal id"
-  );
-  puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
-
-  status = rtems_semaphore_obtain(
-    Semaphore_id[ 1 ],
-    RTEMS_DEFAULT_OPTIONS,
-    RTEMS_NO_TIMEOUT
-  );
-  directive_failed( status, "rtems_semaphore_obtain successful" );
-  puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
-
-  status = rtems_semaphore_obtain(
-    Semaphore_id[ 1 ],
-    RTEMS_NO_WAIT,
-    RTEMS_NO_TIMEOUT
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_UNSATISFIED,
-    "rtems_semaphore_obtain not available"
-  );
-  puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
-
-  puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
-  status = rtems_semaphore_obtain(
-    Semaphore_id[ 1 ],
-    RTEMS_DEFAULT_OPTIONS,
-    3 * rtems_clock_get_ticks_per_second()
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_TIMEOUT,
-    "rtems_semaphore_obtain timeout"
-  );
-  puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
-
-  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
-  fatal_directive_status(
-    status,
-    RTEMS_NOT_OWNER_OF_RESOURCE,
-    "rtems_semaphore_release and not owner"
-  );
-  puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
-
-  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" );
-
-  puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
-  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
-  directive_failed( status, "rtems_task_start of TA2" );
-
-  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
-  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
-  directive_failed( status, "rtems_task_wake_after (yield)" );
-
-  puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
-  status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
-  directive_failed( status, "rtems_semaphore_delete of SM1" );
-
-  puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
-  status = rtems_semaphore_obtain(
-    Semaphore_id[ 2 ],
-    RTEMS_DEFAULT_OPTIONS,
-    RTEMS_NO_TIMEOUT
-  );
-  directive_failed( status, "rtems_semaphore_obtain");
-
-  puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
-  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
-  fatal_directive_status(
-     status,
-     RTEMS_RESOURCE_IN_USE,
-     "rtems_semaphore_delete of SM2"
-  );
-
-  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
-  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
-  directive_failed( status, "rtems_task_wake_after (yield)" );
-
-  status = rtems_task_delete( Task_id[ 2 ] );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_delete after the task has been deleted"
-  );
-
-  puts( "TA1 - rtems_task_delete TA2 - already deleted RTEMS_INVALID_ID" );
-}
diff --git a/testsuites/sptests/sp09/sp09.scn b/testsuites/sptests/sp09/sp09.scn
index 8cf36ce..db1f2a6 100644
--- a/testsuites/sptests/sp09/sp09.scn
+++ b/testsuites/sptests/sp09/sp09.scn
@@ -84,40 +84,4 @@ TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL
 TA1 - rtems_clock_set - 08:30:45   02/05/1988 - RTEMS_SUCCESSFUL
 TA1 - current time - Fri Feb  5 08:30:45 1988
 
-<pause - screen 5>
-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
-<pause - screen 6>
-TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID
-TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL
-TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED
-TA1 - rtems_semaphore_obtain - timeout in 3 seconds
-TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT
-TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE
-TA1 - rtems_semaphore_release - RTEMS_INVALID_ID
-TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL
-TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
-TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER
-TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL
-TA1 - rtems_semaphore_obtain - binary semaphore
-TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE
-TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
-TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED
-TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
-TA1 - rtems_task_delete TA2 - already deleted RTEMS_INVALID_ID
 *** END OF TEST 9 ***
diff --git a/testsuites/sptests/sp09/task1.c b/testsuites/sptests/sp09/task1.c
index 403f36c..82daf64 100644
--- a/testsuites/sptests/sp09/task1.c
+++ b/testsuites/sptests/sp09/task1.c
@@ -35,12 +35,6 @@ rtems_task Task_1(
   rtems_test_pause_and_screen_number( 4 );
 
   Screen4();
-  rtems_test_pause_and_screen_number( 5 );
-
-  Screen5();
-  rtems_test_pause_and_screen_number( 6 );
-
-  Screen6();
   
   puts( "*** END OF TEST 9 ***" );
   rtems_test_exit( 0 );
diff --git a/testsuites/sptests/spsem_err01/Makefile.am b/testsuites/sptests/spsem_err01/Makefile.am
new file mode 100644
index 0000000..dd99edc
--- /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 at .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 0000000..dbf36a1
--- /dev/null
+++ b/testsuites/sptests/spsem_err01/init.c
@@ -0,0 +1,241 @@
+/*
+ *  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)
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+
+  puts( "\n\n*** TEST SEMAPHORE ERROR 01 ***" );
+  
+  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" );
+
+  puts( "*** END TEST SEMAPHORE ERROR 01 ***" );
+}
diff --git a/testsuites/sptests/spsem_err01/spsem_err01.doc b/testsuites/sptests/spsem_err01/spsem_err01.doc
new file mode 100644
index 0000000..a4bd583
--- /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 0000000..00d363d
--- /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 0000000..76426b2
--- /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 */
diff --git a/testsuites/sptests/spsem_err02/Makefile.am b/testsuites/sptests/spsem_err02/Makefile.am
new file mode 100644
index 0000000..fc28cb8
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = spsem_err02
+spsem_err02_SOURCES = init.c task2.c system.h
+
+dist_rtems_tests_DATA = spsem_err02.scn
+dist_rtems_tests_DATA += spsem_err02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spsem_err02_OBJECTS)
+LINK_LIBS = $(spsem_err02_LDLIBS)
+
+spsem_err02$(EXEEXT): $(spsem_err02_OBJECTS) $(spsem_err02_DEPENDENCIES)
+	@rm -f spsem_err02$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spsem_err02/init.c b/testsuites/sptests/spsem_err02/init.c
new file mode 100644
index 0000000..eb1d6ab
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/init.c
@@ -0,0 +1,156 @@
+/*
+ *  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"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+  
+  puts( "\n\n*** TEST SEMAPHORE ERROR 02 ***" );
+   
+  Semaphore_name[ 1 ]  =  rtems_build_name( 'S', 'M', '1', ' ' );
+  Semaphore_name[ 2 ]  =  rtems_build_name( 'S', 'M', '2', ' ' );
+  Task_name[ 2 ]       =  rtems_build_name( 'T', 'A', '2', ' ' );
+
+  status = rtems_task_create(
+    Task_name[ 2 ],
+    1,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Task_id[ 2 ]
+  );
+  directive_failed( status, "rtems_task_create of TA2" );
+  puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
+  
+  puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
+  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+  directive_failed( status, "rtems_task_start of TA2" ); 
+
+  /* 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" );
+
+  status = rtems_semaphore_obtain(
+    100,
+    RTEMS_DEFAULT_OPTIONS,
+    RTEMS_NO_TIMEOUT
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_semaphore_obtain with illegal id"
+  );
+  puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" );
+
+  status = rtems_semaphore_obtain(
+    Semaphore_id[ 1 ],
+    RTEMS_DEFAULT_OPTIONS,
+    RTEMS_NO_TIMEOUT
+  );
+  directive_failed( status, "rtems_semaphore_obtain successful" );
+  puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" );
+
+  status = rtems_semaphore_obtain(
+    Semaphore_id[ 1 ],
+    RTEMS_NO_WAIT,
+    RTEMS_NO_TIMEOUT
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_UNSATISFIED,
+    "rtems_semaphore_obtain not available"
+  );
+  puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" );
+
+  puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" );
+  status = rtems_semaphore_obtain(
+    Semaphore_id[ 1 ],
+    RTEMS_DEFAULT_OPTIONS,
+    3 * rtems_clock_get_ticks_per_second()
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_TIMEOUT,
+    "rtems_semaphore_obtain timeout"
+  );
+  puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" );
+
+  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+  fatal_directive_status(
+    status,
+    RTEMS_NOT_OWNER_OF_RESOURCE,
+    "rtems_semaphore_release and not owner"
+  );
+  puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" );
+
+  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" );
+
+  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  directive_failed( status, "rtems_task_wake_after (yield)" );
+
+  puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" );
+  status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+  directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+  puts( "TA1 - rtems_semaphore_obtain - binary semaphore" );
+  status = rtems_semaphore_obtain(
+    Semaphore_id[ 2 ],
+    RTEMS_DEFAULT_OPTIONS,
+    RTEMS_NO_TIMEOUT
+  );
+  directive_failed( status, "rtems_semaphore_obtain");
+
+  puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" );
+
+  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+  fatal_directive_status(
+     status,
+     RTEMS_RESOURCE_IN_USE,
+     "rtems_semaphore_delete of SM2"
+  );
+
+  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  directive_failed( status, "rtems_task_wake_after (yield)" );
+  
+  puts( "*** END TEST SEMAPHORE ERROR 02 ***" );
+}
diff --git a/testsuites/sptests/spsem_err02/spsem_err02.doc b/testsuites/sptests/spsem_err02/spsem_err02.doc
new file mode 100644
index 0000000..b391479
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/spsem_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:  test9
+
+directives:
+  sm_create, sm_obtain, sm_release, sm_delete
+
+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_err02/spsem_err02.scn b/testsuites/sptests/spsem_err02/spsem_err02.scn
new file mode 100644
index 0000000..56fa2e8
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/spsem_err02.scn
@@ -0,0 +1,20 @@
+*** TEST SEMAPHORE ERROR 02 ***
+TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID
+TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED
+TA1 - rtems_semaphore_obtain - timeout in 3 seconds
+TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER
+TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT
+TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE
+TA1 - rtems_semaphore_release - RTEMS_INVALID_ID
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL
+TA1 - rtems_semaphore_obtain - binary semaphore
+TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED
+*** END TEST SEMAPHORE ERROR 02 ***
diff --git a/testsuites/sptests/spsem_err02/system.h b/testsuites/sptests/spsem_err02/system.h
new file mode 100644
index 0000000..cc48e74
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/system.h
@@ -0,0 +1,54 @@
+/*
+ *  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_task Task_2(
+  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 */
+
+/* end of include file */
diff --git a/testsuites/sptests/spsem_err02/task2.c b/testsuites/sptests/spsem_err02/task2.c
new file mode 100644
index 0000000..e415acf
--- /dev/null
+++ b/testsuites/sptests/spsem_err02/task2.c
@@ -0,0 +1,48 @@
+/*  Task_2
+ *
+ *  This routine serves as a test task.  Its only purpose is to generate the
+ *  error where a semaphore is deleted while a task is waiting for it.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  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_task Task_2(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+
+  puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" );
+  status = rtems_semaphore_obtain(
+    Semaphore_id[ 1 ],
+    RTEMS_DEFAULT_OPTIONS,
+    RTEMS_NO_TIMEOUT
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_OBJECT_WAS_DELETED,
+    "rtems_semaphore_obtain waiting to be deleted"
+  );
+  puts(
+    "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED"
+  );
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/testsuites/sptests/sptask_err01/Makefile.am b/testsuites/sptests/sptask_err01/Makefile.am
new file mode 100644
index 0000000..111891c
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sptask_err01
+sptask_err01_SOURCES = init.c task2.c system.h
+
+dist_rtems_tests_DATA = sptask_err01.scn
+dist_rtems_tests_DATA += sptask_err01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sptask_err01_OBJECTS)
+LINK_LIBS = $(sptask_err01_LDLIBS)
+
+sptask_err01$(EXEEXT): $(sptask_err01_OBJECTS) $(sptask_err01_DEPENDENCIES)
+	@rm -f sptask_err01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sptask_err01/init.c b/testsuites/sptests/sptask_err01/init.c
new file mode 100644
index 0000000..79d2555
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/init.c
@@ -0,0 +1,55 @@
+/*
+ *  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"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+  
+  puts( "\n\n*** TEST TASK ERROR 01 ***" );
+   
+  Task_name[ 2 ]       =  rtems_build_name( 'T', 'A', '2', ' ' );
+
+  status = rtems_task_create(
+    Task_name[ 2 ],
+    1,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Task_id[ 2 ]
+  );
+  directive_failed( status, "rtems_task_create of TA2" );
+  puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
+  
+  puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" );
+  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+  directive_failed( status, "rtems_task_start of TA2" ); 
+  
+  puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" );
+  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  directive_failed( status, "rtems_task_wake_after (yield)" );
+
+  status = rtems_task_delete( Task_id[ 2 ] );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_task_delete after the task has been deleted"
+  );
+  puts( "TA1 - rtems_task_delete TA2 - already deleted RTEMS_INVALID_ID" );
+
+  puts( "*** END TEST TASK ERROR 01 ***" );
+}
diff --git a/testsuites/sptests/sptask_err01/sptask_err01.doc b/testsuites/sptests/sptask_err01/sptask_err01.doc
new file mode 100644
index 0000000..2475cb8
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/sptask_err01.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_err01
+
+directives:
+  t_create, t_delete, t_wkafter
+  
+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_err01/sptask_err01.scn b/testsuites/sptests/sptask_err01/sptask_err01.scn
new file mode 100644
index 0000000..eccf90f
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/sptask_err01.scn
@@ -0,0 +1,7 @@
+*** TEST TASK ERROR 01 ***
+TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL
+TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL
+TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL
+TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL
+TA1 - rtems_task_delete TA2 - already deleted RTEMS_INVALID_ID
+*** END TEST TASK ERROR 01 ***
diff --git a/testsuites/sptests/sptask_err01/system.h b/testsuites/sptests/sptask_err01/system.h
new file mode 100644
index 0000000..6b6ace7
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/system.h
@@ -0,0 +1,51 @@
+/*
+ *  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_task Task_2(
+  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 */
+
+/* end of include file */
diff --git a/testsuites/sptests/sptask_err01/task2.c b/testsuites/sptests/sptask_err01/task2.c
new file mode 100644
index 0000000..c187fa7
--- /dev/null
+++ b/testsuites/sptests/sptask_err01/task2.c
@@ -0,0 +1,34 @@
+/*  Task_2
+ *
+ *  This routine serves as a test task.  Its only purpose is to generate the
+ *  error where a semaphore is deleted while a task is waiting for it.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  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_task Task_2(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+
+  puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of TA2" );
+}
-- 
1.8.1.4




More information about the devel mailing list