annotate gcc/testsuite/ada/acats/tests/c9/c974012.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 -- C974012.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 the abortable part of an asynchronous select statement is
kono
parents:
diff changeset
28 -- aborted if it does not complete before the triggering statement
kono
parents:
diff changeset
29 -- completes, where the triggering statement is a call on a protected
kono
parents:
diff changeset
30 -- entry which is queued.
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- TEST DESCRIPTION:
kono
parents:
diff changeset
33 -- A fraction of in-line code is simulated. A voltage deficiency causes
kono
parents:
diff changeset
34 -- the routine to seek an alternate best-cost route on an electrical grid
kono
parents:
diff changeset
35 -- system.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- An asynchronous select is used with the triggering alternative being a
kono
parents:
diff changeset
38 -- call to a protected entry with a barrier. The abortable part is a
kono
parents:
diff changeset
39 -- routine simulating the lengthy alternate path negotiation. The entry
kono
parents:
diff changeset
40 -- barrier would be cleared if the voltage deficiency is rectified before
kono
parents:
diff changeset
41 -- the alternate can be found thus nullifying the need for the alternate.
kono
parents:
diff changeset
42 --
kono
parents:
diff changeset
43 -- The test simulates a return to normal in the middle of the
kono
parents:
diff changeset
44 -- negotiation. The barrier is cleared, the triggering alternative
kono
parents:
diff changeset
45 -- completes first and the abortable part should be aborted.
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 --
kono
parents:
diff changeset
48 -- CHANGE HISTORY:
kono
parents:
diff changeset
49 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
50 --
kono
parents:
diff changeset
51 --!
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 with Report;
kono
parents:
diff changeset
55 with ImpDef;
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 procedure C974012 is
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 subtype Grid_Path is string(1..21);
kono
parents:
diff changeset
60 subtype Deficiency is integer range 100..1_000; -- in MWh
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 New_Path : Grid_Path;
kono
parents:
diff changeset
63 Dummy_Deficiency : Deficiency := 520;
kono
parents:
diff changeset
64 Path_Available : Boolean := false;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 TC_Terminate_Negotiation_Executed : Boolean := false;
kono
parents:
diff changeset
67 TC_Trigger_Completed : Boolean := false;
kono
parents:
diff changeset
68 TC_Negotiation_Completed : Boolean := false;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 protected Local_Deficit is
kono
parents:
diff changeset
71 procedure Set_Good_Voltage;
kono
parents:
diff changeset
72 procedure Bad_Voltage;
kono
parents:
diff changeset
73 entry Terminate_Negotiation;
kono
parents:
diff changeset
74 private
kono
parents:
diff changeset
75 Good_Voltage : Boolean := false; -- barrier
kono
parents:
diff changeset
76 end Local_Deficit;
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 protected body Local_Deficit is
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 procedure Set_Good_Voltage is
kono
parents:
diff changeset
81 begin
kono
parents:
diff changeset
82 Good_Voltage := true;
kono
parents:
diff changeset
83 end Set_Good_Voltage;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 procedure Bad_Voltage is
kono
parents:
diff changeset
86 begin
kono
parents:
diff changeset
87 Good_Voltage := false;
kono
parents:
diff changeset
88 end Bad_Voltage;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 -- Trigger is queued on this entry with barrier condition
kono
parents:
diff changeset
91 entry Terminate_Negotiation when Good_Voltage is
kono
parents:
diff changeset
92 begin
kono
parents:
diff changeset
93 -- complete the triggering call thus terminating grid_path
kono
parents:
diff changeset
94 -- negotiation.
kono
parents:
diff changeset
95 null; --::: stub - signal main board
kono
parents:
diff changeset
96 TC_Terminate_Negotiation_Executed := true; -- show path traversal
kono
parents:
diff changeset
97 end Terminate_Negotiation;
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 end Local_Deficit;
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 -- Routine to find the most cost effective grid path for this
kono
parents:
diff changeset
103 -- particular deficiency at this particular time
kono
parents:
diff changeset
104 --
kono
parents:
diff changeset
105 procedure Path_Negotiation (Requirement : in Deficiency;
kono
parents:
diff changeset
106 Best_Path : out Grid_Path ) is
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 Dummy_Path : Grid_Path := "NYC.425_NY.227_NH.132";
kono
parents:
diff changeset
109 Match : Deficiency := Report.Ident_Int (Requirement);
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 begin
kono
parents:
diff changeset
112 --
kono
parents:
diff changeset
113 null; --::: stub
kono
parents:
diff changeset
114 --
kono
parents:
diff changeset
115 -- Simulate a lengthy path negotiation
kono
parents:
diff changeset
116 for i in 1..5 loop
kono
parents:
diff changeset
117 delay ImpDef.Minimum_Task_Switch;
kono
parents:
diff changeset
118 -- Part of the way through the negotiation simulate some external
kono
parents:
diff changeset
119 -- event returning the voltage to acceptable level
kono
parents:
diff changeset
120 if i = 3 then
kono
parents:
diff changeset
121 Local_Deficit.Set_Good_Voltage; -- clear the barrier
kono
parents:
diff changeset
122 end if;
kono
parents:
diff changeset
123 end loop;
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 Best_Path := Dummy_Path;
kono
parents:
diff changeset
126 TC_Negotiation_Completed := true;
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 end Path_Negotiation;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 begin
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 Report.Test ("C974012", "Asynchronous Select: Trigger is queued on a " &
kono
parents:
diff changeset
135 "protected entry and completes before the " &
kono
parents:
diff changeset
136 "abortable part");
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 -- ::::::::: Fragment of code
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 Local_Deficit.Bad_Voltage; -- Set barrier condition
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 -- For the given voltage deficiency start negotiating the best grid
kono
parents:
diff changeset
143 -- path. If voltage returns to acceptable level cancel the negotiation
kono
parents:
diff changeset
144 --
kono
parents:
diff changeset
145 select
kono
parents:
diff changeset
146 -- Prepare to terminate the Path_Negotiation if voltage improves
kono
parents:
diff changeset
147 Local_Deficit.Terminate_Negotiation;
kono
parents:
diff changeset
148 TC_Trigger_Completed := true;
kono
parents:
diff changeset
149 then abort
kono
parents:
diff changeset
150 Path_Negotiation (Dummy_Deficiency, New_Path) ;
kono
parents:
diff changeset
151 Path_Available := true;
kono
parents:
diff changeset
152 end select;
kono
parents:
diff changeset
153 -- :::::::::
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 if not TC_Terminate_Negotiation_Executed or else not
kono
parents:
diff changeset
156 TC_Trigger_Completed then
kono
parents:
diff changeset
157 Report.Failed ("Unexpected test path taken");
kono
parents:
diff changeset
158 end if;
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 if Path_Available or else TC_Negotiation_Completed then
kono
parents:
diff changeset
161 Report.Failed ("Abortable part was not aborted");
kono
parents:
diff changeset
162 end if;
kono
parents:
diff changeset
163 Report.Result;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 end C974012;