From e0991809991a2c5547d45881978212d5efc0e1de Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 9 Nov 1999 23:27:05 +0000 Subject: Merged tests from Task group. --- testsuites/itrontests/itrontask03/init.c | 94 +++++++++++++++++++++++ testsuites/itrontests/itrontask03/itrontask03.doc | 40 ++++++++++ testsuites/itrontests/itrontask03/itrontask03.scn | 13 ++++ testsuites/itrontests/itrontask03/preempt.c | 31 ++++++++ testsuites/itrontests/itrontask03/system.h | 44 +++++++++++ testsuites/itrontests/itrontask03/task1.c | 59 ++++++++++++++ testsuites/itrontests/itrontask03/task2.c | 32 ++++++++ testsuites/itrontests/itrontask03/task3.c | 40 ++++++++++ 8 files changed, 353 insertions(+) create mode 100644 testsuites/itrontests/itrontask03/init.c create mode 100644 testsuites/itrontests/itrontask03/itrontask03.doc create mode 100644 testsuites/itrontests/itrontask03/itrontask03.scn create mode 100644 testsuites/itrontests/itrontask03/preempt.c create mode 100644 testsuites/itrontests/itrontask03/system.h create mode 100644 testsuites/itrontests/itrontask03/task1.c create mode 100644 testsuites/itrontests/itrontask03/task2.c create mode 100644 testsuites/itrontests/itrontask03/task3.c (limited to 'testsuites/itrontests/itrontask03') diff --git a/testsuites/itrontests/itrontask03/init.c b/testsuites/itrontests/itrontask03/init.c new file mode 100644 index 0000000000..cc94d6d2f7 --- /dev/null +++ b/testsuites/itrontests/itrontask03/init.c @@ -0,0 +1,94 @@ + /* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * 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$ + */ + +#define TEST_INIT +#include "system.h" +#include + +void ITRON_Init( void ) +{ + ER status; + T_CTSK pk_ctsk; + + puts( "\n\n*** ITRON TEST 5 ***" ); + + pk_ctsk.exinf = NULL; + pk_ctsk.tskatr = TA_HLNG; + pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE; + + pk_ctsk.itskpri = 1; + pk_ctsk.task = Preempt_task; + status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk ); + directive_failed( status, "cre_tsk of RTEMS_PREEMPT" ); + status = sta_tsk( PREEMPT_TASK_ID, 0 ); + directive_failed( status, "sta_tsk of RTEMS_PREEMPT" ); + + puts( "INIT - rot_rdq - yielding processor" ); + status = rot_rdq( 1 ); + directive_failed( status, "rot_rdq" ); + + pk_ctsk.itskpri = 3; + pk_ctsk.task = Task_1; + status = cre_tsk( TA1_ID, &pk_ctsk ); + directive_failed( status, "cre_tsk of TA1" ); + + pk_ctsk.task = Task_2; + status = cre_tsk( TA2_ID, &pk_ctsk ); + directive_failed( status, "cre_tsk of TA2" ); + + pk_ctsk.task = Task_3; + status = cre_tsk( TA3_ID, &pk_ctsk ); + directive_failed( status, "cre_tsk of TA3" ); + + status = sta_tsk( TA1_ID, 0 ); + directive_failed( status, "sta_tsk of TA1" ); + status = sta_tsk( TA2_ID, 0 ); + directive_failed( status, "sta_tsk of TA2" ); + status = sta_tsk( TA3_ID, 0 ); + directive_failed( status, "sta_tsk of TA3" ); + + puts( "INIT - suspending TA2 while middle task on a ready chain" ); + status = sus_tsk( TA2_ID ); + directive_failed( status, "sus_tsk of TA2" ); + + status = ter_tsk( TA1_ID ); + directive_failed( status, "ter_tsk of TA1" ); + status = del_tsk( TA1_ID ); + directive_failed( status, "del_tsk of TA1" ); + status = ter_tsk( TA2_ID ); + directive_failed( status, "ter_tsk of TA2" ); + status = ter_tsk( TA3_ID ); + directive_failed( status, "ter_tsk of TA3" ); + + pk_ctsk.itskpri = 1; + pk_ctsk.task = Task_1; + status = cre_tsk( TA1_ID, &pk_ctsk ); + directive_failed( status, "cre_tsk of TA1 at priority 1" ); + + status = sta_tsk( TA1_ID, 0 ); + directive_failed( status, "sta_tsk of TA1" ); + status = sta_tsk( TA2_ID, 0 ); + directive_failed( status, "sta_tsk of TA2" ); + status = sta_tsk( TA3_ID, 0 ); + directive_failed( status, "sta_tsk of TA3" ); + + exd_tsk(); + directive_failed( 0, "exd_tsk" ); +} + diff --git a/testsuites/itrontests/itrontask03/itrontask03.doc b/testsuites/itrontests/itrontask03/itrontask03.doc new file mode 100644 index 0000000000..12d12f0940 --- /dev/null +++ b/testsuites/itrontests/itrontask03/itrontask03.doc @@ -0,0 +1,40 @@ +# +# $Id$ +# +# 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. +# + + + +This file describes the directives and concepts tested by this test set. + +test set name: test2 + +directives: + ext_tsk, cre_tsk, sta_tsk, rot_rdq + + 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/itrontests/itrontask03/itrontask03.scn b/testsuites/itrontests/itrontask03/itrontask03.scn new file mode 100644 index 0000000000..1ee0401494 --- /dev/null +++ b/testsuites/itrontests/itrontask03/itrontask03.scn @@ -0,0 +1,13 @@ +*** ITRON TEST 5 *** +INIT - rot_rdq - yielding processor +PREEMPT - exd_tsk +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 - chg_pri - set TA3's priority to 2 +TA1 - rtems_task_suspend - suspend TA2 +TA1 - - delete TA2 +TA1 - rtems_task_wake_after - sleep for 5 seconds +TA3 - exd_tsk - exit and delete self +*** END OF TEST 5 *** diff --git a/testsuites/itrontests/itrontask03/preempt.c b/testsuites/itrontests/itrontask03/preempt.c new file mode 100644 index 0000000000..6f8f89f0c2 --- /dev/null +++ b/testsuites/itrontests/itrontask03/preempt.c @@ -0,0 +1,31 @@ +/* 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-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 +#include "system.h" + +void Preempt_task() +{ + ER status; + + puts( "PREEMPT - exd_tsk" ); + exd_tsk( ); + assert( 0 ); +} diff --git a/testsuites/itrontests/itrontask03/system.h b/testsuites/itrontests/itrontask03/system.h new file mode 100644 index 0000000000..51af0eaca6 --- /dev/null +++ b/testsuites/itrontests/itrontask03/system.h @@ -0,0 +1,44 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * 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 + +/* functions */ + +void ITRON_Init( void ); +void Preempt_task(); +void Task_1(); +void Task_2(); +void Task_3(); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_ITRON_INIT_TASK_TABLE + +#include + +/* global variables */ + +#define PREEMPT_TASK_ID 2 +#define TA1_ID 3 +#define TA2_ID 4 +#define TA3_ID 5 + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/testsuites/itrontests/itrontask03/task1.c b/testsuites/itrontests/itrontask03/task1.c new file mode 100644 index 0000000000..30a6078956 --- /dev/null +++ b/testsuites/itrontests/itrontask03/task1.c @@ -0,0 +1,59 @@ +/* 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-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 "system.h" + +void Task_1() +{ + ER status; + PRI previous_priority; + + /* + * XXX - Change to itron routine. + */ + + 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 = chg_pri( TA3_ID , 2 ); + directive_failed( status, "chg_pri" ); + + puts( "TA1 - chg_pri - set TA3's priority to 2" ); + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = sus_tsk( TA2_ID ); + directive_failed( status, "sus_tsk of TA2" ); + + puts( "TA1 - - delete TA2" ); + status = ter_tsk( TA2_ID ); + directive_failed( status, "ter_tsk of TA2" ); + + /* + * XXX - Change to itron routine. + */ + + 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 5 ***" ); + exit( 0 ); +} diff --git a/testsuites/itrontests/itrontask03/task2.c b/testsuites/itrontests/itrontask03/task2.c new file mode 100644 index 0000000000..3040b0176f --- /dev/null +++ b/testsuites/itrontests/itrontask03/task2.c @@ -0,0 +1,32 @@ +/* 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-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 "system.h" + +void Task_2() +{ + 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/itrontests/itrontask03/task3.c b/testsuites/itrontests/itrontask03/task3.c new file mode 100644 index 0000000000..38b9ff97c0 --- /dev/null +++ b/testsuites/itrontests/itrontask03/task3.c @@ -0,0 +1,40 @@ +/* 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-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 "system.h" + +void Task_3() +{ + rtems_status_code status; + + /* + * XXX - Convert Later. + */ + + 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 - exd_tsk - exit and delete self" ); + exd_tsk(); + directive_failed( 0, "exd_tsk" ); +} -- cgit v1.2.3