source: rtems/testsuites/sptests/sp09/screen11.c @ 8d8c1f1

4.104.115
Last change on this file since 8d8c1f1 was 8d8c1f1, checked in by Joel Sherrill <joel.sherrill@…>, on 09/28/09 at 19:39:06

2009-09-28 Joel Sherrill <joel.sherrill@…>

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