summaryrefslogtreecommitdiffstats
path: root/testsuites/itrontests
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>1999-11-15 21:19:58 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>1999-11-15 21:19:58 +0000
commit0f88857a3a0793cb494a40cc61954e2f01ef0ef8 (patch)
tree5f0078a5e83cd304ebd5b4930ea0b9817d34f4c3 /testsuites/itrontests
parentAdded paragraph describing SUSP. (diff)
downloadrtems-0f88857a3a0793cb494a40cc61954e2f01ef0ef8.tar.bz2
+ Changed preempt routine into two dummy tasks one that is in dormant
state and one that is in non-dormant state. + Increased the priority of the Init task to force the dummy tasks to run first. + Added calls to ref_tsk to verify the state of the dummy tasks and test ref_tsk.
Diffstat (limited to 'testsuites/itrontests')
-rw-r--r--testsuites/itrontests/itrontask02/dormant.c45
-rw-r--r--testsuites/itrontests/itrontask02/init.c57
-rw-r--r--testsuites/itrontests/itrontask02/system.h6
3 files changed, 94 insertions, 14 deletions
diff --git a/testsuites/itrontests/itrontask02/dormant.c b/testsuites/itrontests/itrontask02/dormant.c
new file mode 100644
index 0000000000..4dbdd616a5
--- /dev/null
+++ b/testsuites/itrontests/itrontask02/dormant.c
@@ -0,0 +1,45 @@
+/* Dormant
+ *
+ * This routine serves as two test tasks.
+ * It has one dormant and one sleeping tasks.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <assert.h>
+#include "system.h"
+
+void Dormant_task()
+{
+ puts( "DORMANT - ext_tsk - going to DORMANT state" );
+ ext_tsk( );
+
+ puts( "ERROR==>ext_tsk of DORMANT returned" );
+ assert(0);
+}
+
+
+void Non_Dormant_task()
+{
+ ER status;
+
+ while (TRUE) {
+ puts( "NON-DORMANT - Sleep for 2 minutes" );
+ status = rtems_task_wake_after( 120*TICKS_PER_SECOND );
+ directive_failed( status, "rtems_task_wake_after" );
+ }
+}
+
diff --git a/testsuites/itrontests/itrontask02/init.c b/testsuites/itrontests/itrontask02/init.c
index a297fe6326..c3fbe7ae62 100644
--- a/testsuites/itrontests/itrontask02/init.c
+++ b/testsuites/itrontests/itrontask02/init.c
@@ -82,26 +82,60 @@ void ITRON_Init( void )
puts( "\n\n*** ITRON TASK TEST 2 ***\n" );
- puts( "\n*** Create Task Errors ***" );
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
+
+ /*
+ * Set My priority to 8 so that dummy tasks will be
+ * forced to run when started.
+ */
+
+ status = chg_pri( TSK_SELF, 8 );
+ assert( status == E_OK );
+ status = ref_tsk( &pk_rtsk, TSK_SELF );
+ assert( status == E_OK );
+ assert( pk_rtsk.tskpri == 8 );
+
+ /*
+ * Create and verify a DORMANT task.
+ */
+
pk_ctsk.exinf = NULL;
pk_ctsk.tskatr = TA_HLNG;
pk_ctsk.itskpri = 1;
- pk_ctsk.task = Preempt_task;
+ pk_ctsk.task = Dormant_task;
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
- puts( "Init - cre_tsk - Preempt Task" );
- status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
+ puts( "Init - cre_tsk - Dormant Task" );
+ status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk );
+ assert( status == E_OK );
+ status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID );
assert( status == E_OK );
+ assert( pk_rtsk.tskstat == TTS_DMT );
/*
+ * Create, Start and verify a not DORMANT task.
+ */
+
+ pk_ctsk.task = Non_Dormant_task;
+ puts( "Init - cre_tsk - Non-Dormant Task" );
+ status = cre_tsk( NON_DORMANT_TASK_ID, &pk_ctsk );
+ assert( status == E_OK );
+ status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
+ status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID );
+ assert( status == E_OK );
+ assert( pk_rtsk.tskstat == TTS_WAI);
+
+
+ /*
* Bad ID errors
*/
+ puts( "\n*** Create Task Errors ***" );
+
puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" );
status = cre_tsk( -5, &pk_ctsk );
assert( status == E_OACV );
@@ -160,7 +194,6 @@ void ITRON_Init( void )
assert( status == EN_PAR );
#endif
-
puts( "\n\n*** Delete Task Errors ***" );
/*
@@ -170,7 +203,7 @@ void ITRON_Init( void )
pk_ctsk.exinf = NULL;
pk_ctsk.tskatr = TA_HLNG;
pk_ctsk.itskpri = 1;
- pk_ctsk.task = Preempt_task;
+ pk_ctsk.task = Dormant_task;
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
@@ -179,7 +212,7 @@ void ITRON_Init( void )
assert( status == E_OBJ );
puts( "Init - del_tsk - task is not DORMANT - E_OBJ" );
- status = del_tsk( PREEMPT_TASK_ID );
+ status = del_tsk( NON_DORMANT_TASK_ID );
assert( status == E_OBJ );
puts( "Init - del_tsk - task does not exist - E_NOEXS" );
@@ -220,7 +253,7 @@ void ITRON_Init( void )
assert( status == E_OBJ );
puts( "Init - sta_tsk - task is not DORMANT - E_OBJ" );
- status = sta_tsk( PREEMPT_TASK_ID, 1 );
+ status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
assert( status == E_OBJ );
puts( "Init - sta_tsk - task does not exist - E_NOEXS" );
@@ -260,7 +293,7 @@ void ITRON_Init( void )
assert( status == E_OBJ );
puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" );
- status = ter_tsk( PREEMPT_TASK_ID );
+ status = ter_tsk( DORMANT_TASK_ID );
assert( status == E_OBJ );
puts( "Init - ter_tsk - task does not exist - E_NOEXS" );
@@ -301,7 +334,7 @@ void ITRON_Init( void )
/* Need a dormant task to call */
puts( "Init - chg_pri - task is not DORMANT - E_OBJ" );
- status = chg_pri( PREEMPT_TASK_ID, 1 );
+ status = chg_pri( DORMANT_TASK_ID, 1 );
assert( status == E_OBJ );
puts( "Init - chg_pri - task does not exist - E_NOEXS" );
@@ -436,7 +469,7 @@ void ITRON_Init( void )
assert( status == E_OBJ );
puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" );
- status = rsm_tsk( PREEMPT_TASK_ID );
+ status = rsm_tsk( DORMANT_TASK_ID );
assert( status == E_OBJ );
puts( "Init - rsm_tsk - task does not exist - E_NOEXS" );
@@ -465,7 +498,7 @@ void ITRON_Init( void )
assert( status == E_OBJ );
puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" );
- status = frsm_tsk( PREEMPT_TASK_ID );
+ status = frsm_tsk( DORMANT_TASK_ID );
assert( status == E_OBJ );
puts( "Init - frsm_tsk - task does not exist - E_NOEXS" );
diff --git a/testsuites/itrontests/itrontask02/system.h b/testsuites/itrontests/itrontask02/system.h
index daad15c340..f9358a9517 100644
--- a/testsuites/itrontests/itrontask02/system.h
+++ b/testsuites/itrontests/itrontask02/system.h
@@ -20,7 +20,8 @@
/* functions */
void ITRON_Init( void );
-void Preempt_task();
+void Dormant_task();
+void Non_Dormant_task();
/* configuration information */
@@ -31,7 +32,8 @@ void Preempt_task();
/* global variables */
-#define PREEMPT_TASK_ID 2
+#define DORMANT_TASK_ID 2
+#define NON_DORMANT_TASK_ID 3
TEST_EXTERN rtems_id Global_variable; /* example global variable */