diff options
Diffstat (limited to 'c/src/tests/mptests/mp03')
-rw-r--r-- | c/src/tests/mptests/mp03/delay.c | 31 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/init.c | 68 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/node1/mp03.doc | 45 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/node1/mp03.scn | 24 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/node2/mp03.doc | 13 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/node2/mp03.scn | 24 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/system.h | 30 | ||||
-rw-r--r-- | c/src/tests/mptests/mp03/task1.c | 155 |
8 files changed, 390 insertions, 0 deletions
diff --git a/c/src/tests/mptests/mp03/delay.c b/c/src/tests/mptests/mp03/delay.c new file mode 100644 index 0000000000..6a6bb5f25e --- /dev/null +++ b/c/src/tests/mptests/mp03/delay.c @@ -0,0 +1,31 @@ +/* Delayed_send_event + * + * This routine is a timer service routine which sends an event to task 1. + * + * Input parameters: NONE + * + * 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_timer_service_routine Delayed_send_event( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); +} diff --git a/c/src/tests/mptests/mp03/init.c b/c/src/tests/mptests/mp03/init.c new file mode 100644 index 0000000000..a1f210dad1 --- /dev/null +++ b/c/src/tests/mptests/mp03/init.c @@ -0,0 +1,68 @@ +/* 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; + + printf( + "\n\n*** TEST 3 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[ Multiprocessing_configuration.node ], + 1, + 2048, + RTEMS_NO_PREEMPT, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/mptests/mp03/node1/mp03.doc b/c/src/tests/mptests/mp03/node1/mp03.doc new file mode 100644 index 0000000000..348afef85f --- /dev/null +++ b/c/src/tests/mptests/mp03/node1/mp03.doc @@ -0,0 +1,45 @@ +# +# $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: test52 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_wkafter, t_suspend, t_resume + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task (on another node). + + i. Verifies that a task can suspend and resume a remote task. diff --git a/c/src/tests/mptests/mp03/node1/mp03.scn b/c/src/tests/mptests/mp03/node1/mp03.scn new file mode 100644 index 0000000000..129e5bccba --- /dev/null +++ b/c/src/tests/mptests/mp03/node1/mp03.scn @@ -0,0 +1,24 @@ +*** TEST 3 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 222 +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? + + ........ + +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +*** END OF TEST 3 *** diff --git a/c/src/tests/mptests/mp03/node2/mp03.doc b/c/src/tests/mptests/mp03/node2/mp03.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/c/src/tests/mptests/mp03/node2/mp03.doc @@ -0,0 +1,13 @@ +# +# $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. +# + + diff --git a/c/src/tests/mptests/mp03/node2/mp03.scn b/c/src/tests/mptests/mp03/node2/mp03.scn new file mode 100644 index 0000000000..d77c09e9f7 --- /dev/null +++ b/c/src/tests/mptests/mp03/node2/mp03.scn @@ -0,0 +1,24 @@ +*** TEST 3 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 111 +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? + + ........ + +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +*** END OF TEST 3 *** diff --git a/c/src/tests/mptests/mp03/system.h b/c/src/tests/mptests/mp03/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/mptests/mp03/system.h @@ -0,0 +1,30 @@ +/* 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/c/src/tests/mptests/mp03/task1.c b/c/src/tests/mptests/mp03/task1.c new file mode 100644 index 0000000000..c1f0f777fd --- /dev/null +++ b/c/src/tests/mptests/mp03/task1.c @@ -0,0 +1,155 @@ +/* Test_task + * + * This task suspends and resumes a remote task. + * + * 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" + +/*PAGE + * + * Test_Task_Support + * + */ + +void Test_Task_Support( + rtems_unsigned32 node +) +{ + rtems_event_set events; + rtems_status_code status; + + if ( Multiprocessing_configuration.node == node ) { + + for ( ; ; ) { + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &events + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + + fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive"); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + put_name( Task_name[ node ], FALSE ); + puts( " - Suspending remote task" ); + + status = rtems_task_suspend( remote_tid ); + directive_failed( status, "rtems_task_suspend" ); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + put_name( Task_name[ node ], FALSE ); + puts( " - Resuming remote task" ); + + status = rtems_task_resume( remote_tid ) ; + directive_failed( status, "rtems_task_resume" ); + + } + + } else { + + for ( ; ; ) { + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &events + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + + fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive"); + + put_name( Task_name[ remote_node ], FALSE ); + puts( " - have I been suspended???" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); + } + + } + +} + +/*PAGE + * + * Test_task + */ + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + puts( "Getting TID of remote task" ); + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + printf( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + + directive_failed( status, "rtems_task_ident" ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Delayed_send_event, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + Test_Task_Support( 1 ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Delayed_send_event, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + Test_Task_Support( 2 ); + + puts( "*** END OF TEST 3 ***" ); + exit( 0 ); +} |