source: rtems/testsuites/sptests/sp09/screen11.c @ d4b75d2

4.104.115
Last change on this file since d4b75d2 was d4b75d2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/14/09 at 16:01:01

2009-05-14 Joel Sherrill <joel.sherrill@…>

  • sp09/screen11.c, sp09/sp09.scn: Add case where buffer size is not large enough for buffer node overhead.
  • Property mode set to 100644
File size: 7.3 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  status = rtems_partition_get_buffer( 100, &buffer_address_1 );
195  fatal_directive_status(
196    status,
197    RTEMS_INVALID_ID,
198    "rtems_partition_get_buffer with illegal id"
199  );
200  puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" );
201
202  status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id );
203  fatal_directive_status(
204    status,
205    RTEMS_INVALID_NAME,
206    "rtems_partition_ident with illegal name"
207  );
208  puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" );
209
210  status = rtems_partition_return_buffer( 100, buffer_address_1 );
211  fatal_directive_status(
212    status,
213    RTEMS_INVALID_ID,
214    "rtems_partition_return_buffer with illegal id"
215  );
216  puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" );
217
218  status = rtems_partition_create(
219    Partition_name[ 1 ],
220    Partition_good_area,
221    128,
222    64,
223    RTEMS_DEFAULT_ATTRIBUTES,
224    &Partition_id[ 1 ]
225  );
226  directive_failed( status, "rtems_partition_create" );
227  puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" );
228
229  status = rtems_partition_create(
230    Partition_name[ 1 ],
231    Partition_good_area,
232    128,
233    32,
234    RTEMS_DEFAULT_ATTRIBUTES,
235    &Junk_id
236  );
237  fatal_directive_status(
238    status,
239    RTEMS_TOO_MANY,
240    "rtems_partition_create of too many"
241  );
242  puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" );
243
244  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 );
245  directive_failed( status, "rtems_partition_get_buffer");
246  puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
247
248  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 );
249  directive_failed( status, "rtems_partition_get_buffer" );
250  puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
251
252  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 );
253  fatal_directive_status(
254    status,
255    RTEMS_UNSATISFIED,
256    "rtems_partition_get_buffer unsatisfied"
257  );
258  puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" );
259
260  status = rtems_partition_delete( Partition_id[ 1 ] );
261  fatal_directive_status(
262    status,
263    RTEMS_RESOURCE_IN_USE,
264    "rtems_partition_delete with buffers in use"
265  );
266  puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" );
267
268  status = rtems_partition_return_buffer(
269    Partition_id[ 1 ],
270    Region_good_area                  /* NOTE: Region Memory */
271  );
272  fatal_directive_status(
273    status,
274    RTEMS_INVALID_ADDRESS,
275    "rtems_partition_return_buffer with buffer address out of partition"
276  );
277  puts(
278    "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range"
279  );
280
281  status = rtems_partition_return_buffer(
282    Partition_id[ 1 ],
283    &Partition_good_area[ 7 ]
284  );
285  fatal_directive_status(
286    status,
287    RTEMS_INVALID_ADDRESS,
288    "rtems_partition_return_buffer with buffer address not on boundary"
289  );
290  puts_nocr( "TA1 - rtems_partition_return_buffer - " );
291  puts     ( "RTEMS_INVALID_ADDRESS - not on boundary");
292}
Note: See TracBrowser for help on using the repository browser.