Changeset 0f88857 in rtems


Ignore:
Timestamp:
Nov 15, 1999, 9:19:58 PM (20 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
06380cfe
Parents:
cb193710
Message:

+ 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.

Files:
1 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/tests/itrontests/itrontask02/Makefile.in

    rcb193710 r0f88857  
    2020
    2121# C source names, if any, go here -- minus the .c
    22 C_PIECES = init preempt
     22C_PIECES = init dormant
    2323C_FILES = $(C_PIECES:%=%.c)
    2424C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
  • c/src/tests/itrontests/itrontask02/dormant.c

    rcb193710 r0f88857  
    1 /*  Preempt_task
     1/*  Dormant
    22 *
    3  *  This routine serves as a test task.  It verifies the task manager.
     3 *  This routine serves as two test tasks.
     4 *  It has one dormant and one sleeping tasks.
    45 *
    56 *  Input parameters:
     
    1819 *  $Id$
    1920 */
     21
    2022#include <assert.h>
    2123#include "system.h"
    2224
    23 void Preempt_task()
     25void Dormant_task()
    2426{
    25   puts( "PREEMPT - ext_tsk - going to DORMANT state" );
     27  puts( "DORMANT - ext_tsk - going to DORMANT state" );
    2628  ext_tsk( );
    2729
    28   puts( "ext_tsk of RTEMS_PREEMPT" );
     30  puts( "ERROR==>ext_tsk of DORMANT returned" );
    2931  assert(0);
    3032}
     33
     34
     35void Non_Dormant_task()
     36{
     37  ER       status;
     38
     39  while (TRUE) {
     40    puts( "NON-DORMANT - Sleep for 2 minutes" );
     41    status = rtems_task_wake_after( 120*TICKS_PER_SECOND );
     42    directive_failed( status, "rtems_task_wake_after" );
     43  }
     44
     45
  • c/src/tests/itrontests/itrontask02/init.c

    rcb193710 r0f88857  
    8383
    8484  puts( "\n\n*** ITRON TASK TEST 2 ***\n" );
    85   puts( "\n*** Create Task Errors ***" );
    8685
    8786  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
     
    8988  directive_failed( status, "rtems_clock_set" );
    9089
     90
     91  /*
     92   * Set My priority to 8 so that dummy tasks will be
     93   * forced to run when started.
     94   */
     95 
     96  status = chg_pri( TSK_SELF, 8 );
     97  assert( status == E_OK );
     98  status = ref_tsk( &pk_rtsk, TSK_SELF );
     99  assert( status == E_OK );
     100  assert( pk_rtsk.tskpri == 8 );
     101 
     102  /*
     103   * Create and verify a DORMANT task.
     104   */
     105
    91106  pk_ctsk.exinf    = NULL;
    92107  pk_ctsk.tskatr   = TA_HLNG;
    93108  pk_ctsk.itskpri  = 1;
    94   pk_ctsk.task     = Preempt_task;
     109  pk_ctsk.task     = Dormant_task;
    95110  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
    96111
    97   puts( "Init - cre_tsk - Preempt Task" );
    98   status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
    99   assert( status == E_OK );
    100 
     112  puts( "Init - cre_tsk - Dormant Task" );
     113  status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk );
     114  assert( status == E_OK );
     115  status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID );
     116  assert( status == E_OK );
     117  assert( pk_rtsk.tskstat == TTS_DMT );
     118
     119  /*
     120   * Create, Start and verify a not DORMANT task.
     121   */
     122 
     123  pk_ctsk.task     = Non_Dormant_task;
     124  puts( "Init - cre_tsk - Non-Dormant Task" );
     125  status = cre_tsk( NON_DORMANT_TASK_ID, &pk_ctsk );
     126  assert( status == E_OK );
     127  status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
     128  status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID );
     129  assert( status == E_OK );
     130  assert( pk_rtsk.tskstat == TTS_WAI);
     131   
     132 
    101133  /*
    102134   *  Bad ID errors
    103135   */
     136
     137  puts( "\n*** Create Task Errors ***" );
    104138
    105139  puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" );
     
    161195#endif
    162196
    163 
    164197  puts( "\n\n*** Delete Task Errors ***" );
    165198
     
    171204  pk_ctsk.tskatr   = TA_HLNG;
    172205  pk_ctsk.itskpri  = 1;
    173   pk_ctsk.task     = Preempt_task;
     206  pk_ctsk.task     = Dormant_task;
    174207  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
    175208
     
    180213
    181214  puts( "Init - del_tsk - task is not DORMANT - E_OBJ" );
    182   status = del_tsk( PREEMPT_TASK_ID );
     215  status = del_tsk( NON_DORMANT_TASK_ID );
    183216  assert( status == E_OBJ );
    184217
     
    221254
    222255  puts( "Init - sta_tsk - task is not DORMANT  - E_OBJ" );
    223   status = sta_tsk( PREEMPT_TASK_ID, 1 );
     256  status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
    224257  assert( status == E_OBJ );
    225258
     
    261294
    262295  puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" );
    263   status = ter_tsk( PREEMPT_TASK_ID );
     296  status = ter_tsk( DORMANT_TASK_ID );
    264297  assert( status == E_OBJ );
    265298
     
    302335  /*  Need a dormant task to call */
    303336  puts( "Init - chg_pri - task is not DORMANT - E_OBJ" );
    304   status = chg_pri( PREEMPT_TASK_ID, 1 );
     337  status = chg_pri( DORMANT_TASK_ID, 1 );
    305338  assert( status == E_OBJ );
    306339
     
    437470
    438471  puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" );
    439   status = rsm_tsk( PREEMPT_TASK_ID );
     472  status = rsm_tsk( DORMANT_TASK_ID );
    440473  assert( status == E_OBJ );
    441474
     
    466499
    467500  puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" );
    468   status = frsm_tsk( PREEMPT_TASK_ID );
     501  status = frsm_tsk( DORMANT_TASK_ID );
    469502  assert( status == E_OBJ );
    470503
  • c/src/tests/itrontests/itrontask02/system.h

    rcb193710 r0f88857  
    2121
    2222void ITRON_Init( void );
    23 void Preempt_task();
     23void Dormant_task();
     24void Non_Dormant_task();
    2425
    2526/* configuration information */
     
    3233/* global variables */
    3334
    34 #define PREEMPT_TASK_ID         2
     35#define DORMANT_TASK_ID         2
     36#define NON_DORMANT_TASK_ID     3
    3537
    3638TEST_EXTERN rtems_id Global_variable;   /* example global variable     */
  • testsuites/itrontests/itrontask02/init.c

    rcb193710 r0f88857  
    8383
    8484  puts( "\n\n*** ITRON TASK TEST 2 ***\n" );
    85   puts( "\n*** Create Task Errors ***" );
    8685
    8786  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
     
    8988  directive_failed( status, "rtems_clock_set" );
    9089
     90
     91  /*
     92   * Set My priority to 8 so that dummy tasks will be
     93   * forced to run when started.
     94   */
     95 
     96  status = chg_pri( TSK_SELF, 8 );
     97  assert( status == E_OK );
     98  status = ref_tsk( &pk_rtsk, TSK_SELF );
     99  assert( status == E_OK );
     100  assert( pk_rtsk.tskpri == 8 );
     101 
     102  /*
     103   * Create and verify a DORMANT task.
     104   */
     105
    91106  pk_ctsk.exinf    = NULL;
    92107  pk_ctsk.tskatr   = TA_HLNG;
    93108  pk_ctsk.itskpri  = 1;
    94   pk_ctsk.task     = Preempt_task;
     109  pk_ctsk.task     = Dormant_task;
    95110  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
    96111
    97   puts( "Init - cre_tsk - Preempt Task" );
    98   status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
    99   assert( status == E_OK );
    100 
     112  puts( "Init - cre_tsk - Dormant Task" );
     113  status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk );
     114  assert( status == E_OK );
     115  status = ref_tsk( &pk_rtsk, DORMANT_TASK_ID );
     116  assert( status == E_OK );
     117  assert( pk_rtsk.tskstat == TTS_DMT );
     118
     119  /*
     120   * Create, Start and verify a not DORMANT task.
     121   */
     122 
     123  pk_ctsk.task     = Non_Dormant_task;
     124  puts( "Init - cre_tsk - Non-Dormant Task" );
     125  status = cre_tsk( NON_DORMANT_TASK_ID, &pk_ctsk );
     126  assert( status == E_OK );
     127  status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
     128  status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID );
     129  assert( status == E_OK );
     130  assert( pk_rtsk.tskstat == TTS_WAI);
     131   
     132 
    101133  /*
    102134   *  Bad ID errors
    103135   */
     136
     137  puts( "\n*** Create Task Errors ***" );
    104138
    105139  puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" );
     
    161195#endif
    162196
    163 
    164197  puts( "\n\n*** Delete Task Errors ***" );
    165198
     
    171204  pk_ctsk.tskatr   = TA_HLNG;
    172205  pk_ctsk.itskpri  = 1;
    173   pk_ctsk.task     = Preempt_task;
     206  pk_ctsk.task     = Dormant_task;
    174207  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
    175208
     
    180213
    181214  puts( "Init - del_tsk - task is not DORMANT - E_OBJ" );
    182   status = del_tsk( PREEMPT_TASK_ID );
     215  status = del_tsk( NON_DORMANT_TASK_ID );
    183216  assert( status == E_OBJ );
    184217
     
    221254
    222255  puts( "Init - sta_tsk - task is not DORMANT  - E_OBJ" );
    223   status = sta_tsk( PREEMPT_TASK_ID, 1 );
     256  status = sta_tsk( NON_DORMANT_TASK_ID, 1 );
    224257  assert( status == E_OBJ );
    225258
     
    261294
    262295  puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" );
    263   status = ter_tsk( PREEMPT_TASK_ID );
     296  status = ter_tsk( DORMANT_TASK_ID );
    264297  assert( status == E_OBJ );
    265298
     
    302335  /*  Need a dormant task to call */
    303336  puts( "Init - chg_pri - task is not DORMANT - E_OBJ" );
    304   status = chg_pri( PREEMPT_TASK_ID, 1 );
     337  status = chg_pri( DORMANT_TASK_ID, 1 );
    305338  assert( status == E_OBJ );
    306339
     
    437470
    438471  puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" );
    439   status = rsm_tsk( PREEMPT_TASK_ID );
     472  status = rsm_tsk( DORMANT_TASK_ID );
    440473  assert( status == E_OBJ );
    441474
     
    466499
    467500  puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" );
    468   status = frsm_tsk( PREEMPT_TASK_ID );
     501  status = frsm_tsk( DORMANT_TASK_ID );
    469502  assert( status == E_OBJ );
    470503
  • testsuites/itrontests/itrontask02/system.h

    rcb193710 r0f88857  
    2121
    2222void ITRON_Init( void );
    23 void Preempt_task();
     23void Dormant_task();
     24void Non_Dormant_task();
    2425
    2526/* configuration information */
     
    3233/* global variables */
    3334
    34 #define PREEMPT_TASK_ID         2
     35#define DORMANT_TASK_ID         2
     36#define NON_DORMANT_TASK_ID     3
    3537
    3638TEST_EXTERN rtems_id Global_variable;   /* example global variable     */
Note: See TracChangeset for help on using the changeset viewer.