summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp12
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-05-11 17:39:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-05-11 17:39:37 +0000
commitac7d5ef06a6d6e8d84abbd1f0b82162725f98326 (patch)
tree9304cf759a73f2a1c6fd3191948f00e870af3787 /testsuites/sptests/sp12
downloadrtems-ac7d5ef06a6d6e8d84abbd1f0b82162725f98326.tar.bz2
Initial revision
Diffstat (limited to 'testsuites/sptests/sp12')
-rw-r--r--testsuites/sptests/sp12/init.c176
-rw-r--r--testsuites/sptests/sp12/pridrv.c131
-rw-r--r--testsuites/sptests/sp12/pritask.c91
-rw-r--r--testsuites/sptests/sp12/sp12.doc27
-rw-r--r--testsuites/sptests/sp12/sp12.scn78
-rw-r--r--testsuites/sptests/sp12/system.h30
-rw-r--r--testsuites/sptests/sp12/task1.c153
-rw-r--r--testsuites/sptests/sp12/task2.c65
-rw-r--r--testsuites/sptests/sp12/task3.c50
-rw-r--r--testsuites/sptests/sp12/task4.c37
-rw-r--r--testsuites/sptests/sp12/task5.c55
11 files changed, 893 insertions, 0 deletions
diff --git a/testsuites/sptests/sp12/init.c b/testsuites/sptests/sp12/init.c
new file mode 100644
index 0000000000..dd702ca75e
--- /dev/null
+++ b/testsuites/sptests/sp12/init.c
@@ -0,0 +1,176 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#undef EXTERN
+#define EXTERN
+#include "conftbl.h"
+#include "gvar.h"
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "\n\n*** TEST 12 ***" );
+
+ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+ Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+ Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
+ Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
+ Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
+
+ Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
+ Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
+ Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
+ Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
+ Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
+
+ 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', ' ' );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 1 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Semaphore_id[ 1 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM1" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 3 ],
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Semaphore_id[ 3 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of SM3" );
+
+ puts( "INIT - Forward priority queue test" );
+ Priority_test_driver( 0 );
+
+ puts( "INIT - Backward priority queue test" );
+ Priority_test_driver( 32 );
+
+pause();
+
+ puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 1,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
+
+ Priority_test_driver( 64 );
+
+pause();
+
+ status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM2" );
+
+ status = rtems_semaphore_create(
+ Semaphore_name[ 2 ],
+ 0,
+ RTEMS_PRIORITY,
+ &Semaphore_id[ 2 ]
+ );
+ directive_failed( status, "rtems_semaphore_create of priority SM2" );
+
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 1 ]
+ );
+ directive_failed( status, "rtems_task_create of TA1" );
+
+ status = rtems_task_create(
+ Task_name[ 2 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 2 ]
+ );
+ directive_failed( status, "rtems_task_create of TA2" );
+
+ status = rtems_task_create(
+ Task_name[ 3 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 3 ]
+ );
+ directive_failed( status, "rtems_task_create of TA3" );
+
+ status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+ directive_failed( status, "rtems_task_start of TA1" );
+
+ status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
+ directive_failed( status, "rtems_task_start of TA2" );
+
+ status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
+ directive_failed( status, "rtems_task_start of TA3" );
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
diff --git a/testsuites/sptests/sp12/pridrv.c b/testsuites/sptests/sp12/pridrv.c
new file mode 100644
index 0000000000..7174faf784
--- /dev/null
+++ b/testsuites/sptests/sp12/pridrv.c
@@ -0,0 +1,131 @@
+/* Priority_test_driver
+ *
+ * This routine is the initialization task for this test program.
+ * It is a user initialization task and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters:
+ * priority_base - priority_base switch
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+void Priority_test_driver(
+ rtems_unsigned32 priority_base
+)
+{
+ rtems_task_priority previous_priority;
+ rtems_unsigned32 index;
+ rtems_status_code status;
+
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ switch ( index ) {
+ case 1:
+ case 2:
+ case 3:
+ Task_priority[ index ] = priority_base + index;
+ break;
+ default:
+ Task_priority[ index ] = priority_base + 3;
+ break;
+ }
+
+ status = rtems_task_create(
+ Priority_task_name[ index ],
+ Task_priority[ index ],
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Priority_task_id[ index ]
+ );
+ directive_failed( status, "rtems_task_create loop" );
+
+ }
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+ }
+ } else {
+ for ( index = 5 ; index >= 1 ; index-- ) {
+ status = rtems_task_start(
+ Priority_task_id[ index ],
+ Priority_task,
+ index
+ );
+ directive_failed( status, "rtems_task_start loop" );
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after loop" );
+
+ if ( priority_base == 64 ) {
+ if ( index == 4 ) {
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ priority_base + 4,
+ &previous_priority
+ );
+ printf( "PDRV - change priority of PRI5 from %d to %d\n",
+ previous_priority,
+ priority_base + 4
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority" );
+ }
+ status = rtems_task_set_priority(
+ Priority_task_id[ 5 ],
+ RTEMS_CURRENT_PRIORITY,
+ &previous_priority
+ );
+ directive_failed( status, "PDRV rtems_task_set_priority CURRENT" );
+ printf( "PDRV - priority of PRI5 is %d\n", previous_priority );
+ }
+ }
+ }
+
+ status = rtems_task_wake_after( TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after after loop" );
+
+ if ( priority_base == 0 ) {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release loop" );
+ }
+ }
+
+ if ( priority_base == 64 ) {
+ puts( "PDRV - rtems_task_resume - PRI5" );
+ status = rtems_task_resume( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_resume" );
+
+ status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after so PRI5 can run" );
+
+ status = rtems_task_delete( Priority_task_id[ 5 ] );
+ directive_failed( status, "rtems_task_delete of PRI5" );
+ }
+ else {
+ for ( index = 1 ; index <= 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+ }
+}
diff --git a/testsuites/sptests/sp12/pritask.c b/testsuites/sptests/sp12/pritask.c
new file mode 100644
index 0000000000..155ef345cd
--- /dev/null
+++ b/testsuites/sptests/sp12/pritask.c
@@ -0,0 +1,91 @@
+/* Priority_task
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * its_index - priority index
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Priority_task(
+ rtems_task_argument its_index
+)
+{
+ rtems_interval timeout;
+ rtems_task_priority its_priority;
+ rtems_task_priority current_priority;
+ rtems_status_code status;
+ rtems_unsigned32 index;
+
+ its_priority = Task_priority[ its_index ];
+
+ if ( its_priority < 3 )
+ timeout = 5 * TICKS_PER_SECOND;
+ else
+ timeout = RTEMS_NO_TIMEOUT;
+
+ put_name( Priority_task_name[ its_index ], FALSE );
+ puts( " - rtems_semaphore_obtain - wait forever on SM2" );
+
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+
+ if ( its_priority < 64 ) {
+ printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority );
+ exit( 0 );
+ }
+
+ if ( its_index == 5 )
+ puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" );
+ status = rtems_task_suspend( RTEMS_SELF );
+ directive_failed( status, "rtems_task_suspend" );
+
+ puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" );
+ for ( index = 1 ; index < 5 ; index++ ) {
+ status = rtems_task_delete( Priority_task_id[ index ] );
+ directive_failed( status, "rtems_task_delete loop" );
+ }
+
+ puts( "PRI5 - rtems_semaphore_obtain - nested" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ timeout
+ );
+ directive_failed( status, "rtems_semaphore_obtain nested" );
+
+ puts( "PRI5 - rtems_semaphore_release - nested" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release nested " );
+
+ puts( "PRI5 - rtems_semaphore_release - restore priority" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release" );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &current_priority
+ );
+ directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" );
+ printf( "PRI5 - priority of PRI5 is %d\n", current_priority );
+
+ (void) rtems_task_suspend( RTEMS_SELF );
+}
diff --git a/testsuites/sptests/sp12/sp12.doc b/testsuites/sptests/sp12/sp12.doc
new file mode 100644
index 0000000000..fc19d92ed7
--- /dev/null
+++ b/testsuites/sptests/sp12/sp12.doc
@@ -0,0 +1,27 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+# On-Line Applications Research Corporation (OAR).
+# All rights assigned to U.S. Government, 1994.
+#
+# This material may be reproduced by or for the U.S. Government pursuant
+# to the copyright license under the clause at DFARS 252.227-7013. This
+# notice must appear in all copies of this file and its derivatives.
+#
+
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: test12
+
+directives:
+ ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return,
+ sm_create, sm_ident, sm_delete, sm_p, sm_v, tm_wkafter, t_setpri
+
+concepts:
+
+ a. This test checks out the semaphore manager.
+
+ b. This test forces _Flush_taskq() to unblock a task waiting
+ on a deleted object.
diff --git a/testsuites/sptests/sp12/sp12.scn b/testsuites/sptests/sp12/sp12.scn
new file mode 100644
index 0000000000..82ceca3c6e
--- /dev/null
+++ b/testsuites/sptests/sp12/sp12.scn
@@ -0,0 +1,78 @@
+*** TEST 12 ***
+INIT - Forward priority queue test
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+INIT - Backward priority queue test
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+INIT - Binary Semaphore and Priority Inheritance Test
+INIT - rtems_semaphore_create - allocated binary semaphore
+INIT - rtems_semaphore_release - allocated binary semaphore
+INIT - rtems_semaphore_delete - allocated binary semaphore
+PRI5 - rtems_semaphore_obtain - wait forever on SM2
+PRI5 - rtems_task_suspend - until all priority tasks blocked
+PDRV - priority of PRI5 is 67
+PRI4 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - change priority of PRI5 from 67 to 68
+PDRV - priority of PRI5 is 67
+PRI3 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 67
+PRI2 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 66
+PRI1 - rtems_semaphore_obtain - wait forever on SM2
+PDRV - priority of PRI5 is 65
+PDRV - rtems_task_resume - PRI5
+PRI5 - rtems_task_delete - all tasks waiting on SM2
+PRI5 - rtems_semaphore_obtain - nested
+PRI5 - rtems_semaphore_release - nested
+PRI5 - rtems_semaphore_release - restore priority
+PRI5 - priority of PRI5 is 68
+<pause>
+TA1 - rtems_semaphore_ident - smid => 00010001
+TA1 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM2
+TA1 - rtems_semaphore_obtain - wait forever on SM3
+TA1 - got SM3
+TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT
+TA1 - got SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA2 - rtems_semaphore_obtain - wait forever on SM1
+TA3 - rtems_semaphore_obtain - wait forever on SM2
+<pause>
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout
+TA2 - got SM1
+TA2 - rtems_semaphore_release - release SM1
+TA2 - rtems_task_set_priority - make self highest priority task
+TA2 - rtems_semaphore_obtain - wait forever on SM2
+TA1 - got SM1
+TA1 - rtems_semaphore_release - release SM2
+TA2 - got SM2
+TA2 - rtems_semaphore_release - release SM2
+TA2 - rtems_task_delete - delete self
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA3 - got SM2
+TA3 - rtems_semaphore_release - release SM2
+TA3 - rtems_semaphore_obtain - wait forever on SM3
+<pause>
+TA1 - rtems_task_delete - delete TA3
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA4 - rtems_semaphore_obtain - wait forever on SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_task_delete - delete TA4
+TA1 - rtems_semaphore_release - release SM1
+TA1 - rtems_task_wake_after - sleep 5 seconds
+TA5 - got SM1
+TA5 - rtems_semaphore_obtain - wait forever on SM1
+TA1 - rtems_semaphore_delete - delete SM1
+TA1 - rtems_semaphore_delete - delete SM3
+TA1 - rtems_task_delete - delete self
+TA5 - SM1 deleted by TA1
+*** END OF TEST 12 ***
diff --git a/testsuites/sptests/sp12/system.h b/testsuites/sptests/sp12/system.h
new file mode 100644
index 0000000000..aa2c6d17e4
--- /dev/null
+++ b/testsuites/sptests/sp12/system.h
@@ -0,0 +1,30 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include "tmacros.h"
+
+/* Miscellaneous */
+
+#define EXTERN extern /* external definition */
+
+/* macros */
+
+/* structures */
+
+#include "gvar.h"
+
+/* end of include file */
diff --git a/testsuites/sptests/sp12/task1.c b/testsuites/sptests/sp12/task1.c
new file mode 100644
index 0000000000..d3d7f3ed15
--- /dev/null
+++ b/testsuites/sptests/sp12/task1.c
@@ -0,0 +1,153 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the semaphore manager.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ rtems_id smid;
+ rtems_status_code status;
+
+ status = rtems_semaphore_ident(
+ Semaphore_name[ 1 ],
+ RTEMS_SEARCH_ALL_NODES,
+ &smid
+ );
+ printf( "TA1 - rtems_semaphore_ident - smid => %08x\n", smid );
+ directive_failed( status, "rtems_semaphore_ident of SM1" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM2" );
+ puts( "TA1 - got SM2" );
+
+ puts( "TA1 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM3" );
+ puts( "TA1 - got SM3" );
+
+ puts( "TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_NO_WAIT,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+pause();
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release of SM1" );
+
+ puts(
+ "TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout"
+ );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ 10 * TICKS_PER_SECOND
+ );
+ directive_failed( status, "rtems_semaphore_obtain of SM1" );
+ puts( "TA1 - got SM1" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release of SM2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+pause();
+
+ puts( "TA1 - rtems_task_delete - delete TA3" );
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 4 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 4 ]
+ );
+ directive_failed( status, "rtems_task_create of TA4" );
+
+ status = rtems_task_create(
+ Task_name[ 5 ],
+ 4,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id[ 5 ]
+ );
+ directive_failed( status, "rtems_task_create of TA5" );
+
+ status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
+ directive_failed( status, "rtems_task_start of TA4" );
+
+ status = rtems_task_start( Task_id[ 5 ], Task5, 0 );
+ directive_failed( status, "rtems_task_start of TA5" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_task_delete - delete TA4" );
+ status = rtems_task_delete( Task_id[ 4 ] );
+ directive_failed( status, "rtems_task_delete of TA4" );
+
+ puts( "TA1 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM1" );
+ status = rtems_semaphore_delete( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM1" );
+
+ puts( "TA1 - rtems_semaphore_delete - delete SM3" );
+ status = rtems_semaphore_delete( Semaphore_id[ 3 ] );
+ directive_failed( status, "rtems_semaphore_delete of SM3" );
+
+ puts( "TA1 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA1" );
+}
diff --git a/testsuites/sptests/sp12/task2.c b/testsuites/sptests/sp12/task2.c
new file mode 100644
index 0000000000..41d6735162
--- /dev/null
+++ b/testsuites/sptests/sp12/task2.c
@@ -0,0 +1,65 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It simply obtains semaphores
+ * 1 and 2, the later when it is a high priority task.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+
+#include "system.h"
+
+rtems_task Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_task_priority previous_priority;
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM1" );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM1" );
+ status = rtems_semaphore_release( Semaphore_id[ 1 ] );
+ directive_failed( status, "rtems_semaphore_release on SM1" );
+
+ puts( "TA2 - rtems_task_set_priority - make self highest priority task" );
+ status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority on TA2" );
+
+ puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ puts( "TA2 - got SM2" );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+
+ puts( "TA2 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA2 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA2" );
+}
diff --git a/testsuites/sptests/sp12/task3.c b/testsuites/sptests/sp12/task3.c
new file mode 100644
index 0000000000..7340b84ce6
--- /dev/null
+++ b/testsuites/sptests/sp12/task3.c
@@ -0,0 +1,50 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply obtains semaphore
+ * 2 and waits forever attempting to obtain semaphore 3.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_3(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM2" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 2 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM2" );
+ puts( "TA3 - got SM2" );
+
+ puts( "TA3 - rtems_semaphore_release - release SM2" );
+ status = rtems_semaphore_release( Semaphore_id[ 2 ] );
+ directive_failed( status, "rtems_semaphore_release on SM2" );
+
+ puts( "TA3 - rtems_semaphore_obtain - wait forever on SM3" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 3 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM3" );
+}
diff --git a/testsuites/sptests/sp12/task4.c b/testsuites/sptests/sp12/task4.c
new file mode 100644
index 0000000000..9a0e952613
--- /dev/null
+++ b/testsuites/sptests/sp12/task4.c
@@ -0,0 +1,37 @@
+/* Task_4
+ *
+ * This routine serves as a test task. It waits forever attempting
+ * to obtain semaphore 1. However, it should never get the semaphore!
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_4(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA4 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+}
diff --git a/testsuites/sptests/sp12/task5.c b/testsuites/sptests/sp12/task5.c
new file mode 100644
index 0000000000..ccf10cd11a
--- /dev/null
+++ b/testsuites/sptests/sp12/task5.c
@@ -0,0 +1,55 @@
+/* Task5
+ *
+ * This routine serves as a test task. It obtains semaphore 1 correctly
+ * once, then waits for semaphore 1 again. Task 1 should delete the
+ * semaphore, thus waking this task up.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task5(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ directive_failed( status, "rtems_semaphore_obtain on SM1" );
+ puts( "TA5 - got SM1" );
+
+ puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
+ status = rtems_semaphore_obtain(
+ Semaphore_id[ 1 ],
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT
+ );
+ fatal_directive_status(
+ status,
+ RTEMS_OBJECT_WAS_DELETED,
+ "rtems_semaphore_obtain on SM1"
+ );
+ puts( "TA5 - SM1 deleted by TA1" );
+
+ puts( "*** END OF TEST 12 ***" );
+ exit( 0 );
+}