diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-05-11 17:39:37 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-05-11 17:39:37 +0000 |
commit | ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 (patch) | |
tree | 9304cf759a73f2a1c6fd3191948f00e870af3787 /testsuites/mptests/mp09 | |
download | rtems-ac7d5ef06a6d6e8d84abbd1f0b82162725f98326.tar.bz2 |
Initial revision
Diffstat (limited to 'testsuites/mptests/mp09')
-rw-r--r-- | testsuites/mptests/mp09/init.c | 76 | ||||
-rw-r--r-- | testsuites/mptests/mp09/node1/mp09.doc | 50 | ||||
-rw-r--r-- | testsuites/mptests/mp09/node1/mp09.scn | 21 | ||||
-rw-r--r-- | testsuites/mptests/mp09/node2/mp09.doc | 13 | ||||
-rw-r--r-- | testsuites/mptests/mp09/node2/mp09.scn | 27 | ||||
-rw-r--r-- | testsuites/mptests/mp09/recvmsg.c | 45 | ||||
-rw-r--r-- | testsuites/mptests/mp09/sendmsg.c | 59 | ||||
-rw-r--r-- | testsuites/mptests/mp09/system.h | 30 | ||||
-rw-r--r-- | testsuites/mptests/mp09/task1.c | 107 |
9 files changed, 428 insertions, 0 deletions
diff --git a/testsuites/mptests/mp09/init.c b/testsuites/mptests/mp09/init.c new file mode 100644 index 0000000000..bd19547cef --- /dev/null +++ b/testsuites/mptests/mp09/init.c @@ -0,0 +1,76 @@ +/* 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 9 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + 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 Test_task (local)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (local)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp09/node1/mp09.doc b/testsuites/mptests/mp09/node1/mp09.doc new file mode 100644 index 0000000000..15e05aae58 --- /dev/null +++ b/testsuites/mptests/mp09/node1/mp09.doc @@ -0,0 +1,50 @@ +# +# $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: test58 + +GLOBAL MESSAGE QUEUE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_wkafter, q_create, q_send, q_broadcast, q_urgent, q_receive, + q_delete + +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 delete itself. + + i. Verifies Rpc and Process_pkt for message queue related packets. + + j. Verifies normal and error paths for global message queue handling. + +NOTE: The SLAVE must be started first for this test to successfully run. diff --git a/testsuites/mptests/mp09/node1/mp09.scn b/testsuites/mptests/mp09/node1/mp09.scn new file mode 100644 index 0000000000..2b612e4746 --- /dev/null +++ b/testsuites/mptests/mp09/node1/mp09.scn @@ -0,0 +1,21 @@ +*** TEST 9 -- NODE 1 *** +Creating Message Queue (Global) +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +rtems_message_queue_send: 123456789012345 +Delaying for a second +rtems_message_queue_urgent: abcdefghijklmno +Delaying for a second +rtems_message_queue_broadcast: ABCDEFGHIJKLMNO +Delaying for a second +Delaying for 5 seconds +Deleting Message queue +*** END OF TEST 9 *** diff --git a/testsuites/mptests/mp09/node2/mp09.doc b/testsuites/mptests/mp09/node2/mp09.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp09/node2/mp09.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/testsuites/mptests/mp09/node2/mp09.scn b/testsuites/mptests/mp09/node2/mp09.scn new file mode 100644 index 0000000000..96708f7fe0 --- /dev/null +++ b/testsuites/mptests/mp09/node2/mp09.scn @@ -0,0 +1,27 @@ +*** TEST 9 -- NODE 2 *** +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT +rtems_message_queue_send: 123456789012345 +Delaying for a second +rtems_message_queue_urgent: abcdefghijklmno +Delaying for a second +rtems_message_queue_broadcast: ABCDEFGHIJKLMNO +Delaying for a second +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +Flushing remote empty queue +00 messages were flushed on the remote queue +Send messages to be flushed from remote queue +Flushing remote queue +01 messages were flushed on the remote queue +Waiting for message queue to be deleted + +Global message queue deleted +*** END OF TEST 9 *** diff --git a/testsuites/mptests/mp09/recvmsg.c b/testsuites/mptests/mp09/recvmsg.c new file mode 100644 index 0000000000..c3c1a8ef8b --- /dev/null +++ b/testsuites/mptests/mp09/recvmsg.c @@ -0,0 +1,45 @@ +/* Receive_messages + * + * This routine receives and prints three messages. + * an error condition. + * + * 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" + +void Receive_messages() +{ + rtems_status_code status; + rtems_unsigned32 index; + char receive_buffer[16]; + + for ( index=1 ; index <=3 ; index++ ) { + puts( "Receiving 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" ); + puts_nocr( "Received : "); + puts( receive_buffer ); + } + + puts( "Receiver delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); +} diff --git a/testsuites/mptests/mp09/sendmsg.c b/testsuites/mptests/mp09/sendmsg.c new file mode 100644 index 0000000000..d800eb47cf --- /dev/null +++ b/testsuites/mptests/mp09/sendmsg.c @@ -0,0 +1,59 @@ +/* Send_messages + * + * This routine sends a series of three messages. + * an error condition. + * + * 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" + +void Send_messages() +{ + rtems_status_code status; + rtems_unsigned32 broadcast_count; + + puts_nocr( "rtems_message_queue_send: " ); + puts( buffer1 ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1 ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "rtems_message_queue_urgent: " ); + puts( buffer2 ); + status = rtems_message_queue_urgent( Queue_id[ 1 ], (long (*)[4])buffer2 ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "rtems_message_queue_broadcast: " ); + puts( buffer3 ); + status = rtems_message_queue_broadcast( + Queue_id[ 1 ], + (long (*)[4])buffer3, + &broadcast_count + ); + directive_failed( status, "rtems_message_queue_broadcast" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); +} diff --git a/testsuites/mptests/mp09/system.h b/testsuites/mptests/mp09/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp09/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/testsuites/mptests/mp09/task1.c b/testsuites/mptests/mp09/task1.c new file mode 100644 index 0000000000..ece05592dd --- /dev/null +++ b/testsuites/mptests/mp09/task1.c @@ -0,0 +1,107 @@ +/* Test_task + * + * This task tests global message queue operations. It also generates + * an error condition. + * + * 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" + +char buffer1[16] = "123456789012345"; +char buffer2[16] = "abcdefghijklmno"; +char buffer3[16] = "ABCDEFGHIJKLMNO"; +char buffer4[16] = "PQRSTUVWXYZ(){}"; + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 count; + char receive_buffer[16]; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + 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 ) ); + + if ( Multiprocessing_configuration.node == 2 ) { + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_message_queue_delete" + ); + puts( + "rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT" + ); + + Send_messages(); + Receive_messages(); + + puts( "Flushing remote empty queue" ); + status = rtems_message_queue_flush( Queue_id[ 1 ], &count ); + directive_failed( status, "rtems_message_queue_flush" ); + printf( "%02d messages were flushed on the remote queue\n", count ); + + puts( "Send messages to be flushed from remote queue" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1 ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "Flushing remote queue" ); + status = rtems_message_queue_flush( Queue_id[ 1 ], &count ); + directive_failed( status, "rtems_message_queue_flush" ); + printf( "%02d messages were flushed on the remote queue\n", count ); + + puts( "Waiting for message queue to be deleted" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_message_queue_receive" + ); + puts( "\nGlobal message queue deleted" ); + } + else { /* node == 1 */ + Receive_messages(); + Send_messages(); + + puts( "Delaying for 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Deleting Message queue" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + } + + puts( "*** END OF TEST 9 ***" ); + exit( 0 ); +} |