1 | /* Screen11 |
---|
2 | * |
---|
3 | * This routine generates error screen 11 for test 9. |
---|
4 | * |
---|
5 | * Input parameters: NONE |
---|
6 | * |
---|
7 | * Output parameters: NONE |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-2009. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifdef HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | void Screen11() |
---|
24 | { |
---|
25 | void *buffer_address_1; |
---|
26 | void *buffer_address_2; |
---|
27 | void *buffer_address_3; |
---|
28 | rtems_status_code status; |
---|
29 | size_t size; |
---|
30 | |
---|
31 | status = rtems_partition_create( |
---|
32 | 0, |
---|
33 | Partition_good_area, |
---|
34 | 128, |
---|
35 | 40, |
---|
36 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
37 | &Junk_id |
---|
38 | ); |
---|
39 | fatal_directive_status( |
---|
40 | status, |
---|
41 | RTEMS_INVALID_NAME, |
---|
42 | "rtems_partition_create with illegal name" |
---|
43 | ); |
---|
44 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" ); |
---|
45 | |
---|
46 | status = rtems_partition_create( |
---|
47 | Partition_name[ 1 ], |
---|
48 | Partition_good_area, |
---|
49 | 0, |
---|
50 | 71, |
---|
51 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
52 | &Junk_id |
---|
53 | ); |
---|
54 | fatal_directive_status( |
---|
55 | status, |
---|
56 | RTEMS_INVALID_SIZE, |
---|
57 | "rtems_partition_create with illegal length" |
---|
58 | ); |
---|
59 | puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" ); |
---|
60 | |
---|
61 | status = rtems_partition_create( |
---|
62 | Partition_name[ 1 ], |
---|
63 | Partition_good_area, |
---|
64 | 128, |
---|
65 | 0, |
---|
66 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
67 | &Junk_id |
---|
68 | ); |
---|
69 | fatal_directive_status( |
---|
70 | status, |
---|
71 | RTEMS_INVALID_SIZE, |
---|
72 | "rtems_partition_create with illegal buffer size" |
---|
73 | ); |
---|
74 | puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" ); |
---|
75 | |
---|
76 | status = rtems_partition_create( |
---|
77 | Partition_name[ 1 ], |
---|
78 | Partition_good_area, |
---|
79 | 128, |
---|
80 | 256, |
---|
81 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
82 | &Junk_id |
---|
83 | ); |
---|
84 | fatal_directive_status( |
---|
85 | status, |
---|
86 | RTEMS_INVALID_SIZE, |
---|
87 | "rtems_partition_create with buffer_size > length" |
---|
88 | ); |
---|
89 | puts( |
---|
90 | "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE" |
---|
91 | ); |
---|
92 | |
---|
93 | /* |
---|
94 | * Attempt to create a partition with a buffer size that is not large |
---|
95 | * enough to account for the overhead. |
---|
96 | */ |
---|
97 | puts( |
---|
98 | "TA1 - rtems_partition_create - buffer size < overhead - RTEMS_INVALID_SIZE" |
---|
99 | ); |
---|
100 | #define SIZEOF_CHAIN_NODE 2 * sizeof(void *) |
---|
101 | for ( size=0 ; size < SIZEOF_CHAIN_NODE ; size++) { |
---|
102 | status = rtems_partition_create( |
---|
103 | Partition_name[ 1 ], |
---|
104 | Partition_good_area, |
---|
105 | size, |
---|
106 | 256, |
---|
107 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
108 | &Junk_id |
---|
109 | ); |
---|
110 | if ( status != RTEMS_INVALID_SIZE ) |
---|
111 | printf( "ERROR when size == %zu\n", size ); |
---|
112 | |
---|
113 | fatal_directive_status( |
---|
114 | status, |
---|
115 | RTEMS_INVALID_SIZE, |
---|
116 | "rtems_partition_create with buffer_size > length" |
---|
117 | ); |
---|
118 | } |
---|
119 | |
---|
120 | /* |
---|
121 | * The check for an object being global is only made if |
---|
122 | * multiprocessing is enabled. |
---|
123 | */ |
---|
124 | |
---|
125 | #if defined(RTEMS_MULTIPROCESSING) |
---|
126 | status = rtems_partition_create( |
---|
127 | Partition_name[ 1 ], |
---|
128 | Partition_good_area, |
---|
129 | 128, |
---|
130 | 64, |
---|
131 | RTEMS_GLOBAL, |
---|
132 | &Junk_id |
---|
133 | ); |
---|
134 | fatal_directive_status( |
---|
135 | status, |
---|
136 | RTEMS_MP_NOT_CONFIGURED, |
---|
137 | "rtems_partition_create of global" |
---|
138 | ); |
---|
139 | #endif |
---|
140 | puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" ); |
---|
141 | |
---|
142 | #if defined(_C3x) || defined(_C4x) |
---|
143 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS - SKIPPED" ); |
---|
144 | #else |
---|
145 | status = rtems_partition_create( |
---|
146 | Partition_name[ 1 ], |
---|
147 | Partition_bad_area, |
---|
148 | 128, |
---|
149 | 64, |
---|
150 | RTEMS_GLOBAL, |
---|
151 | &Junk_id |
---|
152 | ); |
---|
153 | fatal_directive_status( |
---|
154 | status, |
---|
155 | RTEMS_INVALID_ADDRESS, |
---|
156 | "rtems_partition_create with bad address" |
---|
157 | ); |
---|
158 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" ); |
---|
159 | #endif |
---|
160 | |
---|
161 | #if defined(_C3x) || defined(_C4x) |
---|
162 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE - SKIPPED" ); |
---|
163 | #else |
---|
164 | status = rtems_partition_create( |
---|
165 | Partition_name[ 1 ], |
---|
166 | Partition_good_area, |
---|
167 | 128, |
---|
168 | 35, |
---|
169 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
170 | &Junk_id |
---|
171 | ); |
---|
172 | fatal_directive_status( |
---|
173 | status, |
---|
174 | RTEMS_INVALID_SIZE, |
---|
175 | "rtems_partition_create with unaligned buffer_size" |
---|
176 | ); |
---|
177 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" ); |
---|
178 | #endif |
---|
179 | |
---|
180 | status = rtems_partition_delete( 100 ); |
---|
181 | fatal_directive_status( |
---|
182 | status, |
---|
183 | RTEMS_INVALID_ID, |
---|
184 | "rtems_partition_delete with illegal id" |
---|
185 | ); |
---|
186 | puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" ); |
---|
187 | |
---|
188 | status = rtems_partition_delete( rtems_build_id( 1, 1, 1, 256 ) ); |
---|
189 | fatal_directive_status( |
---|
190 | status, |
---|
191 | RTEMS_INVALID_ID, |
---|
192 | "rtems_partition_delete with illegal id" |
---|
193 | ); |
---|
194 | puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" ); |
---|
195 | |
---|
196 | /* get bad address */ |
---|
197 | status = rtems_partition_get_buffer( 100, NULL ); |
---|
198 | fatal_directive_status( |
---|
199 | status, |
---|
200 | RTEMS_INVALID_ADDRESS, |
---|
201 | "rtems_partition_get_buffer with NULL param" |
---|
202 | ); |
---|
203 | puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ADDRESS" ); |
---|
204 | |
---|
205 | /* get bad Id */ |
---|
206 | status = rtems_partition_get_buffer( 100, &buffer_address_1 ); |
---|
207 | fatal_directive_status( |
---|
208 | status, |
---|
209 | RTEMS_INVALID_ID, |
---|
210 | "rtems_partition_get_buffer with illegal id" |
---|
211 | ); |
---|
212 | puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" ); |
---|
213 | |
---|
214 | status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id ); |
---|
215 | fatal_directive_status( |
---|
216 | status, |
---|
217 | RTEMS_INVALID_NAME, |
---|
218 | "rtems_partition_ident with illegal name" |
---|
219 | ); |
---|
220 | puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" ); |
---|
221 | |
---|
222 | status = rtems_partition_return_buffer( 100, buffer_address_1 ); |
---|
223 | fatal_directive_status( |
---|
224 | status, |
---|
225 | RTEMS_INVALID_ID, |
---|
226 | "rtems_partition_return_buffer with illegal id" |
---|
227 | ); |
---|
228 | puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" ); |
---|
229 | |
---|
230 | /* create bad area */ |
---|
231 | status = rtems_partition_create( |
---|
232 | Partition_name[ 1 ], |
---|
233 | NULL, |
---|
234 | 128, |
---|
235 | 64, |
---|
236 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
237 | &Junk_id |
---|
238 | ); |
---|
239 | fatal_directive_status( |
---|
240 | status, |
---|
241 | RTEMS_INVALID_ADDRESS, |
---|
242 | "rtems_partition_return_buffer with NULL area" |
---|
243 | ); |
---|
244 | puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" ); |
---|
245 | |
---|
246 | /* create OK */ |
---|
247 | status = rtems_partition_create( |
---|
248 | Partition_name[ 1 ], |
---|
249 | Partition_good_area, |
---|
250 | 128, |
---|
251 | 64, |
---|
252 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
253 | &Partition_id[ 1 ] |
---|
254 | ); |
---|
255 | directive_failed( status, "rtems_partition_create" ); |
---|
256 | puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" ); |
---|
257 | |
---|
258 | status = rtems_partition_create( |
---|
259 | Partition_name[ 1 ], |
---|
260 | Partition_good_area, |
---|
261 | 128, |
---|
262 | 32, |
---|
263 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
264 | &Junk_id |
---|
265 | ); |
---|
266 | fatal_directive_status( |
---|
267 | status, |
---|
268 | RTEMS_TOO_MANY, |
---|
269 | "rtems_partition_create of too many" |
---|
270 | ); |
---|
271 | puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" ); |
---|
272 | |
---|
273 | status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 ); |
---|
274 | directive_failed( status, "rtems_partition_get_buffer"); |
---|
275 | puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); |
---|
276 | |
---|
277 | status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 ); |
---|
278 | directive_failed( status, "rtems_partition_get_buffer" ); |
---|
279 | puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); |
---|
280 | |
---|
281 | status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 ); |
---|
282 | fatal_directive_status( |
---|
283 | status, |
---|
284 | RTEMS_UNSATISFIED, |
---|
285 | "rtems_partition_get_buffer unsatisfied" |
---|
286 | ); |
---|
287 | puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" ); |
---|
288 | |
---|
289 | status = rtems_partition_delete( Partition_id[ 1 ] ); |
---|
290 | fatal_directive_status( |
---|
291 | status, |
---|
292 | RTEMS_RESOURCE_IN_USE, |
---|
293 | "rtems_partition_delete with buffers in use" |
---|
294 | ); |
---|
295 | puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" ); |
---|
296 | |
---|
297 | status = rtems_partition_return_buffer( |
---|
298 | Partition_id[ 1 ], |
---|
299 | Region_good_area /* NOTE: Region Memory */ |
---|
300 | ); |
---|
301 | fatal_directive_status( |
---|
302 | status, |
---|
303 | RTEMS_INVALID_ADDRESS, |
---|
304 | "rtems_partition_return_buffer with buffer address out of partition" |
---|
305 | ); |
---|
306 | puts( |
---|
307 | "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range" |
---|
308 | ); |
---|
309 | |
---|
310 | status = rtems_partition_return_buffer( |
---|
311 | Partition_id[ 1 ], |
---|
312 | &Partition_good_area[ 7 ] |
---|
313 | ); |
---|
314 | fatal_directive_status( |
---|
315 | status, |
---|
316 | RTEMS_INVALID_ADDRESS, |
---|
317 | "rtems_partition_return_buffer with buffer address not on boundary" |
---|
318 | ); |
---|
319 | puts_nocr( "TA1 - rtems_partition_return_buffer - " ); |
---|
320 | puts ( "RTEMS_INVALID_ADDRESS - not on boundary"); |
---|
321 | } |
---|