3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- With the triggering statement being a delay and with the Asynchronous
28 -- Select statement being in a tasking situation complete the abortable
29 -- part before the delay expires. Check that the delay is cancelled
30 -- and that the optional statements in the triggering part are not
34 -- Simulate the creation of a carrier task to control the output of
35 -- a message via a line driver. If the message sending process is
36 -- not complete (the completion of the rendezvous) within a
37 -- specified time the carrier task is designed to take corrective action.
38 -- Use an asynchronous select to control the timing; arrange that
39 -- the abortable part (the rendezvous) completes almost immediately.
40 -- Check that the optional statements are not executed and that the
41 -- test completes well before the time of the trigger delay request thus
42 -- showing that it has been cancelled.
46 -- 06 Dec 94 SAIC ACVC 2.0
56 function "-" (Left
, Right
: Ada
.Calendar
.Time
)
57 return Duration renames Ada
.Calendar
."-";
58 TC_Start_Time
: Ada
.Calendar
.Time
:= Ada
.Calendar
.Clock
;
59 TC_Elapsed_Time
: duration;
61 -- Note: a properly executing test will complete immediately.
62 Allowable_ACK_Time
: duration := 600.0;
66 Report
.Test
("C960004", "ATC: When abortable part completes before " &
67 "a triggering delay, check that the delay " &
68 "is cancelled & optional statements " &
69 "are not performed. Tasking situation");
71 declare -- To get the Report.Result after all has completed
73 type Sequence_Number
is range 1..1_999_999
; -- Message Number
74 subtype S_length_subtype
is integer range 1..80;
76 type Message_Type
(Max_String
: S_length_subtype
:= 1) is
78 Message_Number
: Sequence_Number
;
79 Alpha
: string(1..Max_String
);
82 -- TC: Dummy message for the test
83 Dummy_Alpha
: constant string := "This could be printed";
84 Message_to_Send
: Message_Type
(Max_string
=> Dummy_Alpha
'length);
87 -- This is the carrier task. One of these is created for each
88 -- message that requires ACK
90 task type Require_ACK_task
is
91 entry Message_In
(Message_to_Send
: Message_Type
);
93 type acc_Require_ACK_task
is access Require_ACK_task
;
96 --:::::::::::::::::::::::::::::::::
97 -- There would also be another task type "No_ACK_Task" which would
98 -- be the carrier task for those messages not requiring an ACK.
99 -- This task would call Send_Message.ACK_Not_Required. It is not
100 -- shown in this test as it is not used.
101 --:::::::::::::::::::::::::::::::::
106 entry ACK_Required
(Message_to_Send
: Message_Type
);
107 entry ACK_Not_Required
(Message_to_Send
: Message_Type
);
111 -- This is the carrier task. One of these is created for each
112 -- message that requires ACK
114 task body Require_ACK_task
is
115 Hold_Message
: Message_Type
;
117 procedure Time_Out
(Failed_Message_Number
: Sequence_Number
) is
119 -- Take remedial action on the timed-out message
122 Report
.Failed
("Optional statements in triggering part" &
127 accept Message_In
(Message_to_Send
: Message_Type
) do
128 Hold_Message
:= Message_to_Send
; -- to release caller
131 -- Now put the message out to the Send_Message task and
132 -- wait (no more than Allowable_Ack_Time) for its completion
135 delay Allowable_ACK_Time
;
136 -- ACK not received in specified time
137 Time_out
(Hold_Message
.Message_Number
);
139 -- If the rendezvous is not completed in the above time, this
141 -- Note: for this test this call will complete immediately
142 -- and thus the trigger should be cancelled
143 Send_Message
.ACK_Required
(Hold_Message
);
148 Report
.Failed
("Unexpected exception in Require_ACK_task");
149 end Require_ACK_task
;
152 -- This is the Line Driver task
154 task body Send_Message
is
155 Hold_Non_ACK_Message
: Message_Type
;
159 accept ACK_Required
(Message_to_Send
: Message_Type
) do
160 -- Here send the message from within the rendezvous
161 -- waiting for full transmission to complete
163 -- Note: In this test this accept will complete immediately
166 accept ACK_Not_Required
(Message_to_Send
: Message_Type
) do
167 Hold_Non_ACK_Message
:= Message_to_Send
;
168 end ACK_Not_Required
;
169 -- Here send the message from outside the rendezvous
176 when others => Report
.Failed
("Unexpected exception in Send_Message");
180 -- Build a dummy message
181 Message_to_Send
.Alpha
:= Dummy_Alpha
;
182 Message_to_Send
.Message_Number
:= 110_693
;
185 New_Require_ACK_task
: acc_Require_ACK_task
:=
186 new Require_ACK_task
;
188 -- Create a carrier task for this message and pass the latter in
189 New_Require_ACK_task
.Message_In
(Message_to_Send
);
194 --Once we are out of the above declarative region, all tasks have completed
196 TC_Elapsed_Time
:= Ada
.Calendar
.Clock
- TC_Start_Time
;
198 -- Check that the test has completed well before the time of the requested
199 -- delay to ensure the delay was cancelled
201 if (TC_Elapsed_Time
> Allowable_ACK_Time
/2) then
202 Report
.Failed
("Triggering delay statement was not cancelled");