source: rtems/testsuites/mptests/mp02/task1.c @ 7d171454

4.104.114.95
Last change on this file since 7d171454 was 65450c14, checked in by Joel Sherrill <joel.sherrill@…>, on 01/29/08 at 21:52:58

2008-01-29 Joel Sherrill <joel.sherrill@…>

  • mp02/task1.c, mp14/delay.c: Add new Object Services collection. This changed the name of a few previously public but undocumented services and added a some new services.
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*  Test_task
2 *
3 *  This task tests the rtems_task_set_note directive on a remote task and that
4 *  errors are returned when attempting to delete, start, or restart
5 *  a remote task.
6 *
7 *  Input parameters:
8 *    argument - task argument
9 *
10 *  Output parameters:  NONE
11 *
12 *  COPYRIGHT (c) 1989-2008.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24extern rtems_multiprocessing_table Multiprocessing_configuration;
25
26rtems_task Test_task(
27  rtems_task_argument argument
28)
29{
30  rtems_id          tid;
31  rtems_status_code status;
32  uint32_t          remote_node;
33  rtems_id          remote_tid;
34  rtems_id          test_tid;
35  uint32_t          note;
36  uint32_t          tmpNode;
37
38  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
39
40  remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1;
41  printf( "Remote task's name is : " );
42  put_name( Task_name[ remote_node ], TRUE );
43
44  puts( "Getting TID of remote task (all nodes)" );
45  do {
46      status = rtems_task_ident(
47          Task_name[ remote_node ],
48          RTEMS_SEARCH_ALL_NODES,
49          &remote_tid
50          );
51  } while ( status != RTEMS_SUCCESSFUL );
52
53  directive_failed( status, "rtems_task_ident" );
54
55  puts( "Getting TID of remote task (1 node)" );
56  status = rtems_task_ident( Task_name[ remote_node ], remote_node, &test_tid );
57  directive_failed( status, "rtems_task_ident" );
58
59  if ( test_tid != remote_tid ) {
60    puts( "rtems_task_ident tid's do not match!!" );
61    rtems_fatal_error_occurred( status );
62  }
63
64  status = rtems_task_delete( remote_tid );
65  fatal_directive_status(
66    status,
67    RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
68    "rtems_task_delete of remote task"
69  );
70  puts( "rtems_task_delete of remote task returned the correct error" );
71
72  status = rtems_task_start( remote_tid, Test_task, 0 );
73  fatal_directive_status(
74    status,
75    RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
76    "rtems_task_start of remote task"
77  );
78  puts( "rtems_task_start of remote task returned the correct error" );
79
80  status = rtems_task_restart( remote_tid, 0 );
81  fatal_directive_status(
82    status,
83    RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
84    "rtems_task_restart of remote task"
85  );
86  puts( "rtems_task_restart of remote task returned the correct error" );
87
88  tmpNode = rtems_object_id_get_node(tid);
89  printf( "Setting notepad %d of the remote task to %d\n", tmpNode, tmpNode );
90  status = rtems_task_set_note( remote_tid, tmpNode, tmpNode );
91  directive_failed( status, "rtems_task_set_note" );
92
93  puts( "Getting a notepad of the remote task" );
94  status = rtems_task_get_note( remote_tid, tmpNode, &note );
95  directive_failed( status, "rtems_task_get_note" );
96
97  if ( note == tmpNode )
98    puts( "Remote notepad set and read correctly" );
99  else
100    printf(
101      "FAILURE!! Remote notepad was not set and read correctly (%d, %d)\n",
102      note,
103      tmpNode
104    );
105
106  status = rtems_task_wake_after( TICKS_PER_SECOND );
107  directive_failed( status, "rtems_task_wake_after" );
108
109  puts( "*** END OF TEST 2 ***" );
110  rtems_test_exit( 0 );
111}
Note: See TracBrowser for help on using the repository browser.