diff options
Diffstat (limited to 'c/src/tests/mptests/mp10')
-rw-r--r-- | c/src/tests/mptests/mp10/init.c | 144 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/node1/mp10.doc | 46 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/node1/mp10.scn | 4 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/node2/mp10.doc | 13 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/node2/mp10.scn | 19 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/system.h | 30 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/task1.c | 50 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/task2.c | 47 | ||||
-rw-r--r-- | c/src/tests/mptests/mp10/task3.c | 50 |
9 files changed, 403 insertions, 0 deletions
diff --git a/c/src/tests/mptests/mp10/init.c b/c/src/tests/mptests/mp10/init.c new file mode 100644 index 0000000000..7acf5ca411 --- /dev/null +++ b/c/src/tests/mptests/mp10/init.c @@ -0,0 +1,144 @@ +/* Init + * + * This routine is the initialization routine for this test program. + * Other than creating all objects needed by this test, if this routine + * is running on node one, it acquires a global semaphore to + * force all other tasks to pend. If running on node two, this task + * sleeps for a while, and then deletes two local tasks which are + * waiting on a remote message queue or a semaphore. + * 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 10 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'S', 'A', '3', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_GLOBAL|RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create" ); + + puts( "Creating Semaphore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 0, + RTEMS_GLOBAL | RTEMS_PRIORITY, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + + status = rtems_task_wake_after( 10 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + } else { + + puts( "Creating Test_task 1 (local)" ); + status = rtems_task_create( + Task_name[ 1 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 1 (local)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Test_task 2 (local)" ); + status = rtems_task_create( + Task_name[ 2 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 2 (local)" ); + status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Test_task 3 (local)" ); + status = rtems_task_create( + Task_name[ 3 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 3 (local)" ); + status = rtems_task_start( Task_id[ 3 ], Test_task2, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Sleeping for 1 seconds ..." ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Deleting Test_task2" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of Task 2" ); + + puts( "Deleting Test_task1" ); + status = rtems_task_delete( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_delete of Task 1" ); + + puts( "Restarting Test_task3" ); + status = rtems_task_restart( Task_id[ 3 ], 1 ); + directive_failed( status, "rtems_task_restart of Task 3" ); + + } + puts( "*** END OF TEST 10 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/mptests/mp10/node1/mp10.doc b/c/src/tests/mptests/mp10/node1/mp10.doc new file mode 100644 index 0000000000..d75b176f8d --- /dev/null +++ b/c/src/tests/mptests/mp10/node1/mp10.doc @@ -0,0 +1,46 @@ +# +# $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: test59 + +GLOBAL SEMAPHORE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter + +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. + + i. Verifies that a task can delete itself or another task. diff --git a/c/src/tests/mptests/mp10/node1/mp10.scn b/c/src/tests/mptests/mp10/node1/mp10.scn new file mode 100644 index 0000000000..deeafc0a9a --- /dev/null +++ b/c/src/tests/mptests/mp10/node1/mp10.scn @@ -0,0 +1,4 @@ +*** TEST 10 -- NODE 1 *** +Creating Message Queue (Global) +Creating Semaphore (Global) +*** END OF TEST 10 *** diff --git a/c/src/tests/mptests/mp10/node2/mp10.doc b/c/src/tests/mptests/mp10/node2/mp10.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/c/src/tests/mptests/mp10/node2/mp10.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/mp10/node2/mp10.scn b/c/src/tests/mptests/mp10/node2/mp10.scn new file mode 100644 index 0000000000..25c07e6202 --- /dev/null +++ b/c/src/tests/mptests/mp10/node2/mp10.scn @@ -0,0 +1,19 @@ +*** TEST 10 -- NODE 2 *** +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Creating Test_task 3 (local) +Starting Test_task 3 (local) +Sleeping for 1 seconds ... +Getting QID of message queue +Attempting to receive message ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Deleting Test_task2 +Deleting Test_task1 +Restarting Test_task3 +*** END OF TEST 10 *** + diff --git a/c/src/tests/mptests/mp10/system.h b/c/src/tests/mptests/mp10/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/mptests/mp10/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/mp10/task1.c b/c/src/tests/mptests/mp10/task1.c new file mode 100644 index 0000000000..ff6f4bd69a --- /dev/null +++ b/c/src/tests/mptests/mp10/task1.c @@ -0,0 +1,50 @@ +/* Test_task1 + * + * This task attempts to receive a message from a global message queue. + * It should never actually receive the message. + * + * 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" + +rtems_task Test_task1( + rtems_task_argument argument +) +{ + char receive_buffer[16]; + rtems_status_code status; + + puts( "Getting QID of message queue" ); + + do { + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Queue_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to receive message ..." ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + +} diff --git a/c/src/tests/mptests/mp10/task2.c b/c/src/tests/mptests/mp10/task2.c new file mode 100644 index 0000000000..560f3946cf --- /dev/null +++ b/c/src/tests/mptests/mp10/task2.c @@ -0,0 +1,47 @@ +/* Test_task2 + * + * This task attempts to receive control of a global semaphore. + * It should never receive control of the semaphore. + * + * 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" + +rtems_task Test_task2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "Getting SMID of semaphore" ); + + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to acquire semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); +} diff --git a/c/src/tests/mptests/mp10/task3.c b/c/src/tests/mptests/mp10/task3.c new file mode 100644 index 0000000000..905183268e --- /dev/null +++ b/c/src/tests/mptests/mp10/task3.c @@ -0,0 +1,50 @@ +/* Test_task3 + * + * This task attempts to receive control of a global semaphore. + * It should never receive control of the semaphore. + * + * 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_task Test_task3( restart ) +rtems_task_argument restart; +{ + rtems_status_code status; + + if ( restart == 1 ) { + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete" ); + } + + puts( "Getting SMID of semaphore" ); + + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to acquire semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); +} |