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

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 8.1 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    128,
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    128,
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    128,
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    128,
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    128,
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    128,
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     384,
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  offset = (segment_address_1 - (void *)Region_good_area) / 4;
227
228/* bad FRONT_FLAG error */
229
230  good_front_flag = Region_good_area[ offset - 1 ];
231  Region_good_area[ offset - 1 ] = good_front_flag + 2;
232
233  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
234  fatal_directive_status(
235    status,
236    RTEMS_INVALID_ADDRESS,
237    "rtems_region_return_segment with back_flag != front_flag"
238  );
239  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
240
241  Region_good_area[ offset - 1 ] = good_front_flag;
242
243/* bad FRONT_FLAG error */
244
245  good_back_flag = Region_good_area[ offset - 2 ];
246  Region_good_area[ offset - 2 ] = 1024;
247
248  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
249  fatal_directive_status(
250    status,
251    RTEMS_INVALID_ADDRESS,
252    "rtems_region_return_segment with back_flag != front_flag"
253  );
254  puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" );
255
256  Region_good_area[ offset - 2 ] = good_back_flag;
257
258  puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" );
259  rtems_debug_enable( RTEMS_DEBUG_REGION );
260
261  status = rtems_region_extend(
262    100,
263    Region_good_area,
264    128
265  );
266  fatal_directive_status(
267    status,
268    RTEMS_INVALID_ID,
269    "rtems_region_extend with illegal id"
270  );
271  puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" );
272
273  status = rtems_region_extend(
274    Region_id[ 1 ],
275    &Region_good_area[ REGION_START_OFFSET + 16 ],
276    128
277  );
278  fatal_directive_status(
279    status,
280    RTEMS_INVALID_ADDRESS,
281    "rtems_region_extend with illegal starting address"
282  );
283  puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" );
284
285  status = rtems_region_extend(
286    Region_id[ 1 ],
287    Region_bad_area,
288    128
289  );
290  fatal_directive_status(
291    status,
292    RTEMS_NOT_IMPLEMENTED,
293    "rtems_region_extend with unsupported starting address"
294  );
295  puts(
296    "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED"
297  );
298
299  status = rtems_region_extend(
300    Region_id[ 1 ],
301    &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ],
302    128
303  );
304  fatal_directive_status(
305    status,
306    RTEMS_NOT_IMPLEMENTED,
307    "rtems_region_extend with unsupported starting address"
308  );
309  puts(
310    "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED"
311  );
312
313  status = rtems_region_extend(
314    Region_id[ 1 ],
315    &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ],
316    128
317  );
318  fatal_directive_status(
319    status,
320    RTEMS_NOT_IMPLEMENTED,
321    "rtems_region_extend with unsupported starting address"
322  );
323  puts(
324    "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED"
325  );
326
327}
Note: See TracBrowser for help on using the repository browser.