diff options
Diffstat (limited to 'c/src/tests/mptests/mp09')
-rw-r--r-- | c/src/tests/mptests/mp09/init.c | 74 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/node1/mp09.doc | 50 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/node1/mp09.scn | 22 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/node2/mp09.doc | 13 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/node2/mp09.scn | 27 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/recvmsg.c | 47 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/sendmsg.c | 60 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/system.h | 58 | ||||
-rw-r--r-- | c/src/tests/mptests/mp09/task1.c | 109 |
9 files changed, 460 insertions, 0 deletions
diff --git a/c/src/tests/mptests/mp09/init.c b/c/src/tests/mptests/mp09/init.c new file mode 100644 index 0000000000..b6f5195139 --- /dev/null +++ b/c/src/tests/mptests/mp09/init.c @@ -0,0 +1,74 @@ +/* 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$ + */ + +#define TEST_INIT +#include "system.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, + 16, + RTEMS_GLOBAL, + &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, + RTEMS_MINIMUM_STACK_SIZE, + 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/c/src/tests/mptests/mp09/node1/mp09.doc b/c/src/tests/mptests/mp09/node1/mp09.doc new file mode 100644 index 0000000000..15e05aae58 --- /dev/null +++ b/c/src/tests/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/c/src/tests/mptests/mp09/node1/mp09.scn b/c/src/tests/mptests/mp09/node1/mp09.scn new file mode 100644 index 0000000000..74cf06904d --- /dev/null +++ b/c/src/tests/mptests/mp09/node1/mp09.scn @@ -0,0 +1,22 @@ +*** 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 +Receiver delaying for a second +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/c/src/tests/mptests/mp09/node2/mp09.doc b/c/src/tests/mptests/mp09/node2/mp09.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/c/src/tests/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/c/src/tests/mptests/mp09/node2/mp09.scn b/c/src/tests/mptests/mp09/node2/mp09.scn new file mode 100644 index 0000000000..1bd17cecd9 --- /dev/null +++ b/c/src/tests/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 +Receiver delaying for a second +Flushing remote empty queue +0 messages were flushed on the remote queue +Send messages to be flushed from remote queue +Flushing remote queue +1 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/c/src/tests/mptests/mp09/recvmsg.c b/c/src/tests/mptests/mp09/recvmsg.c new file mode 100644 index 0000000000..fcdb75e966 --- /dev/null +++ b/c/src/tests/mptests/mp09/recvmsg.c @@ -0,0 +1,47 @@ +/* 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; + rtems_unsigned32 size; + 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, + &size, + 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/c/src/tests/mptests/mp09/sendmsg.c b/c/src/tests/mptests/mp09/sendmsg.c new file mode 100644 index 0000000000..ee555af67c --- /dev/null +++ b/c/src/tests/mptests/mp09/sendmsg.c @@ -0,0 +1,60 @@ +/* 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, 16 ); + 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, 16 ); + 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, + 16, + &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/c/src/tests/mptests/mp09/system.h b/c/src/tests/mptests/mp09/system.h new file mode 100644 index 0000000000..3060262e8e --- /dev/null +++ b/c/src/tests/mptests/mp09/system.h @@ -0,0 +1,58 @@ +/* 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 <tmacros.h> + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Test_task( + rtems_task_argument argument +); + +void Receive_messages( void ); + +void Send_messages( void ); + +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */ + +extern char buffer1[16]; +extern char buffer2[16]; +extern char buffer3[16]; +extern char buffer4[16]; + +/* end of include file */ diff --git a/c/src/tests/mptests/mp09/task1.c b/c/src/tests/mptests/mp09/task1.c new file mode 100644 index 0000000000..c4818af23a --- /dev/null +++ b/c/src/tests/mptests/mp09/task1.c @@ -0,0 +1,109 @@ +/* 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; + rtems_unsigned32 size; + 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( "%d 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, 16 ); + 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( "%d 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, + &size, + 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 ); +} |