summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp02
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/sp02
downloadrtems-ac7d5ef06a6d6e8d84abbd1f0b82162725f98326.tar.bz2
Initial revision
Diffstat (limited to 'testsuites/sptests/sp02')
-rw-r--r--testsuites/sptests/sp02/init.c155
-rw-r--r--testsuites/sptests/sp02/preempt.c32
-rw-r--r--testsuites/sptests/sp02/sp02.doc37
-rw-r--r--testsuites/sptests/sp02/sp02.scn15
-rw-r--r--testsuites/sptests/sp02/system.h31
-rw-r--r--testsuites/sptests/sp02/task1.c66
-rw-r--r--testsuites/sptests/sp02/task2.c34
-rw-r--r--testsuites/sptests/sp02/task3.c37
8 files changed, 407 insertions, 0 deletions
diff --git a/testsuites/sptests/sp02/init.c b/testsuites/sptests/sp02/init.c
new file mode 100644
index 0000000000..b3ada92914
--- /dev/null
+++ b/testsuites/sptests/sp02/init.c
@@ -0,0 +1,155 @@
+/* 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 2 ***" );
+
+ Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' );
+
+ status = rtems_task_create(
+ Preempt_task_name,
+ 1,
+ 2048,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Preempt_task_id
+ );
+ directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
+
+ status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
+ directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
+
+ puts( "INIT - rtems_task_wake_after - yielding processor" );
+ status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ 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', ' ' );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 3,
+ 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 ],
+ 3,
+ 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 ],
+ 3,
+ 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" );
+
+ puts( "INIT - suspending TA2 while middle task on a ready chain" );
+ status = rtems_task_suspend( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ status = rtems_task_delete( Task_id[ 1 ] );
+ directive_failed( status, "rtems_task_delete of TA1" );
+
+ status = rtems_task_delete( Task_id[ 2 ] );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ status = rtems_task_delete( Task_id[ 3 ] );
+ directive_failed( status, "rtems_task_delete of TA3" );
+
+ status = rtems_task_create(
+ Task_name[ 1 ],
+ 1,
+ 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 ],
+ 3,
+ 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 ],
+ 3,
+ 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/sp02/preempt.c b/testsuites/sptests/sp02/preempt.c
new file mode 100644
index 0000000000..7e93f7af57
--- /dev/null
+++ b/testsuites/sptests/sp02/preempt.c
@@ -0,0 +1,32 @@
+/* Preempt_task
+ *
+ * This routine serves as a test task. It verifies the task 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 Preempt_task(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "PREEMPT - rtems_task_delete - deleting self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_PREEMPT" );
+}
diff --git a/testsuites/sptests/sp02/sp02.doc b/testsuites/sptests/sp02/sp02.doc
new file mode 100644
index 0000000000..00f2e0e7b3
--- /dev/null
+++ b/testsuites/sptests/sp02/sp02.doc
@@ -0,0 +1,37 @@
+#
+# $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: test2
+
+directives:
+ ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
+ t_delete, tm_wkafter, t_setpri, t_suspend
+
+concepts:
+
+ a. Verifies that a task can delete another task and also delete itself.
+
+ b. Verifies that memory is freed back to the heap correctly.
+
+ c. Verifies that TCBs are freed back to the inactive chain correctly.
+
+ d. Verifies that a task can get the task identification number of
+ another task.
+
+ e. Verifies the _Set_state routine where the task is not READY.
+
+ f. Verifies the break statement in the _Block_activate routine.
+
+ g. Verifies the while loop in the _Prev_tcb routine.
diff --git a/testsuites/sptests/sp02/sp02.scn b/testsuites/sptests/sp02/sp02.scn
new file mode 100644
index 0000000000..57a4627284
--- /dev/null
+++ b/testsuites/sptests/sp02/sp02.scn
@@ -0,0 +1,15 @@
+*** TEST 2 ***
+INIT - rtems_task_wake_after - yielding processor
+PREEMPT - rtems_task_delete - deleting self
+INIT - suspending TA2 while middle task on a ready chain
+TA1 - rtems_task_wake_after - sleep 1 second
+TA2 - rtems_task_wake_after - sleep 1 minute
+TA3 - rtems_task_wake_after - sleep 5 seconds
+TA1 - rtems_task_ident - tid of TA2 (0x00010007)
+TA1 - rtems_task_ident - tid of TA3 (0x00010008)
+TA1 - rtems_task_set_priority - set TA3's priority to 2
+TA1 - rtems_task_suspend - suspend TA2
+TA1 - rtems_task_delete - delete TA2
+TA1 - rtems_task_wake_after - sleep for 5 seconds
+TA3 - rtems_task_delete - delete self
+*** END OF TEST 2 ***
diff --git a/testsuites/sptests/sp02/system.h b/testsuites/sptests/sp02/system.h
new file mode 100644
index 0000000000..c9d89a1e8b
--- /dev/null
+++ b/testsuites/sptests/sp02/system.h
@@ -0,0 +1,31 @@
+/* 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/sp02/task1.c b/testsuites/sptests/sp02/task1.c
new file mode 100644
index 0000000000..0f6152dbb2
--- /dev/null
+++ b/testsuites/sptests/sp02/task1.c
@@ -0,0 +1,66 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the task 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 tid2;
+ rtems_id tid3;
+ rtems_status_code status;
+ rtems_unsigned32 previous_priority;
+
+ puts( "TA1 - rtems_task_wake_after - sleep 1 second" );
+ status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 );
+ directive_failed( status, "rtems_task_ident of TA2" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA2 (0x%.8x)\n", tid2 );
+
+ status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 );
+ directive_failed( status, "rtems_task_ident of TA3" );
+
+ printf( "TA1 - rtems_task_ident - tid of TA3 (0x%.8x)\n", tid3 );
+
+ status = rtems_task_set_priority( tid3, 2, &previous_priority );
+ directive_failed( status, "rtems_task_set_priority" );
+
+ puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" );
+
+
+ puts( "TA1 - rtems_task_suspend - suspend TA2" );
+ status = rtems_task_suspend( tid2 );
+ directive_failed( status, "rtems_task_suspend of TA2" );
+
+ puts( "TA1 - rtems_task_delete - delete TA2" );
+ status = rtems_task_delete( tid2 );
+ directive_failed( status, "rtems_task_delete of TA2" );
+
+ puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ puts( "*** END OF TEST 2 ***" );
+ exit( 0 );
+}
diff --git a/testsuites/sptests/sp02/task2.c b/testsuites/sptests/sp02/task2.c
new file mode 100644
index 0000000000..f39cc5b9fc
--- /dev/null
+++ b/testsuites/sptests/sp02/task2.c
@@ -0,0 +1,34 @@
+/* Task_2
+ *
+ * This routine serves as a test task. It sleeps for 1 minute but
+ * does not expect to wake up. Task 1 should suspend then delete it
+ * so that it appears to never wake 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 Task_2(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+
+ puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
+ status = rtems_task_wake_after( 60*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA2" );
+}
diff --git a/testsuites/sptests/sp02/task3.c b/testsuites/sptests/sp02/task3.c
new file mode 100644
index 0000000000..89bda38b7c
--- /dev/null
+++ b/testsuites/sptests/sp02/task3.c
@@ -0,0 +1,37 @@
+/* Task_3
+ *
+ * This routine serves as a test task. It simply sleeps for 5 seconds
+ * and then deletes itself.
+ *
+ * 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_task_wake_after - sleep 5 seconds" );
+ status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after in TA3" );
+
+ puts( "TA3 - rtems_task_delete - delete self" );
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of TA3" );
+}