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 -- Check that if the original protected entry call was a conditional
28 -- entry call, the call is cancelled if a requeue-with-abort of the
29 -- call is not selected immediately.
30 -- Check that if the original protected entry call was a timed entry
31 -- call, the expiration time for a requeue-with-abort is the original
35 -- In this test the main task makes a variety of calls to the protected
36 -- object Initial_PO. These calls include a simple call, a conditional
37 -- call, and a timed call. The timed calls include calls with enough
38 -- time and those with less than the needed amount of time to get through
39 -- the requeue performed by Initial_PO.
40 -- Initial_PO requeues its entry call to Final_PO.
41 -- Final_PO does not accept the requeued call until the protected
42 -- procedure Ok_To_Take_Requeue is called.
43 -- A separate task, Delayed_Opener, is used to call Ok_To_Take_Requeue
44 -- after a delay amount specified by the main task has expired.
48 -- 15 DEC 95 SAIC ACVC 2.1
49 -- 10 JUL 96 SAIC Incorporated reviewer comments.
50 -- 10 OCT 96 SAIC Incorporated fix provided by vendor.
55 use type Calendar
.Time
;
59 Verbose
: constant Boolean := False;
60 Final_Po_Reached
: Boolean := False;
61 Allowed_Time
: constant Duration := 2.0 * Impdef
.One_Long_Second
;
62 Plenty_Of_Time
: constant Duration :=
63 Allowed_Time
+ Impdef
.Clear_Ready_Queue
+ 1.0 * Impdef
.One_Long_Second
;
64 Not_Enough_Time
: constant Duration := Allowed_Time
- 0.5 * Impdef
.One_Long_Second
;
66 Report
.Test
("C954026",
67 "Check that if the original entry" &
68 " call was a conditional or timed entry call," &
69 " the expiration time for a requeue with" &
70 " abort to a protected" &
71 " entry is the original expiration time");
74 protected Initial_Po
is
80 procedure Ok_To_Take_Requeue
;
81 procedure Close_Requeue
;
83 Open
: Boolean := False;
86 -- the Delayed_Opener task is used to notify Final_PO that it can
87 -- accept the Requeue_Target entry.
88 task Delayed_Opener
is
89 entry Start_Timer
(Amt
: Duration);
93 task body Delayed_Opener
is
97 accept Start_Timer
(Amt
: Duration) do
100 exit when Wait_Amt
< 0.0;
102 Report
.Comment
("Timer started");
105 accept Cancel_Timer
do
106 Final_Po
.Close_Requeue
;
110 Final_Po
.Ok_To_Take_Requeue
;
111 accept Cancel_Timer
do
112 Final_Po
.Close_Requeue
;
118 Report
.Failed
("exception in Delayed_Opener");
121 protected body Initial_Po
is
122 entry Start_Here
when True is
124 Final_Po_Reached
:= False;
125 requeue Final_Po
.Requeue_Target
with abort;
129 protected body Final_Po
is
130 entry Requeue_Target
when Open
is
133 Final_Po_Reached
:= True;
136 procedure Ok_To_Take_Requeue
is
139 end Ok_To_Take_Requeue
;
141 procedure Close_Requeue
is
147 begin -- test encapsulation
148 -- unconditional entry call to check the simple case
149 Delayed_Opener
.Start_Timer
(0.0);
150 Initial_Po
.Start_Here
;
151 if Final_Po_Reached
then
153 Report
.Comment
("simple case passed");
156 Report
.Failed
("simple case");
158 Delayed_Opener
.Cancel_Timer
;
161 -- timed but with plenty of time - delay relative
162 Delayed_Opener
.Start_Timer
(Allowed_Time
);
164 Initial_Po
.Start_Here
;
166 delay Plenty_Of_Time
;
167 Report
.Failed
("plenty of time timed out (1)");
168 if Final_Po_Reached
then
170 "plenty of time timed out after accept (1)");
173 if Final_Po_Reached
then
175 Report
.Comment
("plenty of time case passed (1)");
178 Report
.Failed
("plenty of time (1)");
180 Delayed_Opener
.Cancel_Timer
;
183 -- timed but with plenty of time -- delay until
184 Delayed_Opener
.Start_Timer
(Allowed_Time
);
186 Initial_Po
.Start_Here
;
188 delay until Calendar
.Clock
+ Plenty_Of_Time
;
189 Report
.Failed
("plenty of time timed out (2)");
190 if Final_Po_Reached
then
192 "plenty of time timed out after accept(2)");
195 if Final_Po_Reached
then
197 Report
.Comment
("plenty of time case passed (2)");
200 Report
.Failed
("plenty of time (2)");
202 Delayed_Opener
.Cancel_Timer
;
205 -- timed without enough time - delay relative
206 Delayed_Opener
.Start_Timer
(Allowed_Time
);
208 Initial_Po
.Start_Here
;
209 Report
.Failed
("not enough time completed accept (1)");
211 delay Not_Enough_Time
;
213 if Final_Po_Reached
then
214 Report
.Failed
("not enough time (1)");
217 Report
.Comment
("not enough time case passed (1)");
220 Delayed_Opener
.Cancel_Timer
;
223 -- timed without enough time - delay until
224 Delayed_Opener
.Start_Timer
(Allowed_Time
);
226 Initial_Po
.Start_Here
;
227 Report
.Failed
("not enough time completed accept (2)");
229 delay until Calendar
.Clock
+ Not_Enough_Time
;
231 if Final_Po_Reached
then
232 Report
.Failed
("not enough time (2)");
235 Report
.Comment
("not enough time case passed (2)");
238 Delayed_Opener
.Cancel_Timer
;
242 Delayed_Opener
.Start_Timer
(Allowed_Time
);
244 Initial_Po
.Start_Here
;
245 Report
.Failed
("no time completed accept");
248 Report
.Comment
("conditional case - else taken");
251 if Final_Po_Reached
then
252 Report
.Failed
("no time");
255 Report
.Comment
("no time case passed");
258 Delayed_Opener
.Cancel_Timer
;
260 -- kill off the Delayed_Opener task
261 Delayed_Opener
.Start_Timer
(-10.0);
265 Report
.Failed
("exception in main");