Changeset 06380cfe in rtems


Ignore:
Timestamp:
11/15/99 21:25:53 (24 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
e672263
Parents:
0f88857
Message:

+ Added check that a task could be sent to a dormant state

then sta_tsk used to restart the task to its initial state.

+ Added calls to ref_tsk to yellow paths for suspended and

ready but not running tasks.

+ Fixed output file to correctly state test name
+ Added priority of preempt to the header file. Allows ref_tsk verification.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/itrontests/itrontask03/init.c

    r0f88857 r06380cfe  
    1  /*  Init
     1/*  Init
    22 *
    33 *  This routine is the initialization task for this test program.
     
    2121#include "system.h"
    2222#include <stdio.h>
     23#include <assert.h>
    2324
    2425void ITRON_Init( void )
     
    2627  ER                status;
    2728  T_CTSK            pk_ctsk;
    28 
    29   puts( "\n\n*** ITRON TASK TEST 3 ***" );
     29  T_RTSK            pk_rtsk;
    3030
    3131  pk_ctsk.exinf    = NULL;
    3232  pk_ctsk.tskatr   = TA_HLNG;
    3333  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
     34  pk_ctsk.itskpri  = PREEMPT_PRIORITY;
     35  pk_ctsk.task     = Preempt_task;
    3436
    35   pk_ctsk.itskpri  = 1;
    36   pk_ctsk.task     = Preempt_task;
     37  puts( "\n\n*** ITRON TASK TEST 3 ***" );
     38
     39  /*
     40   *  Create and start the Preempt task the first time.
     41   *  Verify that it is dormant when it comes back.
     42   */
     43
     44  puts( "INIT - Create and Start PREEMPT" );
     45  status = chg_pri( TSK_SELF, (PREEMPT_PRIORITY+2) );
     46  directive_failed( status, "chg_pri of SELF" );
     47 
    3748  status = cre_tsk(  PREEMPT_TASK_ID, &pk_ctsk );
    3849  directive_failed( status, "cre_tsk of RTEMS_PREEMPT" );
     50
    3951  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
    4052  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
     53  puts( "INIT - rot_rdq - no tasks at this priority" );
     54  status = rot_rdq( 1 );
     55  directive_failed( status, "rot_rdq" );
    4156
     57  puts( "INIT - ref_tsk PREEMPT - Validate DORMANT STATE" );
     58  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     59  directive_failed( status, "INIT - ref_tsk of RTEMS_PREEMPT");
     60  assert( pk_rtsk.tskstat == TTS_DMT );
     61 
     62  /*
     63   * Restart the Preempt Task.
     64   */
     65
     66  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
     67  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
    4268  puts( "INIT - rot_rdq - yielding processor" );
    4369  status = rot_rdq( 1 );
    4470  directive_failed( status, "rot_rdq" );
     71  puts( "INIT - ref_tsk PREEMPT - Validate no longer exists" );
     72  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     73  assert( status == E_NOEXS );
    4574
     75  status = chg_pri( TSK_SELF, PREEMPT_PRIORITY );
     76  directive_failed( status, "chg_pri of SELF" );
     77 
     78  /*
     79   * XXX
     80   */
     81       
    4682  pk_ctsk.itskpri  = 3;
    4783  pk_ctsk.task     = Task_1;
     
    6399  status  = sta_tsk( TA3_ID, 0 );
    64100  directive_failed( status, "sta_tsk of TA3" );
     101  puts( "INIT - ref_tsk TA1 - Validate READY STATE" );
     102  status = ref_tsk( &pk_rtsk, TA1_ID);
     103  directive_failed( status, "INIT - ref_tsk of TA1");
     104  assert( pk_rtsk.tskstat == TTS_RDY );
    65105
    66106  puts( "INIT - suspending TA2 while middle task on a ready chain" );
    67107  status = sus_tsk( TA2_ID  );
    68108  directive_failed( status, "sus_tsk of TA2" );
     109  status = ref_tsk( &pk_rtsk, TA2_ID);
     110  directive_failed( status, "INIT - ref_tsk of TA2");
     111  assert( pk_rtsk.tskstat == TTS_SUS );
    69112
    70113  status = ter_tsk( TA1_ID );
     
    90133 
    91134  exd_tsk();
    92   directive_failed( 0, "exd_tsk" );
     135  assert(0);
    93136}
    94137
     138
     139
     140
     141
     142
  • c/src/tests/itrontests/itrontask03/itrontask03.scn

    r0f88857 r06380cfe  
    11*** ITRON TASK TEST 3 ***
     2INIT - Create and Start PREEMPT
     3PREEMPT - ref_tsk validation
     4PREEMPT - chg_pri increment priority
     5PREEMPT - ext_tsk - going to DORMANT state
     6INIT - rot_rdq - no tasks at this priority
     7INIT - ref_tsk PREEMPT - Validate DORMANT STATE
     8PREEMPT - ref_tsk validation
     9PREEMPT - exd_tsk - Exit and Delete task
    210INIT - rot_rdq - yielding processor
    3 PREEMPT - exd_tsk
     11INIT - ref_tsk PREEMPT - Validate no longer exists
    412INIT - suspending TA2 while middle task on a ready chain
    513TA1 - rtems_task_wake_after - sleep 1 second
     
    1119TA1 - rtems_task_wake_after - sleep for 5 seconds
    1220TA3 - exd_tsk - exit and delete self
    13 *** END OF ITRON TASK TEST 3 ***
     21*** ITRON TASK TEST 3 ***
  • c/src/tests/itrontests/itrontask03/preempt.c

    r0f88857 r06380cfe  
    2222#include "system.h"
    2323
     24int Preempt_task_Count;
     25
    2426void Preempt_task()
    2527{
    26   ER   status;
     28  ER       status;
     29  T_RTSK   pk_rtsk;
    2730
    28   puts( "PREEMPT - exd_tsk"  );
    29   exd_tsk(  );
    30   assert( 0 );
     31  puts( "PREEMPT - ref_tsk validation"  );
     32  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     33  assert( status          == E_OK );
     34  assert( pk_rtsk.tskpri  == PREEMPT_PRIORITY );
     35  assert( pk_rtsk.itskpri == PREEMPT_PRIORITY );
     36  assert( pk_rtsk.task    == Preempt_task );
     37  assert( pk_rtsk.stksz   >= RTEMS_MINIMUM_STACK_SIZE );
     38  assert( pk_rtsk.tskstat == (TTS_RUN | TTS_RDY) );
     39
     40  if ( Preempt_task_Count == 0 ) {
     41    Preempt_task_Count ++;
     42    puts( "PREEMPT - chg_pri increment priority ");
     43    status = chg_pri( PREEMPT_TASK_ID, (PREEMPT_PRIORITY+1) );
     44    directive_failed( status, "chg_pri" );
     45    puts( "PREEMPT - ext_tsk - going to DORMANT state" );
     46    ext_tsk( );
     47    assert( 0 );
     48  } else {
     49    Preempt_task_Count ++;
     50    puts( "PREEMPT - exd_tsk - Exit and Delete task" );
     51    exd_tsk(  );
     52    assert( 0 );
     53  }
    3154}
     55
  • c/src/tests/itrontests/itrontask03/system.h

    r0f88857 r06380cfe  
    4141#define TA3_ID                  5
    4242
     43
     44#define PREEMPT_PRIORITY        1
    4345TEST_EXTERN rtems_id Global_variable;   /* example global variable     */
    4446
  • testsuites/itrontests/itrontask03/init.c

    r0f88857 r06380cfe  
    1  /*  Init
     1/*  Init
    22 *
    33 *  This routine is the initialization task for this test program.
     
    2121#include "system.h"
    2222#include <stdio.h>
     23#include <assert.h>
    2324
    2425void ITRON_Init( void )
     
    2627  ER                status;
    2728  T_CTSK            pk_ctsk;
    28 
    29   puts( "\n\n*** ITRON TASK TEST 3 ***" );
     29  T_RTSK            pk_rtsk;
    3030
    3131  pk_ctsk.exinf    = NULL;
    3232  pk_ctsk.tskatr   = TA_HLNG;
    3333  pk_ctsk.stksz    = RTEMS_MINIMUM_STACK_SIZE;
     34  pk_ctsk.itskpri  = PREEMPT_PRIORITY;
     35  pk_ctsk.task     = Preempt_task;
    3436
    35   pk_ctsk.itskpri  = 1;
    36   pk_ctsk.task     = Preempt_task;
     37  puts( "\n\n*** ITRON TASK TEST 3 ***" );
     38
     39  /*
     40   *  Create and start the Preempt task the first time.
     41   *  Verify that it is dormant when it comes back.
     42   */
     43
     44  puts( "INIT - Create and Start PREEMPT" );
     45  status = chg_pri( TSK_SELF, (PREEMPT_PRIORITY+2) );
     46  directive_failed( status, "chg_pri of SELF" );
     47 
    3748  status = cre_tsk(  PREEMPT_TASK_ID, &pk_ctsk );
    3849  directive_failed( status, "cre_tsk of RTEMS_PREEMPT" );
     50
    3951  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
    4052  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
     53  puts( "INIT - rot_rdq - no tasks at this priority" );
     54  status = rot_rdq( 1 );
     55  directive_failed( status, "rot_rdq" );
    4156
     57  puts( "INIT - ref_tsk PREEMPT - Validate DORMANT STATE" );
     58  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     59  directive_failed( status, "INIT - ref_tsk of RTEMS_PREEMPT");
     60  assert( pk_rtsk.tskstat == TTS_DMT );
     61 
     62  /*
     63   * Restart the Preempt Task.
     64   */
     65
     66  status  = sta_tsk( PREEMPT_TASK_ID, 0 );
     67  directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
    4268  puts( "INIT - rot_rdq - yielding processor" );
    4369  status = rot_rdq( 1 );
    4470  directive_failed( status, "rot_rdq" );
     71  puts( "INIT - ref_tsk PREEMPT - Validate no longer exists" );
     72  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     73  assert( status == E_NOEXS );
    4574
     75  status = chg_pri( TSK_SELF, PREEMPT_PRIORITY );
     76  directive_failed( status, "chg_pri of SELF" );
     77 
     78  /*
     79   * XXX
     80   */
     81       
    4682  pk_ctsk.itskpri  = 3;
    4783  pk_ctsk.task     = Task_1;
     
    6399  status  = sta_tsk( TA3_ID, 0 );
    64100  directive_failed( status, "sta_tsk of TA3" );
     101  puts( "INIT - ref_tsk TA1 - Validate READY STATE" );
     102  status = ref_tsk( &pk_rtsk, TA1_ID);
     103  directive_failed( status, "INIT - ref_tsk of TA1");
     104  assert( pk_rtsk.tskstat == TTS_RDY );
    65105
    66106  puts( "INIT - suspending TA2 while middle task on a ready chain" );
    67107  status = sus_tsk( TA2_ID  );
    68108  directive_failed( status, "sus_tsk of TA2" );
     109  status = ref_tsk( &pk_rtsk, TA2_ID);
     110  directive_failed( status, "INIT - ref_tsk of TA2");
     111  assert( pk_rtsk.tskstat == TTS_SUS );
    69112
    70113  status = ter_tsk( TA1_ID );
     
    90133 
    91134  exd_tsk();
    92   directive_failed( 0, "exd_tsk" );
     135  assert(0);
    93136}
    94137
     138
     139
     140
     141
     142
  • testsuites/itrontests/itrontask03/itrontask03.scn

    r0f88857 r06380cfe  
    11*** ITRON TASK TEST 3 ***
     2INIT - Create and Start PREEMPT
     3PREEMPT - ref_tsk validation
     4PREEMPT - chg_pri increment priority
     5PREEMPT - ext_tsk - going to DORMANT state
     6INIT - rot_rdq - no tasks at this priority
     7INIT - ref_tsk PREEMPT - Validate DORMANT STATE
     8PREEMPT - ref_tsk validation
     9PREEMPT - exd_tsk - Exit and Delete task
    210INIT - rot_rdq - yielding processor
    3 PREEMPT - exd_tsk
     11INIT - ref_tsk PREEMPT - Validate no longer exists
    412INIT - suspending TA2 while middle task on a ready chain
    513TA1 - rtems_task_wake_after - sleep 1 second
     
    1119TA1 - rtems_task_wake_after - sleep for 5 seconds
    1220TA3 - exd_tsk - exit and delete self
    13 *** END OF ITRON TASK TEST 3 ***
     21*** ITRON TASK TEST 3 ***
  • testsuites/itrontests/itrontask03/preempt.c

    r0f88857 r06380cfe  
    2222#include "system.h"
    2323
     24int Preempt_task_Count;
     25
    2426void Preempt_task()
    2527{
    26   ER   status;
     28  ER       status;
     29  T_RTSK   pk_rtsk;
    2730
    28   puts( "PREEMPT - exd_tsk"  );
    29   exd_tsk(  );
    30   assert( 0 );
     31  puts( "PREEMPT - ref_tsk validation"  );
     32  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
     33  assert( status          == E_OK );
     34  assert( pk_rtsk.tskpri  == PREEMPT_PRIORITY );
     35  assert( pk_rtsk.itskpri == PREEMPT_PRIORITY );
     36  assert( pk_rtsk.task    == Preempt_task );
     37  assert( pk_rtsk.stksz   >= RTEMS_MINIMUM_STACK_SIZE );
     38  assert( pk_rtsk.tskstat == (TTS_RUN | TTS_RDY) );
     39
     40  if ( Preempt_task_Count == 0 ) {
     41    Preempt_task_Count ++;
     42    puts( "PREEMPT - chg_pri increment priority ");
     43    status = chg_pri( PREEMPT_TASK_ID, (PREEMPT_PRIORITY+1) );
     44    directive_failed( status, "chg_pri" );
     45    puts( "PREEMPT - ext_tsk - going to DORMANT state" );
     46    ext_tsk( );
     47    assert( 0 );
     48  } else {
     49    Preempt_task_Count ++;
     50    puts( "PREEMPT - exd_tsk - Exit and Delete task" );
     51    exd_tsk(  );
     52    assert( 0 );
     53  }
    3154}
     55
  • testsuites/itrontests/itrontask03/system.h

    r0f88857 r06380cfe  
    4141#define TA3_ID                  5
    4242
     43
     44#define PREEMPT_PRIORITY        1
    4345TEST_EXTERN rtems_id Global_variable;   /* example global variable     */
    4446
Note: See TracChangeset for help on using the changeset viewer.