source: rtems/testsuites/sptests/sptask_err03/init.c @ 46c23871

5
Last change on this file since 46c23871 was 46c23871, checked in by Sebastian Huber <sebastian.huber@…>, on 06/16/20 at 05:28:58

rtems: Remove RTEMS_MP_NOT_CONFIGURED error

Some objects can be created with a local or global scope in a
multiprocessing network. In non-multiprocessing configurations setting
the scope to local or global had no effect since such a system can be
viewed as a multiprocessing network with just one node. One and all
nodes is the same in such a network. However, if multiprocessing was
configured, creation of a global object in a single node network
resulted in an RTEMS_MP_NOT_CONFIGURED error. Remove this error
condition for symmetry to the non-multiprocessing setup. This is in line
with the task affinity behaviour in SMP systems.

Update #4005.

  • Property mode set to 100644
File size: 6.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 2014.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16
17const char rtems_test_name[] = "SP TASK ERROR 03";
18
19rtems_task Init(
20  rtems_task_argument argument
21)
22{
23  rtems_name        task_name;
24  rtems_status_code status;
25  bool              skipUnsatisfied;
26 
27  TEST_BEGIN();
28 
29  Task_name[ 1 ]       =  rtems_build_name( 'T', 'A', '1', ' ' );
30  Task_name[ 2 ]       =  rtems_build_name( 'T', 'A', '2', ' ' );
31  Task_name[ 3 ]       =  rtems_build_name( 'T', 'A', '3', ' ' );
32  Task_name[ 4 ]       =  rtems_build_name( 'T', 'A', '4', ' ' );
33  Task_name[ 5 ]       =  rtems_build_name( 'T', 'A', '5', ' ' );
34  Task_name[ 6 ]       =  rtems_build_name( 'T', 'A', '6', ' ' );
35  Task_name[ 7 ]       =  rtems_build_name( 'T', 'A', '7', ' ' );
36  Task_name[ 8 ]       =  rtems_build_name( 'T', 'A', '8', ' ' );
37  Task_name[ 9 ]       =  rtems_build_name( 'T', 'A', '9', ' ' );
38  Task_name[ 10 ]      =  rtems_build_name( 'T', 'A', 'A', ' ' );
39
40  /* task create bad name */
41  task_name = 1;
42  status = rtems_task_create(
43    0,
44    1,
45    RTEMS_MINIMUM_STACK_SIZE,
46    RTEMS_DEFAULT_MODES,
47    RTEMS_DEFAULT_ATTRIBUTES,
48    &Junk_id
49  );
50  fatal_directive_status(
51    status,
52    RTEMS_INVALID_NAME,
53    "rtems_task_create with illegal name"
54  );
55  puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" );
56
57  /* null ID */
58  status = rtems_task_create(
59    Task_name[ 1 ],
60    4,
61    RTEMS_MINIMUM_STACK_SIZE,
62    RTEMS_DEFAULT_MODES,
63    RTEMS_DEFAULT_ATTRIBUTES,
64    NULL
65  );
66  fatal_directive_status(
67    status,
68    RTEMS_INVALID_ADDRESS,
69    "rtems_task_create with NULL ID param"
70  );
71  puts( "TA1 - rtems_task_create - RTEMS_INVALID_ADDRESS" );
72
73  /*
74   * If the bsp provides its own stack allocator, then
75   * skip the test that tries to allocate a stack that is too big.
76   */
77
78  skipUnsatisfied = false;
79  if (rtems_configuration_get_stack_allocate_hook())
80    skipUnsatisfied = true;
81
82  if ( skipUnsatisfied ) {
83    puts(
84      "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED  -- SKIPPED"
85    );
86  } else {
87      status = rtems_task_create(
88        task_name,
89        1,
90        rtems_configuration_get_work_space_size(),
91        RTEMS_DEFAULT_MODES,
92        RTEMS_DEFAULT_ATTRIBUTES,
93        &Junk_id
94      );
95      fatal_directive_status(
96        status,
97        RTEMS_UNSATISFIED,
98        "rtems_task_create with a stack size larger than the workspace"
99      );
100      puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" );
101  }
102   status = rtems_task_create(
103    Task_name[ 1 ],
104    4,
105    RTEMS_MINIMUM_STACK_SIZE * 3,
106    RTEMS_DEFAULT_MODES,
107    RTEMS_DEFAULT_ATTRIBUTES,
108    &Task_id[ 1 ]
109  );
110  directive_failed( status, "rtems_task_create of TA1" );
111
112  status = rtems_task_create(
113    Task_name[ 2 ],
114    4,
115    RTEMS_MINIMUM_STACK_SIZE,
116    RTEMS_DEFAULT_MODES,
117    RTEMS_DEFAULT_ATTRIBUTES,
118    &Task_id[ 2 ]
119  );
120  directive_failed( status, "rtems_task_create of TA2" );
121  puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
122
123  status = rtems_task_suspend( Task_id[ 2 ] );
124  directive_failed( status, "rtems_task_suspend of TA2" );
125  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" );
126
127  status = rtems_task_suspend( Task_id[ 2 ] );
128  fatal_directive_status(
129    status,
130    RTEMS_ALREADY_SUSPENDED,
131    "rtems_task_suspend of suspended TA2"
132  );
133  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" );
134
135  status = rtems_task_resume( Task_id[ 2 ] );
136  directive_failed( status, "rtems_task_resume of TA2" );
137  puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" );
138
139  status = rtems_task_create(
140    Task_name[ 3 ],
141    4,
142    RTEMS_MINIMUM_STACK_SIZE,
143    RTEMS_DEFAULT_MODES,
144    RTEMS_DEFAULT_ATTRIBUTES,
145    &Task_id[ 3 ]
146  );
147  directive_failed( status, "rtems_task_create of TA3" );
148  puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" );
149
150  status = rtems_task_create(
151    Task_name[ 5 ],
152    4,
153    RTEMS_MINIMUM_STACK_SIZE,
154    RTEMS_DEFAULT_MODES,
155    RTEMS_DEFAULT_ATTRIBUTES,
156    &Task_id[ 5 ]
157  );
158  directive_failed( status, "rtems_task_create of TA5" );
159  puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" );
160
161  status = rtems_task_create(
162    Task_name[ 6 ],
163    4,
164    RTEMS_MINIMUM_STACK_SIZE,
165    RTEMS_DEFAULT_MODES,
166    RTEMS_DEFAULT_ATTRIBUTES,
167    &Task_id[ 6 ]
168  );
169  directive_failed( status, "rtems_task_create of TA6" );
170  puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" );
171
172  status = rtems_task_create(
173    Task_name[ 7 ],
174    4,
175    RTEMS_MINIMUM_STACK_SIZE,
176    RTEMS_DEFAULT_MODES,
177    RTEMS_DEFAULT_ATTRIBUTES,
178    &Task_id[ 7 ]
179  );
180  directive_failed( status, "rtems_task_create of TA7" );
181  puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" );
182
183  status = rtems_task_create(
184    Task_name[ 8 ],
185    4,
186    RTEMS_MINIMUM_STACK_SIZE,
187    RTEMS_DEFAULT_MODES,
188    RTEMS_DEFAULT_ATTRIBUTES,
189    &Task_id[ 8 ]
190  );
191  directive_failed( status, "rtems_task_create of TA8" );
192  puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" );
193
194  status = rtems_task_create(
195    Task_name[ 9 ],
196    4,
197    RTEMS_MINIMUM_STACK_SIZE,
198    RTEMS_DEFAULT_MODES,
199    RTEMS_DEFAULT_ATTRIBUTES,
200    &Task_id[ 9 ]
201  );
202  directive_failed( status, "rtems_task_create of TA9" );
203  puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" );
204
205  status = rtems_task_create(
206    Task_name[ 10 ],
207    4,
208    RTEMS_MINIMUM_STACK_SIZE,
209    RTEMS_DEFAULT_MODES,
210    RTEMS_DEFAULT_ATTRIBUTES,
211    &Task_id[ 10 ]
212  );
213  directive_failed( status, "rtems_task_create of TA10" );
214  puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" );
215
216  status = rtems_task_create(
217    task_name,
218    4,
219    RTEMS_MINIMUM_STACK_SIZE,
220    RTEMS_DEFAULT_MODES,
221    RTEMS_DEFAULT_ATTRIBUTES,
222    &Junk_id
223  );
224  fatal_directive_status(
225    status,
226    RTEMS_TOO_MANY,
227    "rtems_task_create for too many tasks"
228  );
229  puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" );
230
231  TEST_END();
232}
Note: See TracBrowser for help on using the repository browser.