annotate gcc/testsuite/ada/acats/tests/c9/c954014.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 -- C954014.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 a requeue is not canceled and that the requeueing
kono
parents:
diff changeset
28 -- task is unaffected when a calling task is aborted. Check that the
kono
parents:
diff changeset
29 -- abort is deferred until the entry call is complete.
kono
parents:
diff changeset
30 -- Specifically, check requeue to an entry in a different task,
kono
parents:
diff changeset
31 -- requeue where the entry call has parameters, and requeue
kono
parents:
diff changeset
32 -- without the abort option.
kono
parents:
diff changeset
33 --
kono
parents:
diff changeset
34 -- TEST DESCRIPTION
kono
parents:
diff changeset
35 -- In the Driver create a task that places a call on the
kono
parents:
diff changeset
36 -- Distributor. In the Distributor requeue this call on the Credit task.
kono
parents:
diff changeset
37 -- Abort the calling task when it is known to be in rendezvous with the
kono
parents:
diff changeset
38 -- Credit task. (We arrange this by using artificial synchronization
kono
parents:
diff changeset
39 -- points in the Driver and the accept body of the Credit task) Ensure
kono
parents:
diff changeset
40 -- that the abort is deferred (the task is not terminated) until the
kono
parents:
diff changeset
41 -- accept body completes. Afterwards, send one extra message through
kono
parents:
diff changeset
42 -- the Distributor to check that the requeueing task has not been
kono
parents:
diff changeset
43 -- disrupted.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 -- This series of tests uses a simulation of a transaction driven
kono
parents:
diff changeset
46 -- processing system. Line Drivers accept input from an external source
kono
parents:
diff changeset
47 -- and build them into transaction records. These records are then
kono
parents:
diff changeset
48 -- encapsulated in message tasks which remain extant for the life of the
kono
parents:
diff changeset
49 -- transaction in the system. The message tasks put themselves on the
kono
parents:
diff changeset
50 -- input queue of a Distributor which, from information in the
kono
parents:
diff changeset
51 -- transaction and/or system load conditions forwards them to other
kono
parents:
diff changeset
52 -- operating tasks. These in turn might forward the transactions to yet
kono
parents:
diff changeset
53 -- other tasks for further action. The routing is, in real life, dynamic
kono
parents:
diff changeset
54 -- and unpredictable at the time of message generation. All rerouting in
kono
parents:
diff changeset
55 -- this model is done by means of requeues.
kono
parents:
diff changeset
56 --
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 -- CHANGE HISTORY:
kono
parents:
diff changeset
59 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
60 -- 25 Nov 95 SAIC Replaced global variables with protected objects
kono
parents:
diff changeset
61 -- for ACVC 2.0.1.
kono
parents:
diff changeset
62 --
kono
parents:
diff changeset
63 --!
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 with Report;
kono
parents:
diff changeset
66 with ImpDef;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 procedure C954014 is
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 -- Arbitrary test values
kono
parents:
diff changeset
71 Credit_Return : constant := 1;
kono
parents:
diff changeset
72 Debit_Return : constant := 2;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 protected type Shared_Boolean (Initial_Value : Boolean := False) is
kono
parents:
diff changeset
76 procedure Set_True;
kono
parents:
diff changeset
77 procedure Set_False;
kono
parents:
diff changeset
78 function Value return Boolean;
kono
parents:
diff changeset
79 private
kono
parents:
diff changeset
80 Current_Value : Boolean := Initial_Value;
kono
parents:
diff changeset
81 end Shared_Boolean;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 protected body Shared_Boolean is
kono
parents:
diff changeset
84 procedure Set_True is
kono
parents:
diff changeset
85 begin
kono
parents:
diff changeset
86 Current_Value := True;
kono
parents:
diff changeset
87 end Set_True;
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 procedure Set_False is
kono
parents:
diff changeset
90 begin
kono
parents:
diff changeset
91 Current_Value := False;
kono
parents:
diff changeset
92 end Set_False;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 function Value return Boolean is
kono
parents:
diff changeset
95 begin
kono
parents:
diff changeset
96 return Current_Value;
kono
parents:
diff changeset
97 end Value;
kono
parents:
diff changeset
98 end Shared_Boolean;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 TC_Debit_Message_Complete : Shared_Boolean (False);
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- Synchronization flags for handshaking between the Line_Driver
kono
parents:
diff changeset
104 -- and the Accept body in the Credit Task
kono
parents:
diff changeset
105 TC_Handshake_A : Shared_Boolean (False);
kono
parents:
diff changeset
106 TC_Handshake_B : Shared_Boolean (False);
kono
parents:
diff changeset
107 TC_Handshake_C : Shared_Boolean (False);
kono
parents:
diff changeset
108 TC_Handshake_D : Shared_Boolean (False);
kono
parents:
diff changeset
109 TC_Handshake_E : Shared_Boolean (False);
kono
parents:
diff changeset
110 TC_Handshake_F : Shared_Boolean (False);
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 type Transaction_Code is (Credit, Debit);
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 type Transaction_Record;
kono
parents:
diff changeset
116 type acc_Transaction_Record is access Transaction_Record;
kono
parents:
diff changeset
117 type Transaction_Record is
kono
parents:
diff changeset
118 record
kono
parents:
diff changeset
119 ID : integer := 0;
kono
parents:
diff changeset
120 Code : Transaction_Code := Debit;
kono
parents:
diff changeset
121 Account_Number : integer := 0;
kono
parents:
diff changeset
122 Stock_Number : integer := 0;
kono
parents:
diff changeset
123 Quantity : integer := 0;
kono
parents:
diff changeset
124 Return_Value : integer := 0;
kono
parents:
diff changeset
125 TC_Message_Count : integer := 0;
kono
parents:
diff changeset
126 TC_Thru_Distrib : Boolean;
kono
parents:
diff changeset
127 end record;
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 task type Message_Task is
kono
parents:
diff changeset
131 entry Accept_Transaction (In_Transaction : acc_Transaction_Record);
kono
parents:
diff changeset
132 end Message_Task;
kono
parents:
diff changeset
133 type acc_Message_Task is access Message_Task;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 task Line_Driver is
kono
parents:
diff changeset
136 entry start;
kono
parents:
diff changeset
137 end Line_Driver;
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 task Distributor is
kono
parents:
diff changeset
140 entry Input(Transaction : acc_Transaction_Record);
kono
parents:
diff changeset
141 end Distributor;
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 task Credit_Computation is
kono
parents:
diff changeset
144 entry Input(Transaction : acc_Transaction_Record);
kono
parents:
diff changeset
145 end Credit_Computation;
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 task Debit_Computation is
kono
parents:
diff changeset
148 entry Input(Transaction : acc_Transaction_Record);
kono
parents:
diff changeset
149 end Debit_Computation;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 -- Assemble messages received from an external source
kono
parents:
diff changeset
153 -- Creates a message task for each. The message tasks remain extant
kono
parents:
diff changeset
154 -- for the life of the messages in the system.
kono
parents:
diff changeset
155 -- TC: The Line Driver task would normally be designed to loop
kono
parents:
diff changeset
156 -- continuously creating the messages as input is received. Simulate
kono
parents:
diff changeset
157 -- this but limit it to two dummy messages for this test and use
kono
parents:
diff changeset
158 -- special artificial handshaking checks with the Credit accept body
kono
parents:
diff changeset
159 -- to control the test. Allow it to terminate at the end
kono
parents:
diff changeset
160 --
kono
parents:
diff changeset
161 task body Line_Driver is
kono
parents:
diff changeset
162 Current_ID : integer := 1;
kono
parents:
diff changeset
163 TC_First_message_sent: Boolean := false;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 procedure Build_Credit_Record
kono
parents:
diff changeset
166 ( Next_Transaction : acc_Transaction_Record ) is
kono
parents:
diff changeset
167 Dummy_Account : constant integer := 100;
kono
parents:
diff changeset
168 begin
kono
parents:
diff changeset
169 Next_Transaction.ID := Current_ID;
kono
parents:
diff changeset
170 Next_Transaction.Code := Credit;
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 Next_Transaction.Account_Number := Dummy_Account;
kono
parents:
diff changeset
173 Current_ID := Current_ID + 1;
kono
parents:
diff changeset
174 end Build_Credit_Record;
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 procedure Build_Debit_Record
kono
parents:
diff changeset
178 ( Next_Transaction : acc_Transaction_Record ) is
kono
parents:
diff changeset
179 Dummy_Account : constant integer := 200;
kono
parents:
diff changeset
180 begin
kono
parents:
diff changeset
181 Next_Transaction.ID := Current_ID;
kono
parents:
diff changeset
182 Next_Transaction.Code := Debit;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 Next_Transaction.Account_Number := Dummy_Account;
kono
parents:
diff changeset
185 Current_ID := Current_ID + 1;
kono
parents:
diff changeset
186 end Build_Debit_Record;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 begin
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 accept Start; -- Wait for trigger from main
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 for i in 1..2 loop -- TC: arbitrarily limit to one credit message
kono
parents:
diff changeset
193 -- and one debit, then complete
kono
parents:
diff changeset
194 declare
kono
parents:
diff changeset
195 -- Create a task for the next message
kono
parents:
diff changeset
196 Next_Message_Task : acc_Message_Task := new Message_Task;
kono
parents:
diff changeset
197 -- Create a record for it
kono
parents:
diff changeset
198 Next_Transaction : acc_Transaction_Record :=
kono
parents:
diff changeset
199 new Transaction_Record;
kono
parents:
diff changeset
200 begin
kono
parents:
diff changeset
201 if not TC_First_Message_Sent then
kono
parents:
diff changeset
202 -- send out the first message which will be aborted
kono
parents:
diff changeset
203 Build_Credit_Record ( Next_Transaction );
kono
parents:
diff changeset
204 Next_Message_Task.Accept_Transaction ( Next_Transaction );
kono
parents:
diff changeset
205 TC_First_Message_Sent := true;
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 -- Wait for Credit task to get into the accept body
kono
parents:
diff changeset
208 -- The call from the Message Task has been requeued by
kono
parents:
diff changeset
209 -- the distributor
kono
parents:
diff changeset
210 while not TC_Handshake_A.Value loop
kono
parents:
diff changeset
211 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
212 end loop;
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 -- Abort the calling task; the Credit task is guaranteed to
kono
parents:
diff changeset
215 -- be in the accept body
kono
parents:
diff changeset
216 abort Next_Message_Task.all; -- We are still in this declare
kono
parents:
diff changeset
217 -- block
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 -- Inform the Credit task that the abort has been initiated
kono
parents:
diff changeset
220 TC_Handshake_B.Set_True;
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 -- Now wait for the "acknowledgment" from the Credit task
kono
parents:
diff changeset
223 -- this ensures a complete task switch (at least)
kono
parents:
diff changeset
224 while not TC_Handshake_C.Value loop
kono
parents:
diff changeset
225 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
226 end loop;
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 -- The aborted task must not terminate till the accept body
kono
parents:
diff changeset
229 -- has completed
kono
parents:
diff changeset
230 if Next_Message_Task'terminated then
kono
parents:
diff changeset
231 Report.Failed ("The abort was not deferred");
kono
parents:
diff changeset
232 end if;
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 -- Inform the Credit task that the termination has been checked
kono
parents:
diff changeset
235 TC_Handshake_D.Set_True;
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 -- Now wait for the completion of the accept body in the
kono
parents:
diff changeset
238 -- Credit task
kono
parents:
diff changeset
239 while not TC_Handshake_E.Value loop
kono
parents:
diff changeset
240 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
241 end loop;
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 while not ( Next_Message_Task'terminated ) loop
kono
parents:
diff changeset
244 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
245 end loop;
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 -- Indicate to the Main program that this section is complete
kono
parents:
diff changeset
248 TC_Handshake_F.Set_True;
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 else
kono
parents:
diff changeset
251 -- The main part of the test is complete. Send one Debit message
kono
parents:
diff changeset
252 -- as further exercise of the Distributor to ensure it has not
kono
parents:
diff changeset
253 -- been affected by the abort of the requeue;
kono
parents:
diff changeset
254 Build_Debit_Record ( Next_Transaction );
kono
parents:
diff changeset
255 Next_Message_Task.Accept_Transaction ( Next_Transaction );
kono
parents:
diff changeset
256 end if;
kono
parents:
diff changeset
257 end; -- declare
kono
parents:
diff changeset
258 end loop;
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 exception
kono
parents:
diff changeset
261 when others =>
kono
parents:
diff changeset
262 Report.Failed ("Unexpected exception in Line_Driver");
kono
parents:
diff changeset
263 end Line_Driver;
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 task body Message_Task is
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 TC_Original_Transaction_Code : Transaction_Code;
kono
parents:
diff changeset
270 This_Transaction : acc_Transaction_Record := new Transaction_Record;
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 begin
kono
parents:
diff changeset
273
kono
parents:
diff changeset
274 accept Accept_Transaction (In_Transaction : acc_Transaction_Record) do
kono
parents:
diff changeset
275 This_Transaction.all := In_Transaction.all;
kono
parents:
diff changeset
276 end Accept_Transaction;
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 -- Note the original code to ensure correct return
kono
parents:
diff changeset
279 TC_Original_Transaction_Code := This_Transaction.Code;
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 -- Queue up on Distributor's Input queue
kono
parents:
diff changeset
282 Distributor.Input ( This_Transaction );
kono
parents:
diff changeset
283 -- This task will now wait for the requeued rendezvous
kono
parents:
diff changeset
284 -- to complete before proceeding
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 -- After the required computations have been performed
kono
parents:
diff changeset
287 -- return the Transaction_Record appropriately (probably to an output
kono
parents:
diff changeset
288 -- line driver)
kono
parents:
diff changeset
289 null; -- stub
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 -- For the test check that the return values are as expected
kono
parents:
diff changeset
292 if TC_Original_Transaction_Code /= This_Transaction.Code then
kono
parents:
diff changeset
293 -- Incorrect rendezvous
kono
parents:
diff changeset
294 Report.Failed ("Message Task: Incorrect code returned");
kono
parents:
diff changeset
295 end if;
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 if This_Transaction.Code = Credit then
kono
parents:
diff changeset
298 -- The only Credit message was the one that should have been aborted
kono
parents:
diff changeset
299 Report.Failed ("Abort was not effective");
kono
parents:
diff changeset
300 else
kono
parents:
diff changeset
301 if This_Transaction.Return_Value /= Debit_Return or
kono
parents:
diff changeset
302 This_Transaction.TC_Message_Count /= 1 or not
kono
parents:
diff changeset
303 This_Transaction.TC_Thru_Distrib then
kono
parents:
diff changeset
304 Report.Failed ("Expected path not traversed");
kono
parents:
diff changeset
305 end if;
kono
parents:
diff changeset
306 TC_Debit_Message_Complete.Set_True;
kono
parents:
diff changeset
307 end if;
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 exception
kono
parents:
diff changeset
310 when others =>
kono
parents:
diff changeset
311 Report.Failed ("Unexpected exception in Message_Task");
kono
parents:
diff changeset
312
kono
parents:
diff changeset
313 end Message_Task;
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 -- Dispose each input Transaction_Record to the appropriate
kono
parents:
diff changeset
318 -- computation tasks
kono
parents:
diff changeset
319 --
kono
parents:
diff changeset
320 task body Distributor is
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 begin
kono
parents:
diff changeset
323 loop
kono
parents:
diff changeset
324 select
kono
parents:
diff changeset
325 accept Input (Transaction : acc_Transaction_Record) do
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 -- Indicate that the message did pass through the
kono
parents:
diff changeset
328 -- Distributor Task
kono
parents:
diff changeset
329 Transaction.TC_Thru_Distrib := true;
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 -- Pass this transaction on the appropriate computation
kono
parents:
diff changeset
332 -- task
kono
parents:
diff changeset
333 case Transaction.Code is
kono
parents:
diff changeset
334 when Credit =>
kono
parents:
diff changeset
335 requeue Credit_Computation.Input; -- without abort
kono
parents:
diff changeset
336 when Debit =>
kono
parents:
diff changeset
337 requeue Debit_Computation.Input; -- without abort
kono
parents:
diff changeset
338 end case;
kono
parents:
diff changeset
339 end Input;
kono
parents:
diff changeset
340 or
kono
parents:
diff changeset
341 terminate;
kono
parents:
diff changeset
342 end select;
kono
parents:
diff changeset
343 end loop;
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 exception
kono
parents:
diff changeset
346 when others =>
kono
parents:
diff changeset
347 Report.Failed ("Unexpected exception in Distributor");
kono
parents:
diff changeset
348 end Distributor;
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351
kono
parents:
diff changeset
352 -- Computation task.
kono
parents:
diff changeset
353 -- Note: After the computation is performed in this task and the
kono
parents:
diff changeset
354 -- accept body is completed the rendezvous in the original
kono
parents:
diff changeset
355 -- message task is completed.
kono
parents:
diff changeset
356 task body Credit_Computation is
kono
parents:
diff changeset
357 Message_Count : integer := 0;
kono
parents:
diff changeset
358 begin
kono
parents:
diff changeset
359 loop
kono
parents:
diff changeset
360 select
kono
parents:
diff changeset
361 accept Input ( Transaction : acc_Transaction_Record) do
kono
parents:
diff changeset
362 -- Perform the computations required for this transaction
kono
parents:
diff changeset
363 --
kono
parents:
diff changeset
364 null; -- stub
kono
parents:
diff changeset
365
kono
parents:
diff changeset
366 -- The rest of this code is for Test Control
kono
parents:
diff changeset
367 --
kono
parents:
diff changeset
368 if not Transaction.TC_Thru_Distrib then
kono
parents:
diff changeset
369 Report.Failed
kono
parents:
diff changeset
370 ("Credit Task: Wrong queue, Distributor bypassed");
kono
parents:
diff changeset
371 end if;
kono
parents:
diff changeset
372 if Transaction.code /= Credit then
kono
parents:
diff changeset
373 Report.Failed
kono
parents:
diff changeset
374 ("Credit Task: Requeue delivered to the wrong queue");
kono
parents:
diff changeset
375 end if;
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 -- for the test plug a known value and count
kono
parents:
diff changeset
378 Transaction.Return_Value := Credit_Return;
kono
parents:
diff changeset
379 -- one, and only one message should pass through
kono
parents:
diff changeset
380 if Message_Count /= 0 then
kono
parents:
diff changeset
381 Report.Failed ("Aborted Requeue was not canceled -1");
kono
parents:
diff changeset
382 end if;
kono
parents:
diff changeset
383 Message_Count := Message_Count + 1;
kono
parents:
diff changeset
384 Transaction.TC_Message_Count := Message_Count;
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 -- Having done the basic housekeeping we now need to signal
kono
parents:
diff changeset
387 -- that we are in the accept body of the credit task. The
kono
parents:
diff changeset
388 -- message has arrived and the Line Driver may now abort the
kono
parents:
diff changeset
389 -- calling task
kono
parents:
diff changeset
390 TC_Handshake_A.Set_True;
kono
parents:
diff changeset
391
kono
parents:
diff changeset
392 -- Now wait for the Line Driver to inform us the calling
kono
parents:
diff changeset
393 -- task has been aborted
kono
parents:
diff changeset
394 while not TC_Handshake_B.Value loop
kono
parents:
diff changeset
395 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
396 end loop;
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 -- The abort has taken place
kono
parents:
diff changeset
399 -- Inform the Line Driver that we are still running in the
kono
parents:
diff changeset
400 -- accept body
kono
parents:
diff changeset
401 TC_Handshake_C.Set_True;
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 -- Now wait for the Line Driver to digest this information
kono
parents:
diff changeset
404 while not TC_Handshake_D.Value loop
kono
parents:
diff changeset
405 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
406 end loop;
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 -- The Line driver has checked that the caller is not terminated
kono
parents:
diff changeset
409 -- We can now complete the accept
kono
parents:
diff changeset
410
kono
parents:
diff changeset
411 end Input;
kono
parents:
diff changeset
412 -- We are out of the accept
kono
parents:
diff changeset
413 TC_Handshake_E.Set_True;
kono
parents:
diff changeset
414
kono
parents:
diff changeset
415 or
kono
parents:
diff changeset
416 terminate;
kono
parents:
diff changeset
417 end select;
kono
parents:
diff changeset
418 end loop;
kono
parents:
diff changeset
419 exception
kono
parents:
diff changeset
420 when others =>
kono
parents:
diff changeset
421 Report.Failed ("Unexpected exception in Credit_Computation");
kono
parents:
diff changeset
422 end Credit_Computation;
kono
parents:
diff changeset
423
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425
kono
parents:
diff changeset
426 -- Computation task.
kono
parents:
diff changeset
427 -- Note: After the computation is performed in this task and the
kono
parents:
diff changeset
428 -- accept body is completed the rendezvous in the original
kono
parents:
diff changeset
429 -- message task is completed.
kono
parents:
diff changeset
430 task body Debit_Computation is
kono
parents:
diff changeset
431 Message_Count : integer := 0;
kono
parents:
diff changeset
432 begin
kono
parents:
diff changeset
433 loop
kono
parents:
diff changeset
434 select
kono
parents:
diff changeset
435 accept Input (Transaction : acc_Transaction_Record) do
kono
parents:
diff changeset
436 -- Perform the computations required for this message
kono
parents:
diff changeset
437 --
kono
parents:
diff changeset
438 null; -- stub
kono
parents:
diff changeset
439
kono
parents:
diff changeset
440 -- The rest of this code is for Test Control
kono
parents:
diff changeset
441 --
kono
parents:
diff changeset
442 if not Transaction.TC_Thru_Distrib then
kono
parents:
diff changeset
443 Report.Failed
kono
parents:
diff changeset
444 ("Debit Task: Wrong queue, Distributor bypassed");
kono
parents:
diff changeset
445 end if;
kono
parents:
diff changeset
446 if Transaction.code /= Debit then
kono
parents:
diff changeset
447 Report.Failed
kono
parents:
diff changeset
448 ("Debit Task: Requeue delivered to the wrong queue");
kono
parents:
diff changeset
449 end if;
kono
parents:
diff changeset
450
kono
parents:
diff changeset
451 -- for the test plug a known value and count
kono
parents:
diff changeset
452 Transaction.Return_Value := Debit_Return;
kono
parents:
diff changeset
453 -- one, and only one, message should pass through
kono
parents:
diff changeset
454 Message_Count := Message_Count + 1;
kono
parents:
diff changeset
455 Transaction.TC_Message_Count := Message_Count;
kono
parents:
diff changeset
456 end Input;
kono
parents:
diff changeset
457 or
kono
parents:
diff changeset
458 terminate;
kono
parents:
diff changeset
459 end select;
kono
parents:
diff changeset
460 end loop;
kono
parents:
diff changeset
461 exception
kono
parents:
diff changeset
462 when others =>
kono
parents:
diff changeset
463 Report.Failed ("Unexpected exception in Debit_Computation");
kono
parents:
diff changeset
464
kono
parents:
diff changeset
465
kono
parents:
diff changeset
466 end Debit_Computation;
kono
parents:
diff changeset
467
kono
parents:
diff changeset
468
kono
parents:
diff changeset
469 begin -- c954014
kono
parents:
diff changeset
470 Report.Test ("C954014", "Abort a task that has a call" &
kono
parents:
diff changeset
471 " requeued_without_abort");
kono
parents:
diff changeset
472
kono
parents:
diff changeset
473 Line_Driver.Start; -- Start the test
kono
parents:
diff changeset
474
kono
parents:
diff changeset
475 -- Wait for the message tasks to complete before reporting the result
kono
parents:
diff changeset
476 --
kono
parents:
diff changeset
477 while not (TC_Handshake_F.Value -- abort not effective?
kono
parents:
diff changeset
478 and TC_Debit_Message_Complete.Value -- Distributor affected?
kono
parents:
diff changeset
479 and TC_Handshake_E.Value ) loop -- accept not completed?
kono
parents:
diff changeset
480 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
481 end loop;
kono
parents:
diff changeset
482
kono
parents:
diff changeset
483 Report.Result;
kono
parents:
diff changeset
484
kono
parents:
diff changeset
485 end C954014;