source: rtems/testsuites/mptests/mp02/task1.c @ 03f2154e

4.104.114.84.95
Last change on this file since 03f2154e was 03f2154e, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 22, 1997 at 5:20:27 PM

headers updated to reflect new style copyright notice as part
of switching to the modified GNU GPL.

  • 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-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include "system.h"
24
25extern rtems_multiprocessing_table Multiprocessing_configuration;
26
27rtems_task Test_task(
28  rtems_task_argument argument
29)
30{
31  rtems_id          tid;
32  rtems_status_code status;
33  rtems_unsigned32  remote_node;
34  rtems_id          remote_tid;
35  rtems_id          test_tid;
36  rtems_unsigned32  note;
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  printf(
89   "Setting notepad %d of the remote task to %d\n",
90   rtems_get_node(tid),
91   rtems_get_node(tid)
92  );
93  status = rtems_task_set_note(
94    remote_tid,
95    rtems_get_node(tid),
96    rtems_get_node(tid)
97  );
98  directive_failed( status, "rtems_task_set_note" );
99
100  puts( "Getting a notepad of the remote task" );
101  status = rtems_task_get_note( remote_tid, rtems_get_node(tid), &note );
102  directive_failed( status, "rtems_task_get_note" );
103
104  if ( note == rtems_get_node(tid) )
105    puts( "Remote notepad set and read correctly" );
106  else
107    printf(
108      "FAILURE!! Remote notepad was not set and read correctly (%d, %d)\n",
109      note,
110      rtems_get_node( tid )
111    );
112
113  status = rtems_task_wake_after( TICKS_PER_SECOND );
114  directive_failed( status, "rtems_task_wake_after" );
115
116  puts( "*** END OF TEST 2 ***" );
117  exit( 0 );
118}
Note: See TracBrowser for help on using the repository browser.