source: rtems/testsuites/sptests/sp09/screen03.c @ b1274bd9

4.104.115
Last change on this file since b1274bd9 was b1274bd9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 03:33:25

Whitespace removal.

  • Property mode set to 100644
File size: 6.1 KB
Line 
1/*  Screen3
2 *
3 *  This routine generates error screen 3 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989-1999.
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 Screen3()
22{
23  rtems_name        task_name;
24  rtems_status_code status;
25  bool              skipUnsatisfied;
26
27  /* task create bad name */
28  task_name = 1;
29  status = rtems_task_create(
30    0,
31    1,
32    RTEMS_MINIMUM_STACK_SIZE,
33    RTEMS_DEFAULT_MODES,
34    RTEMS_DEFAULT_ATTRIBUTES,
35    &Junk_id
36  );
37  fatal_directive_status(
38    status,
39    RTEMS_INVALID_NAME,
40    "rtems_task_create with illegal name"
41  );
42  puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" );
43
44  /* null ID */
45  status = rtems_task_create(
46    Task_name[ 1 ],
47    4,
48    RTEMS_MINIMUM_STACK_SIZE,
49    RTEMS_DEFAULT_MODES,
50    RTEMS_DEFAULT_ATTRIBUTES,
51    NULL
52  );
53  fatal_directive_status(
54    status,
55    RTEMS_INVALID_ADDRESS,
56    "rtems_task_create with NULL ID param"
57  );
58  puts( "TA1 - rtems_task_create - RTEMS_INVALID_ADDRESS" );
59
60  /*
61   * If the bsp provides its own stack allocator, then
62   * skip the test that tries to allocate a stack that is too big.
63   *
64   * If on the m32c, we can't even ask for enough memory to trip this
65   * error.
66   */
67
68  skipUnsatisfied = false;
69  if (rtems_configuration_get_stack_allocate_hook())
70    skipUnsatisfied = true;
71  #if defined(__m32c__)
72    skipUnsatisfied = true;
73  #endif
74
75  if ( skipUnsatisfied ) {
76    puts(
77      "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED  -- SKIPPED"
78    );
79  } else {
80      status = rtems_task_create(
81        task_name,
82        1,
83        rtems_configuration_get_work_space_size(),
84        RTEMS_DEFAULT_MODES,
85        RTEMS_DEFAULT_ATTRIBUTES,
86        &Junk_id
87      );
88      fatal_directive_status(
89        status,
90        RTEMS_UNSATISFIED,
91        "rtems_task_create with a stack size larger than the workspace"
92      );
93      puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" );
94  }
95
96  status = rtems_task_create(
97    Task_name[ 2 ],
98    4,
99    RTEMS_MINIMUM_STACK_SIZE,
100    RTEMS_DEFAULT_MODES,
101    RTEMS_DEFAULT_ATTRIBUTES,
102    &Task_id[ 2 ]
103  );
104  directive_failed( status, "rtems_task_create of TA2" );
105  puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
106
107  status = rtems_task_suspend( Task_id[ 2 ] );
108  directive_failed( status, "rtems_task_suspend of TA2" );
109  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" );
110
111  status = rtems_task_suspend( Task_id[ 2 ] );
112  fatal_directive_status(
113    status,
114    RTEMS_ALREADY_SUSPENDED,
115    "rtems_task_suspend of suspended TA2"
116  );
117  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" );
118
119  status = rtems_task_resume( Task_id[ 2 ] );
120  directive_failed( status, "rtems_task_resume of TA2" );
121  puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" );
122
123  status = rtems_task_create(
124    Task_name[ 3 ],
125    4,
126    RTEMS_MINIMUM_STACK_SIZE,
127    RTEMS_DEFAULT_MODES,
128    RTEMS_DEFAULT_ATTRIBUTES,
129    &Task_id[ 3 ]
130  );
131  directive_failed( status, "rtems_task_create of TA3" );
132  puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" );
133
134  status = rtems_task_create(
135    Task_name[ 4 ],
136    4,
137    RTEMS_MINIMUM_STACK_SIZE,
138    RTEMS_DEFAULT_MODES,
139    RTEMS_DEFAULT_ATTRIBUTES,
140    &Task_id[ 4 ]
141  );
142  directive_failed( status, "rtems_task_create of TA4" );
143  puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" );
144
145  status = rtems_task_create(
146    Task_name[ 5 ],
147    4,
148    RTEMS_MINIMUM_STACK_SIZE,
149    RTEMS_DEFAULT_MODES,
150    RTEMS_DEFAULT_ATTRIBUTES,
151    &Task_id[ 5 ]
152  );
153  directive_failed( status, "rtems_task_create of TA5" );
154  puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" );
155
156  status = rtems_task_create(
157    Task_name[ 6 ],
158    4,
159    RTEMS_MINIMUM_STACK_SIZE,
160    RTEMS_DEFAULT_MODES,
161    RTEMS_DEFAULT_ATTRIBUTES,
162    &Task_id[ 6 ]
163  );
164  directive_failed( status, "rtems_task_create of TA6" );
165  puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" );
166
167  status = rtems_task_create(
168    Task_name[ 7 ],
169    4,
170    RTEMS_MINIMUM_STACK_SIZE,
171    RTEMS_DEFAULT_MODES,
172    RTEMS_DEFAULT_ATTRIBUTES,
173    &Task_id[ 7 ]
174  );
175  directive_failed( status, "rtems_task_create of TA7" );
176  puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" );
177
178  status = rtems_task_create(
179    Task_name[ 8 ],
180    4,
181    RTEMS_MINIMUM_STACK_SIZE,
182    RTEMS_DEFAULT_MODES,
183    RTEMS_DEFAULT_ATTRIBUTES,
184    &Task_id[ 8 ]
185  );
186  directive_failed( status, "rtems_task_create of TA8" );
187  puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" );
188
189  status = rtems_task_create(
190    Task_name[ 9 ],
191    4,
192    RTEMS_MINIMUM_STACK_SIZE,
193    RTEMS_DEFAULT_MODES,
194    RTEMS_DEFAULT_ATTRIBUTES,
195    &Task_id[ 9 ]
196  );
197  directive_failed( status, "rtems_task_create of TA9" );
198  puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" );
199
200  status = rtems_task_create(
201    Task_name[ 10 ],
202    4,
203    RTEMS_MINIMUM_STACK_SIZE,
204    RTEMS_DEFAULT_MODES,
205    RTEMS_DEFAULT_ATTRIBUTES,
206    &Task_id[ 10 ]
207  );
208  directive_failed( status, "rtems_task_create of TA10" );
209  puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" );
210
211  status = rtems_task_create(
212    task_name,
213    4,
214    RTEMS_MINIMUM_STACK_SIZE,
215    RTEMS_DEFAULT_MODES,
216    RTEMS_DEFAULT_ATTRIBUTES,
217    &Junk_id
218  );
219  fatal_directive_status(
220    status,
221    RTEMS_TOO_MANY,
222    "rtems_task_create for too many tasks"
223  );
224  puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" );
225
226  /*
227   *  The check for an object being global is only made if
228   *  multiprocessing is enabled.
229   */
230
231#if defined(RTEMS_MULTIPROCESSING)
232  status = rtems_task_create(
233    task_name,
234    4,
235    RTEMS_MINIMUM_STACK_SIZE,
236    RTEMS_DEFAULT_MODES,
237    RTEMS_GLOBAL,
238    &Junk_id
239  );
240  fatal_directive_status(
241    status,
242    RTEMS_MP_NOT_CONFIGURED,
243    "rtems_task_create of global task in a single cpu system"
244  );
245#endif
246  puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" );
247}
Note: See TracBrowser for help on using the repository browser.