1 | -- SPDX-License-Identifier: BSD-2-Clause |
---|
2 | |
---|
3 | -- |
---|
4 | -- Test_Support / SPECIFICATION |
---|
5 | -- |
---|
6 | -- DESCRIPTION: |
---|
7 | -- |
---|
8 | -- This package provides routines which aid the Test Suites |
---|
9 | -- and simplify their design and operation. |
---|
10 | -- |
---|
11 | -- DEPENDENCIES: |
---|
12 | -- |
---|
13 | -- |
---|
14 | -- |
---|
15 | -- COPYRIGHT (c) 1989-2009. |
---|
16 | -- On-Line Applications Research Corporation (OAR). |
---|
17 | -- |
---|
18 | -- Redistribution and use in source and binary forms, with or without |
---|
19 | -- modification, are permitted provided that the following conditions |
---|
20 | -- are met: |
---|
21 | -- 1. Redistributions of source code must retain the above copyright |
---|
22 | -- notice, this list of conditions and the following disclaimer. |
---|
23 | -- 2. Redistributions in binary form must reproduce the above copyright |
---|
24 | -- notice, this list of conditions and the following disclaimer in the |
---|
25 | -- documentation and/or other materials provided with the distribution. |
---|
26 | -- |
---|
27 | -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
28 | -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
29 | -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
30 | -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
31 | -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
32 | -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
33 | -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
34 | -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
35 | -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
36 | -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
37 | -- POSSIBILITY OF SUCH DAMAGE. |
---|
38 | -- |
---|
39 | |
---|
40 | with RTEMS; |
---|
41 | |
---|
42 | package Test_Support is |
---|
43 | |
---|
44 | procedure Ada_Test_Begin; |
---|
45 | pragma Import (C, Ada_Test_Begin, "ada_test_begin"); |
---|
46 | |
---|
47 | procedure Ada_Test_End; |
---|
48 | pragma Import (C, Ada_Test_End, "ada_test_end"); |
---|
49 | |
---|
50 | procedure Check_Type( |
---|
51 | t : in Long_Integer; |
---|
52 | s : in Long_Integer; |
---|
53 | a : in Long_Integer |
---|
54 | ); |
---|
55 | pragma Import (C, Check_Type, "check_type"); |
---|
56 | |
---|
57 | -- |
---|
58 | -- Fatal_Directive_Status |
---|
59 | -- |
---|
60 | -- DESCRIPTION: |
---|
61 | -- |
---|
62 | -- This subprogram checks if Status is equal to Desired. If so, it |
---|
63 | -- returns immediately. Otherwise, it prints the Message along with |
---|
64 | -- the Status and Desired status and invokes the Fatal_Error_Occurred |
---|
65 | -- directive. |
---|
66 | -- |
---|
67 | |
---|
68 | procedure Fatal_Directive_Status ( |
---|
69 | Status : in RTEMS.Status_Codes; |
---|
70 | Desired : in RTEMS.Status_Codes; |
---|
71 | Message : in STRING |
---|
72 | ); |
---|
73 | pragma Inline ( Fatal_Directive_Status ); |
---|
74 | |
---|
75 | -- Directive_Failed |
---|
76 | -- |
---|
77 | -- DESCRIPTION: |
---|
78 | -- |
---|
79 | -- This subprogram checks if Status is equal to Successful. If so, it |
---|
80 | -- returns immediately. Otherwise, it prints the Message along with |
---|
81 | -- the Status and Desired status and invokes the Fatal_Error_Occurred |
---|
82 | -- |
---|
83 | |
---|
84 | procedure Directive_Failed ( |
---|
85 | Status : in RTEMS.Status_Codes; |
---|
86 | Message : in STRING |
---|
87 | ); |
---|
88 | pragma Inline ( Directive_Failed ); |
---|
89 | |
---|
90 | -- |
---|
91 | -- Print_Time |
---|
92 | -- |
---|
93 | -- DESCRIPTION: |
---|
94 | -- |
---|
95 | -- This subprogram prints the Prefix string, following by the |
---|
96 | -- time of day in Time_Buffer, followed by the Suffix. |
---|
97 | -- |
---|
98 | |
---|
99 | procedure Print_Time ( |
---|
100 | Prefix : in STRING; |
---|
101 | Time_Buffer : in RTEMS.Time_Of_Day; |
---|
102 | Suffix : in STRING |
---|
103 | ); |
---|
104 | pragma Inline ( Print_Time ); |
---|
105 | |
---|
106 | -- |
---|
107 | -- Put_Dot |
---|
108 | -- |
---|
109 | -- DESCRIPTION: |
---|
110 | -- |
---|
111 | -- This subprogram prints a single character without a carriage return. |
---|
112 | -- |
---|
113 | |
---|
114 | procedure Put_Dot ( |
---|
115 | Buffer : in STRING |
---|
116 | ); |
---|
117 | pragma Inline ( Put_Dot ); |
---|
118 | |
---|
119 | -- |
---|
120 | -- Pause |
---|
121 | -- |
---|
122 | -- DESCRIPTION: |
---|
123 | -- |
---|
124 | -- This subprogram is used to pause screen output in the Test Suites |
---|
125 | -- until the user presses carriage return. |
---|
126 | -- |
---|
127 | |
---|
128 | procedure Pause; |
---|
129 | |
---|
130 | -- |
---|
131 | -- Pause_And_Screen_Number |
---|
132 | -- |
---|
133 | -- DESCRIPTION: |
---|
134 | -- |
---|
135 | -- This subprogram is used to pause screen output and print the current |
---|
136 | -- number in the Test Suites until the user presses carriage return. |
---|
137 | -- |
---|
138 | |
---|
139 | procedure Pause_And_Screen_Number ( |
---|
140 | SCREEN : in RTEMS.Unsigned32 |
---|
141 | ); |
---|
142 | |
---|
143 | -- |
---|
144 | -- Put_Name |
---|
145 | -- |
---|
146 | -- DESCRIPTION: |
---|
147 | -- |
---|
148 | -- This subprogram prints the RTEMS object Name. If New_Line is TRUE, |
---|
149 | -- then a carriage return is printed after the Name. |
---|
150 | -- |
---|
151 | |
---|
152 | procedure Put_Name ( |
---|
153 | Name : in RTEMS.Name; |
---|
154 | New_Line : in Boolean |
---|
155 | ); |
---|
156 | |
---|
157 | -- |
---|
158 | -- Task_Number |
---|
159 | -- |
---|
160 | -- DESCRIPTION: |
---|
161 | -- |
---|
162 | -- This function returns the task index which the test should use |
---|
163 | -- for TID. |
---|
164 | -- |
---|
165 | |
---|
166 | function Task_Number ( |
---|
167 | TID : in RTEMS.ID |
---|
168 | ) return RTEMS.Unsigned32; |
---|
169 | pragma Inline ( Task_Number ); |
---|
170 | |
---|
171 | -- |
---|
172 | -- Do_Nothing |
---|
173 | -- |
---|
174 | -- DESCRIPTION: |
---|
175 | -- |
---|
176 | -- This procedure is called when a test wishes to use a delay |
---|
177 | -- loop and insure that the compiler does not optimize it away. |
---|
178 | -- |
---|
179 | |
---|
180 | procedure Do_Nothing; |
---|
181 | |
---|
182 | -- |
---|
183 | -- Ticks_Per_Second is the number of RTEMS clock ticks which |
---|
184 | -- occur each second. |
---|
185 | -- |
---|
186 | |
---|
187 | function Ticks_Per_Second |
---|
188 | return RTEMS.Interval; |
---|
189 | |
---|
190 | -- |
---|
191 | -- Milliseconds_Per_Tick is the number of milliseconds which |
---|
192 | -- occur between each RTEMS clock tick. |
---|
193 | -- |
---|
194 | |
---|
195 | function Milliseconds_Per_Tick |
---|
196 | return RTEMS.Unsigned32; |
---|
197 | |
---|
198 | -- |
---|
199 | -- Return the size of the RTEMS Workspace |
---|
200 | -- |
---|
201 | |
---|
202 | function Work_Space_Size |
---|
203 | return RTEMS.Size; |
---|
204 | |
---|
205 | -- |
---|
206 | -- Return an indication of whether multiprocessing is configured |
---|
207 | -- |
---|
208 | |
---|
209 | function Is_Configured_Multiprocessing |
---|
210 | return Boolean; |
---|
211 | |
---|
212 | -- |
---|
213 | -- Node is the node number in a multiprocessor configuration |
---|
214 | -- |
---|
215 | |
---|
216 | function Node |
---|
217 | return RTEMS.Unsigned32; |
---|
218 | |
---|
219 | -- |
---|
220 | -- Longest time in seconds to run a test |
---|
221 | -- |
---|
222 | |
---|
223 | MAXIMUM_LONG_TEST_DURATION : RTEMS.UNSIGNED32; |
---|
224 | |
---|
225 | private |
---|
226 | |
---|
227 | end Test_Support; |
---|