source: rtems/testsuites/sptests/sp09/screen12.c @ c896e8d

4.104.114.84.95
Last change on this file since c896e8d was c896e8d, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 19, 1995 at 9:44:52 PM

Heap changes required some changes in this screen.

  • Property mode set to 100644
File size: 8.3 KB
Line 
1/*  Screen12
2 *
3 *  This routine generates error screen 12 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
10 *  On-Line Applications Research Corporation (OAR).
11 *  All rights assigned to U.S. Government, 1994.
12 *
13 *  This material may be reproduced by or for the U.S. Government pursuant
14 *  to the copyright license under the clause at DFARS 252.227-7013.  This
15 *  notice must appear in all copies of this file and its derivatives.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void Screen12()
23{
24  void              *segment_address_1;
25  void              *segment_address_2;
26  void              *segment_address_3;
27  rtems_unsigned32   offset;
28  rtems_unsigned32   good_front_flag;
29  rtems_unsigned32   good_back_flag;
30  rtems_status_code  status;
31
32  status = rtems_region_create(
33    0,
34    Region_good_area,
35    0x40,
36    32,
37    RTEMS_DEFAULT_ATTRIBUTES,
38    &Junk_id
39  );
40  fatal_directive_status(
41    status,
42    RTEMS_INVALID_NAME,
43    "rtems_region_create with illegal name"
44  );
45  puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" );
46
47  status = rtems_region_create(
48    Region_name[ 1 ],
49    Region_bad_area,
50    0x40,
51    32,
52    RTEMS_DEFAULT_ATTRIBUTES,
53    &Junk_id
54  );
55  fatal_directive_status(
56    status,
57    RTEMS_INVALID_ADDRESS,
58    "rtems_region_create with illegal address"
59  );
60  puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" );
61
62  status = rtems_region_create(
63    Region_name[ 1 ],
64    Region_good_area,
65    0x40,
66    34,
67    RTEMS_DEFAULT_ATTRIBUTES,
68    &Junk_id
69  );
70  fatal_directive_status(
71    status,
72    RTEMS_INVALID_SIZE,
73    "rtems_region_create with illegal size"
74  );
75  puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" );
76
77  status = rtems_region_create(
78    Region_name[ 1 ],
79    &Region_good_area[ REGION_START_OFFSET ],
80    REGION_LENGTH,
81    0x40,
82    RTEMS_DEFAULT_ATTRIBUTES,
83    &Region_id[ 1 ]
84  );
85  directive_failed( status, "rtems_region_create" );
86  puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" );
87
88  status = rtems_region_create(
89    Region_name[ 1 ],
90    Region_good_area,
91    512,
92    0x40,
93    RTEMS_DEFAULT_ATTRIBUTES,
94    &Junk_id
95  );
96  fatal_directive_status(
97    status,
98    RTEMS_TOO_MANY,
99    "rtems_region_create of too many"
100  );
101  puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" );
102
103  status = rtems_region_delete( 100 );
104  fatal_directive_status(
105    status,
106    RTEMS_INVALID_ID,
107    "rtems_region_delete with illegal id"
108  );
109  puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" );
110
111  status = rtems_region_delete( 0x10100 );
112  fatal_directive_status(
113    status,
114    RTEMS_INVALID_ID,
115    "rtems_region_delete with illegal id"
116  );
117  puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" );
118
119  status = rtems_region_ident( 0, &Junk_id );
120  fatal_directive_status(
121    status,
122    RTEMS_INVALID_NAME,
123    "rtems_region_ident with illegal name"
124  );
125  puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" );
126
127  status = rtems_region_get_segment(
128    100,
129    0x40,
130    RTEMS_DEFAULT_OPTIONS,
131    RTEMS_NO_TIMEOUT,
132    &segment_address_1
133  );
134  fatal_directive_status(
135    status,
136    RTEMS_INVALID_ID,
137    "rtems_region_get_segment with illegal id"
138  );
139  puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" );
140
141  status = rtems_region_get_segment(
142     Region_id[ 1 ],
143     sizeof( Region_good_area ) * 2,
144     RTEMS_DEFAULT_OPTIONS,
145     RTEMS_NO_TIMEOUT,
146     &segment_address_1
147  );
148  fatal_directive_status(
149    status,
150    RTEMS_INVALID_SIZE,
151    "rtems_region_get_segment with illegal size"
152  );
153  puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" );
154
155  status = rtems_region_get_segment(
156     Region_id[ 1 ],
157     384,
158     RTEMS_DEFAULT_OPTIONS,
159     RTEMS_NO_TIMEOUT,
160     &segment_address_1
161  );
162  directive_failed( status, "rtems_region_get_segment" );
163  puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" );
164
165  status = rtems_region_get_segment(
166     Region_id[ 1 ],
167     REGION_LENGTH / 2,
168     RTEMS_NO_WAIT,
169     RTEMS_NO_TIMEOUT,
170     &segment_address_2
171  );
172  fatal_directive_status(
173    status,
174    RTEMS_UNSATISFIED,
175    "rtems_region_get_segment unsatisfied"
176  );
177  puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" );
178
179  puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" );
180  status = rtems_region_get_segment(
181    Region_id[ 1 ],
182    128,
183    RTEMS_DEFAULT_OPTIONS,
184    3 * TICKS_PER_SECOND,
185    &segment_address_3
186  );
187  fatal_directive_status(
188    status,
189    RTEMS_TIMEOUT,
190    "rtems_region_get_segment timeout"
191  );
192  puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" );
193
194  status = rtems_region_delete( Region_id[ 1 ] );
195  fatal_directive_status(
196    status,
197    RTEMS_RESOURCE_IN_USE,
198    "rtems_region_delete with buffers in use"
199  );
200  puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" );
201
202  status = rtems_region_return_segment( 100, segment_address_1 );
203  fatal_directive_status(
204    status,
205    RTEMS_INVALID_ID,
206    "rtems_region_return_segment with illegal id"
207  );
208  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" );
209
210  status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area );
211  fatal_directive_status(
212    status,
213    RTEMS_INVALID_ADDRESS,
214    "rtems_region_return_segment with illegal segment"
215  );
216  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
217
218/*
219 *  The following generate internal heap errors.  Thus this code
220 *  is subject to change if the heap code changes.
221 */
222
223  puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" );
224  rtems_debug_disable( RTEMS_DEBUG_REGION );
225
226#if 0
227
228  offset = (segment_address_1 - (void *)Region_good_area) / 4;
229
230/* bad FRONT_FLAG error */
231
232  good_front_flag = Region_good_area[ offset - 1 ];
233  Region_good_area[ offset - 1 ] = good_front_flag + 2;
234
235  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
236  fatal_directive_status(
237    status,
238    RTEMS_INVALID_ADDRESS,
239    "rtems_region_return_segment with back_flag != front_flag"
240  );
241  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
242
243  Region_good_area[ offset - 1 ] = good_front_flag;
244
245/* bad FRONT_FLAG error */
246
247  good_back_flag = Region_good_area[ offset - 2 ];
248  Region_good_area[ offset - 2 ] = 1024;
249
250  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
251  fatal_directive_status(
252    status,
253    RTEMS_INVALID_ADDRESS,
254    "rtems_region_return_segment with back_flag != front_flag"
255  );
256  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
257
258  Region_good_area[ offset - 2 ] = good_back_flag;
259
260#else
261  offset = 0;
262  good_front_flag = 0;
263  good_back_flag = 0;
264  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
265  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS - SKIPPED" );
266#endif
267
268  puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" );
269  rtems_debug_enable( RTEMS_DEBUG_REGION );
270
271  status = rtems_region_extend(
272    100,
273    Region_good_area,
274    128
275  );
276  fatal_directive_status(
277    status,
278    RTEMS_INVALID_ID,
279    "rtems_region_extend with illegal id"
280  );
281  puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" );
282
283  status = rtems_region_extend(
284    Region_id[ 1 ],
285    &Region_good_area[ REGION_START_OFFSET + 16 ],
286    128
287  );
288  fatal_directive_status(
289    status,
290    RTEMS_INVALID_ADDRESS,
291    "rtems_region_extend with illegal starting address"
292  );
293  puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" );
294
295  status = rtems_region_extend(
296    Region_id[ 1 ],
297    Region_bad_area,
298    128
299  );
300  fatal_directive_status(
301    status,
302    RTEMS_NOT_IMPLEMENTED,
303    "rtems_region_extend with unsupported starting address"
304  );
305  puts(
306    "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED"
307  );
308
309  status = rtems_region_extend(
310    Region_id[ 1 ],
311    &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ],
312    128
313  );
314  fatal_directive_status(
315    status,
316    RTEMS_NOT_IMPLEMENTED,
317    "rtems_region_extend with unsupported starting address"
318  );
319  puts(
320    "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED"
321  );
322
323  status = rtems_region_extend(
324    Region_id[ 1 ],
325    &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ],
326    128
327  );
328  fatal_directive_status(
329    status,
330    RTEMS_NOT_IMPLEMENTED,
331    "rtems_region_extend with unsupported starting address"
332  );
333  puts(
334    "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED"
335  );
336
337}
Note: See TracBrowser for help on using the repository browser.