source: rtems/testsuites/mptests/mp09/task1.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*  Test_task
2 *
3 *  This task tests global message queue operations.  It also generates
4 *  an error condition.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-2009.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "system.h"
24
25char buffer1[16] = "123456789012345";
26char buffer2[16] = "abcdefghijklmno";
27char buffer3[16] = "ABCDEFGHIJKLMNO";
28char buffer4[16] = "PQRSTUVWXYZ(){}";
29
30rtems_task Test_task(
31  rtems_task_argument argument
32)
33{
34  rtems_status_code status;
35  uint32_t          count;
36  size_t            size;
37  char              receive_buffer[16];
38
39  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
40  directive_failed( status, "rtems_task_wake_after" );
41
42  puts( "Getting QID of message queue" );
43
44  do {
45    status = rtems_message_queue_ident(
46      Queue_name[ 1 ],
47      RTEMS_SEARCH_ALL_NODES,
48      &Queue_id[ 1 ]
49    );
50  } while ( !rtems_is_status_successful( status ) );
51
52  if ( Multiprocessing_configuration.node == 2 ) {
53    status = rtems_message_queue_delete( Queue_id[ 1 ] );
54    fatal_directive_status(
55      status,
56      RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
57      "rtems_message_queue_delete"
58    );
59    puts(
60  "rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
61    );
62
63    Send_messages();
64    Receive_messages();
65
66    puts( "Flushing remote empty queue" );
67    status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
68    directive_failed( status, "rtems_message_queue_flush" );
69    printf( "%" PRIu32 " messages were flushed on the remote queue\n", count );
70
71    puts( "Send messages to be flushed from remote queue" );
72    status = rtems_message_queue_send( Queue_id[ 1 ], buffer1, 16 );
73    directive_failed( status, "rtems_message_queue_send" );
74
75    puts( "Flushing remote queue" );
76    status = rtems_message_queue_flush( Queue_id[ 1 ], &count );
77    directive_failed( status, "rtems_message_queue_flush" );
78    printf( "%" PRIu32 " messages were flushed on the remote queue\n", count );
79
80    puts( "Waiting for message queue to be deleted" );
81    status = rtems_message_queue_receive(
82      Queue_id[ 1 ],
83      receive_buffer,
84      &size,
85      RTEMS_DEFAULT_OPTIONS,
86      RTEMS_NO_TIMEOUT
87    );
88    fatal_directive_status(
89      status,
90      RTEMS_OBJECT_WAS_DELETED,
91      "rtems_message_queue_receive"
92    );
93    puts( "\nGlobal message queue deleted" );
94  }
95  else {                   /* node == 1 */
96    Receive_messages();
97    Send_messages();
98
99    puts( "Delaying for 5 seconds" );
100    status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
101    directive_failed( status, "rtems_task_wake_after" );
102
103    puts( "Deleting Message queue" );
104    status = rtems_message_queue_delete( Queue_id[ 1 ] );
105    directive_failed( status, "rtems_message_queue_delete" );
106  }
107
108  puts( "*** END OF TEST 9 ***" );
109  rtems_test_exit( 0 );
110}
Note: See TracBrowser for help on using the repository browser.