annotate gcc/testsuite/ada/acats/tests/c9/c954017.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C954017.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that when an exception is raised in the rendezvous of a task
kono
parents:
diff changeset
28 -- that was called by a requeue the exception is propagated to the
kono
parents:
diff changeset
29 -- original caller and that the requeuing task is unaffected.
kono
parents:
diff changeset
30 --
kono
parents:
diff changeset
31 -- TEST DESCRIPTION:
kono
parents:
diff changeset
32 -- The Intermediate task requeues a call from the Original_Caller to the
kono
parents:
diff changeset
33 -- Receiver. While the Receiver is in the accept body for this
kono
parents:
diff changeset
34 -- rendezvous a Constraint_Error exception is raised. Check that the
kono
parents:
diff changeset
35 -- exception is propagated to the Original_Caller, that the Receiver's
kono
parents:
diff changeset
36 -- normal exception logic is employed and that the Intermediate task
kono
parents:
diff changeset
37 -- is undisturbed.
kono
parents:
diff changeset
38 -- There are several delay loops in this test any one of which could
kono
parents:
diff changeset
39 -- cause it to hang (and thus fail).
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 --
kono
parents:
diff changeset
42 -- CHANGE HISTORY:
kono
parents:
diff changeset
43 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
44 -- 25 Nov 95 SAIC Fixed shared global variable problem for
kono
parents:
diff changeset
45 -- ACVC 2.0.1
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 --!
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 with Report;
kono
parents:
diff changeset
50 with ImpDef;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 procedure C954017 is
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 TC_Original_Caller_Complete : Boolean := false;
kono
parents:
diff changeset
56 TC_Intermediate_Complete : Boolean := false;
kono
parents:
diff changeset
57 TC_Receiver_Complete : Boolean := false;
kono
parents:
diff changeset
58 TC_Exception : Exception;
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 protected type Shared_Boolean (Initial_Value : Boolean := False) is
kono
parents:
diff changeset
62 procedure Set_True;
kono
parents:
diff changeset
63 procedure Set_False;
kono
parents:
diff changeset
64 function Value return Boolean;
kono
parents:
diff changeset
65 private
kono
parents:
diff changeset
66 Current_Value : Boolean := Initial_Value;
kono
parents:
diff changeset
67 end Shared_Boolean;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 protected body Shared_Boolean is
kono
parents:
diff changeset
70 procedure Set_True is
kono
parents:
diff changeset
71 begin
kono
parents:
diff changeset
72 Current_Value := True;
kono
parents:
diff changeset
73 end Set_True;
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 procedure Set_False is
kono
parents:
diff changeset
76 begin
kono
parents:
diff changeset
77 Current_Value := False;
kono
parents:
diff changeset
78 end Set_False;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 function Value return Boolean is
kono
parents:
diff changeset
81 begin
kono
parents:
diff changeset
82 return Current_Value;
kono
parents:
diff changeset
83 end Value;
kono
parents:
diff changeset
84 end Shared_Boolean;
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 TC_Exception_Process_Complete : Shared_Boolean (False);
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 task Original_Caller is
kono
parents:
diff changeset
89 entry Start;
kono
parents:
diff changeset
90 end Original_Caller;
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 task Intermediate is
kono
parents:
diff changeset
93 entry Input;
kono
parents:
diff changeset
94 end Intermediate;
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 task Receiver is
kono
parents:
diff changeset
97 entry Input;
kono
parents:
diff changeset
98 end Receiver;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 task body Original_Caller is
kono
parents:
diff changeset
102 begin
kono
parents:
diff changeset
103 accept Start; -- wait for the trigger from Main
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 Intermediate.Input;
kono
parents:
diff changeset
106 Report.Failed ("Exception not propagated to Original_Caller");
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 exception
kono
parents:
diff changeset
109 when TC_Exception =>
kono
parents:
diff changeset
110 TC_Original_Caller_Complete := true; -- Expected behavior
kono
parents:
diff changeset
111 when others =>
kono
parents:
diff changeset
112 Report.Failed ("Unexpected Exception in Original_Caller task");
kono
parents:
diff changeset
113 end Original_Caller;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 task body Intermediate is
kono
parents:
diff changeset
117 begin
kono
parents:
diff changeset
118 accept Input do
kono
parents:
diff changeset
119 -- Within this accept call another task
kono
parents:
diff changeset
120 requeue Receiver.Input with abort;
kono
parents:
diff changeset
121 end Input;
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 -- Wait for Main to ensure that the exception housekeeping is finished
kono
parents:
diff changeset
124 while not TC_Exception_Process_Complete.Value loop
kono
parents:
diff changeset
125 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
126 end loop;
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 TC_Intermediate_Complete := true;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 exception
kono
parents:
diff changeset
131 when others =>
kono
parents:
diff changeset
132 Report.Failed ("Unexpected exception in Intermediate task");
kono
parents:
diff changeset
133 end Intermediate;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 task body Receiver is
kono
parents:
diff changeset
137 --
kono
parents:
diff changeset
138 begin
kono
parents:
diff changeset
139 accept Input do
kono
parents:
diff changeset
140 null; -- the user code for the rendezvous is stubbed out
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 -- Test Control: Raise an exception in the destination task which
kono
parents:
diff changeset
143 -- should then be propagated
kono
parents:
diff changeset
144 raise TC_Exception;
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 end Input;
kono
parents:
diff changeset
147 exception
kono
parents:
diff changeset
148 when TC_Exception =>
kono
parents:
diff changeset
149 TC_Receiver_Complete := true; -- expected behavior
kono
parents:
diff changeset
150 when others =>
kono
parents:
diff changeset
151 Report.Failed ("Unexpected Exception in Receiver Task");
kono
parents:
diff changeset
152 end Receiver;
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 begin
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 Report.Test ("C954017", "Requeue: exception processing");
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 Original_Caller.Start; -- Start the test after the Report.Test
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 -- Wait for the whole of the exception process to complete
kono
parents:
diff changeset
162 while not ( Original_Caller'terminated and Receiver'terminated ) loop
kono
parents:
diff changeset
163 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
164 end loop;
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 -- Inform the Intermediate task that the process is complete to allow
kono
parents:
diff changeset
167 -- it to continue to completion itself
kono
parents:
diff changeset
168 TC_Exception_Process_Complete.Set_True;
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 -- Wait for everything to settle before reporting the result
kono
parents:
diff changeset
171 while not ( Intermediate'terminated ) loop
kono
parents:
diff changeset
172 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
173 end loop;
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 if not ( TC_Original_Caller_Complete and
kono
parents:
diff changeset
177 TC_Intermediate_Complete and
kono
parents:
diff changeset
178 TC_Receiver_Complete) then
kono
parents:
diff changeset
179 Report.Failed ("Proper paths not traversed");
kono
parents:
diff changeset
180 end if;
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 Report.Result;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 end C954017;