source: rtems/c/src/ada-tests/mptests/mp12/mptest.adb @ 23848bbd

4.104.114.95
Last change on this file since 23848bbd was 23848bbd, checked in by Joel Sherrill <joel.sherrill@…>, on 10/01/07 at 22:58:09

2007-10-01 Joel Sherrill <joel.sherrill@…>

  • mptests/mp01/mptest.adb, mptests/mp01/mptest.ads, mptests/mp01/node1/Makefile.am, mptests/mp02/mptest.adb, mptests/mp02/mptest.ads, mptests/mp03/mptest.adb, mptests/mp03/mptest.ads, mptests/mp04/mptest.adb, mptests/mp04/mptest.ads, mptests/mp05/mptest.adb, mptests/mp05/mptest.ads, mptests/mp06/mptest.adb, mptests/mp06/mptest.ads, mptests/mp07/mptest.adb, mptests/mp07/mptest.ads, mptests/mp08/mptest.adb, mptests/mp08/mptest.ads, mptests/mp09/mptest.adb, mptests/mp09/mptest.ads, mptests/mp10/mptest.adb, mptests/mp10/mptest.ads, mptests/mp11/mptest.adb, mptests/mp11/mptest.ads, mptests/mp12/mptest.adb, mptests/mp12/mptest.ads, mptests/mp13/mptest.adb, mptests/mp13/mptest.ads, mptests/mp14/mptest.adb, mptests/mp14/mptest.ads, support/init.c, support/test_support.adb, support/test_support.ads: Most of single processor Ada tests now build. Some run.
  • Property mode set to 100644
File size: 3.9 KB
Line 
1--
2--  MPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation for Test 12 of the RTEMS
7--  Multiprocessor Test Suite.
8--
9--  DEPENDENCIES:
10--
11--
12--
13--  COPYRIGHT (c) 1989-1997.
14--  On-Line Applications Research Corporation (OAR).
15--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.rtems.com/license/LICENSE.
19--
20--  $Id$
21--
22
23with INTERFACES; use INTERFACES;
24with RTEMS;
25with TEST_SUPPORT;
26with TEXT_IO;
27with UNSIGNED32_IO;
28
29package body MPTEST is
30
31--PAGE
32--
33--  INIT
34--
35
36   procedure INIT (
37      ARGUMENT : in     RTEMS.TASK_ARGUMENT
38   ) is
39      BUFFER_ADDRESS : RTEMS.ADDRESS;
40      STATUS         : RTEMS.STATUS_CODES;
41   begin
42
43      TEXT_IO.NEW_LINE( 2 );
44      TEXT_IO.PUT( "*** TEST 12 -- NODE " );
45      UNSIGNED32_IO.PUT(
46         TEST_SUPPORT.NODE,
47         WIDTH => 1
48      );
49      TEXT_IO.PUT_LINE( " ***" );
50
51      MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME(  '1', '1', '1', ' ' );
52      MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME(  '2', '2', '2', ' ' );
53
54      MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME(  'P', 'A', 'R', ' ' );
55
56      TEXT_IO.PUT_LINE( "Got to the initialization task" );
57
58      if TEST_SUPPORT.NODE = 2 then
59
60         RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
61         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
62
63         TEXT_IO.PUT_LINE( "Getting ID of remote Partition (Global)" );
64
65         loop
66
67            RTEMS.PARTITION_IDENT(
68               MPTEST.PARTITION_NAME( 1 ),
69               RTEMS.SEARCH_ALL_NODES,
70               MPTEST.PARTITION_ID( 1 ),
71               STATUS
72            );
73
74            exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS );
75
76         end loop;
77
78         TEXT_IO.PUT_LINE(
79            "Attempting to delete remote Partition (Global)"
80         );
81
82         RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS );
83         TEST_SUPPORT.FATAL_DIRECTIVE_STATUS(
84            STATUS,
85            RTEMS.ILLEGAL_ON_REMOTE_OBJECT,
86            "PARTITION_DELETE"
87         );
88
89         TEXT_IO.PUT_LINE(
90            "partition_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT!!"
91         );
92
93         TEXT_IO.PUT_LINE( "Obtaining a buffer from the global partition" );
94
95         RTEMS.PARTITION_GET_BUFFER(
96            MPTEST.PARTITION_ID( 1 ),
97            BUFFER_ADDRESS,
98            STATUS
99         );
100         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" );
101         TEXT_IO.PUT( "Address returned was : " );
102         UNSIGNED32_IO.PUT(
103            RTEMS.SUBTRACT( BUFFER_ADDRESS, RTEMS.NULL_ADDRESS ),
104            WIDTH => 8,
105            BASE => 16
106         );
107         TEXT_IO.NEW_LINE;
108
109         RTEMS.PARTITION_RETURN_BUFFER(
110            MPTEST.PARTITION_ID( 1 ),
111            BUFFER_ADDRESS,
112            STATUS
113         );
114         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" );
115
116         RTEMS.TASK_WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
117         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
118
119      else
120
121         TEXT_IO.PUT_LINE( "Creating Partition (Global)" );
122         RTEMS.PARTITION_CREATE(
123            MPTEST.PARTITION_NAME( 1 ),
124            MPTEST.PARTITION_AREA( 0 )'ADDRESS,
125            128,
126            64,
127            RTEMS.GLOBAL,
128            MPTEST.PARTITION_ID( 1 ),
129            STATUS
130         );
131         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" );
132
133         TEXT_IO.PUT_LINE( "Sleeping for three seconds" );
134         RTEMS.TASK_WAKE_AFTER( 3 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS );
135         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" );
136
137         TEXT_IO.PUT_LINE( "Deleting Partition (Global)" );
138         RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS );
139         TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE" );
140
141      end if;
142
143      TEXT_IO.PUT_LINE( "*** END OF TEST 12 ***" );
144
145      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
146
147   end INIT;
148
149end MPTEST;
Note: See TracBrowser for help on using the repository browser.